I want to evaluate the residuals: (y-hat y).
I know how to do that:
df = pd.read_csv('myFile', delim_whitespace = True, header = None)
df.columns = ['column1', 'column2']
y, X = ps.dmatrices('column1 ~ column2',data = df, return_type = 'dataframe')
model = sm.OLS(y,X)
results = model.fit()
predictedValues = results.predict()
#print predictedValues
yData = df.as_matrix(columns = ['column1'])
res = yData - predictedValues
I wonder if there is a Method to do this (?).
That's stored in the
resid
attribute of the Results classLikewise there's a
results.fittedvalues
method, so you don't need theresults.predict()
.