vendredi 29 novembre 2019

Performing a Heteroscedasticity test

I try to test the heteroskedasticity of my model. However, it still returns an error saying "PanelEffectsResults' object has no attribute 'resid'". I don't know how to fix this.

I used the following code to build the model:

#training and testing set
X_train, X_test, Y_train, Y_test = train_test_split(X,Y1, test_size =0.20, random_state= 8)

#creating an instance 

regression_model= LinearRegression()

#fit

regression_model.fit(X_train, Y_train)

#predict
y_predict = regression_model.predict(X_test)



#Add the constant
X = sm.add_constant(X)
model = PanelOLS(Y,X, entity_effects=True)
est = model.fit()
est

#Homoscedasticity

diag.het_breuschpagan(est.resid, est.model.exog, retres=False)

How do I get my resid?

Aucun commentaire:

Enregistrer un commentaire