Multiple regression: Difference between revisions
m
→{{header|Stata}}
(+Stata) |
|||
Line 1,307:
gen y=1.5+0.8*x1-0.7*x2+1.1*x3-1.7*x4+rnormal()</lang>
Now, use the '''[https://www.stata.com/help.cgi?regress regress]''' command:
<lang stata>reg y x*</lang>
Line 1,332:
------------------------------------------------------------------------------</pre>
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]
Line 1,346:
.06978623</lang>
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
Line 1,373:
. predict yhat, xb
. predict r, r</lang>
=={{header|Tcl}}==
|