How to compute the overall standard error of a linear regression model using Python? Which library should I use? I am looking for something like this, however, I can't see how to get the overall standard error. Any ideas?
1 Answer
$\begingroup$
$\endgroup$
Let's say you have linear model Y = XB + e, for Y: n*q, X: n*p, B: p*q. Then:
def standard_error(X,Y):
beta = inv(X.T.dot(X)).dot(X.T).dot(Y)
return mean((Y-X.dot(beta))**2)
result.mse_resid
. $\endgroup$