Residual variance
Hi should I use the following code to save the residual variance:
assuming sample 1 to 20
OLS Y X / PREDICT=YPRED
GENR RES=(Y-YPRED)**2
GEN1 RVAR=(1/(20-1))*Sum(RES)
Maybe i am missing something..I did not get the residual variance.Please help.
GEN1 is the same as SAMPLE 1 1 and GENR so this will only make this calculation for the 1st observation. To make this work try. GENR RVAR=SUM(RES,20)/18 where 18 is N-K. This will match the output from LIST
Thank you. But N-K= 20-1=19. (no constant)
In the above a constant is automatically inserted. To exclude a constant use the NOCONSTANT option.