|
Size: 1927
Comment: Standardize
|
← Revision 7 as of 2025-10-24 18:32:48 ⇥
Size: 1919
Comment: Rewrite
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 3: | Line 3: |
| The '''`regress`''' command fits a [[Statistics/OrdinaryLeastSquares|linear model]]. | '''`-regress-`''' fits a [[Statistics/OrdinaryLeastSquares|linear model]]. |
| Line 51: | Line 51: |
| [[https://www.stata.com/manuals/rregress.pdf|Stata manual for regress]] | [[https://www.stata.com/manuals/rregress.pdf|Stata manual for -regress-]] |
Stata regress
-regress- fits a linear model.
Contents
Usage
. webuse auto
(1978 automobile data)
. regress mpg weight displacement
Source | SS df MS Number of obs = 74
-------------+---------------------------------- F(2, 71) = 66.79
Model | 1595.40969 2 797.704846 Prob > F = 0.0000
Residual | 848.049768 71 11.9443629 R-squared = 0.6529
-------------+---------------------------------- Adj R-squared = 0.6432
Total | 2443.45946 73 33.4720474 Root MSE = 3.4561
------------------------------------------------------------------------------
mpg | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
weight | -.0065671 .0011662 -5.63 0.000 -.0088925 -.0042417
displacement | .0052808 .0098696 0.54 0.594 -.0143986 .0249602
_cons | 40.08452 2.02011 19.84 0.000 36.05654 44.11251
------------------------------------------------------------------------------
Factor Variables
To regress on the levels of a variable rather than its numeric value, prefix the variable name with i..
To regress on an interaction of variables, delimit the two variable names with #. Or use ## to indicate a full factorial (both variables and the interactions).
To create an interaction with a continuous variable, prefix them with c..
See also
Stata manual for regress post-estimation
