I am using statsmodels library for WLS. I am trying to get residuals but it returns value list of nan. Do anyone know what is the problem. Values in dataframe in column x and y are float.
import pandas as pd
import statsmodels.formula.api as smf
res = smf.wls('y ~ x', data=df).fit()
#get residuals
print(OLSInfluence(res).resid_studentized_external)
I found out that it works on ols, but I need it for wls. So below code returns residual values for ols
res = smf.ols('y ~ x', data=df, weights = df["weight"]).fit()
#get residuals
print(OLSInfluence(res).resid_studentized_external)