Multiple regression: Difference between revisions

Content added Content deleted
(+Stata)
Line 1,307: Line 1,307:
gen y=1.5+0.8*x1-0.7*x2+1.1*x3-1.7*x4+rnormal()</lang>
gen y=1.5+0.8*x1-0.7*x2+1.1*x3-1.7*x4+rnormal()</lang>


Now, use the regress command:
Now, use the '''[https://www.stata.com/help.cgi?regress regress]''' command:


<lang stata>reg y x*</lang>
<lang stata>reg y x*</lang>
Line 1,332: Line 1,332:
------------------------------------------------------------------------------</pre>
------------------------------------------------------------------------------</pre>


The regress command also sets a number of '''ereturn''' values, which can be used by subsequent commands. The coefficients and their standard errors also have a special syntax:
The regress command also sets a number of '''[https://www.stata.com/help.cgi?ereturn ereturn]''' values, which can be used by subsequent commands. The coefficients and their standard errors also have a special syntax:


<lang stata>. di _b[x1]
<lang stata>. di _b[x1]
Line 1,346: Line 1,346:
.06978623</lang>
.06978623</lang>


One can compute the covariance matrix of the estimates, the predicted values, residuals... See '''estat''', '''predict''', '''estimates''', '''margins''' and others. Here are a few examples:
One can compute the covariance matrix of the estimates, the predicted values, residuals... See '''[https://www.stata.com/help.cgi?estat estat]''', '''[https://www.stata.com/help.cgi?predict predict]''', '''[https://www.stata.com/help.cgi?estimates estimates]''', '''[https://www.stata.com/help.cgi?margins margins]''' and others. Here are a few examples:


<lang stata>. estat ic
<lang stata>. estat ic
Line 1,373: Line 1,373:
. predict yhat, xb
. predict yhat, xb
. predict r, r</lang>
. predict r, r</lang>



=={{header|Tcl}}==
=={{header|Tcl}}==