SHAZAM Questions and Answers (Q&A) - RSS feedhttp://community.econometrics.com/questions/SHAZAM Econometrics, Statistics and Analytics Communityen<font color="white">Copyright <b>SHAZAM Analytics, 2018</b></font>Fri, 28 Oct 2011 17:23:10 +0000Residual variancehttp://community.econometrics.com/question/225/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.Fri, 28 Oct 2011 12:41:44 +0000http://community.econometrics.com/question/225/residual-variance/Comment by SHAZAMHelp for <p>Hi should I use the following code to save the residual variance:</p>
<p>assuming sample 1 to 20</p>
<pre><code>OLS Y X / PREDICT=YPRED
GENR RES=(Y-YPRED)**2
GEN1 RVAR=(1/(20-1))*Sum(RES)
</code></pre>
<p>Maybe i am missing something..I did not get the residual variance.Please help.</p>
http://community.econometrics.com/question/225/residual-variance/?comment=370#post-id-370In the above a constant is automatically inserted. To exclude a constant use the NOCONSTANT option. Fri, 28 Oct 2011 17:23:10 +0000http://community.econometrics.com/question/225/residual-variance/?comment=370#post-id-370Comment by Jack for <p>Hi should I use the following code to save the residual variance:</p>
<p>assuming sample 1 to 20</p>
<pre><code>OLS Y X / PREDICT=YPRED
GENR RES=(Y-YPRED)**2
GEN1 RVAR=(1/(20-1))*Sum(RES)
</code></pre>
<p>Maybe i am missing something..I did not get the residual variance.Please help.</p>
http://community.econometrics.com/question/225/residual-variance/?comment=371#post-id-371Thank you. But N-K= 20-1=19. (no constant)Fri, 28 Oct 2011 16:59:00 +0000http://community.econometrics.com/question/225/residual-variance/?comment=371#post-id-371Comment by SHAZAMHelp for <p>Hi should I use the following code to save the residual variance:</p>
<p>assuming sample 1 to 20</p>
<pre><code>OLS Y X / PREDICT=YPRED
GENR RES=(Y-YPRED)**2
GEN1 RVAR=(1/(20-1))*Sum(RES)
</code></pre>
<p>Maybe i am missing something..I did not get the residual variance.Please help.</p>
http://community.econometrics.com/question/225/residual-variance/?comment=372#post-id-372GEN1 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 LISTFri, 28 Oct 2011 16:14:29 +0000http://community.econometrics.com/question/225/residual-variance/?comment=372#post-id-372Answer by SHAZAMHelp for <p>Hi should I use the following code to save the residual variance:</p>
<p>assuming sample 1 to 20</p>
<pre><code>OLS Y X / PREDICT=YPRED
GENR RES=(Y-YPRED)**2
GEN1 RVAR=(1/(20-1))*Sum(RES)
</code></pre>
<p>Maybe i am missing something..I did not get the residual variance.Please help.</p>
http://community.econometrics.com/question/225/residual-variance/?answer=298#post-id-298Try the LIST option which prints this for you.
eg.
ols Y X / list
Further descriptions on these sorts of calculations are here:
[http://shazam.econ.ubc.ca/student/hill/SHAZAM.pdf](http://shazam.econ.ubc.ca/student/hill/SHAZAM.pdf)
Fri, 28 Oct 2011 15:58:52 +0000http://community.econometrics.com/question/225/residual-variance/?answer=298#post-id-298