def reset_ramsey(res, degree=5):
 order = (degree + 1)
 k_vars = res.model.exog.shape[1]
 y_fitted_vander = np.vander(res.fittedvalues, order)[:, :(-2)]
 exog = np.column_stack((res.model.exog, y_fitted_vander))
 res_aux = OLS(res.model.endog, exog).fit()
 r_matrix = np.eye((degree - 1), exog.shape[1], k_vars)
 return res_aux.f_test(r_matrix)

def reset_ramsey ( res , degree = 5 ) : order = ( degree + 1 ) k_vars = res . model . exog . shape [ 1 ] y_fitted_vander = np . vander ( res . fittedvalues , order ) [ : , : ( - 2 ) ] exog = np . column_stack ( ( res . model . exog , y_fitted_vander ) ) res_aux = OLS ( res . model . endog , exog ) . fit ( ) r_matrix = np . eye ( ( degree - 1 ) , exog . shape [ 1 ] , k_vars ) return res_aux . f_test ( r_matrix )
ramseys reset specification test for linear models this is a general specification test .