Search code examples
python-3.xstatsmodelsquantile-regression

QuantReg:'Interactive' object has no attribute 'fit'


I am trying to fit quantile regression with statsmodels. The same code that works in my laptop fails in the cloud and says it does not have fit method. But in the documentation, I see it has fit method. What is causing it? I am using it inside zeppelin notebook.

 from statsmodels.regression.quantile_regression import QuantReg
from statsmodels.tools.tools import add_constant
X = temp[['X']]
y = temp['y']
X = add_constant(X)
mod = QuantReg(y, X)
res = mod.fit(q = 0.5)
 

This is the error message I am getting:

AttributeError: 'Interactive' object has no attribute 'fit'


Solution

  • It seems that the variable (mod) might have a namespace conflict internally within the statsmodel. Using a different name for mod variable to mod1 etc might help here.