Size: 1377
Comment:
|
← Revision 6 as of 2025-04-04 01:00:05 ⇥
Size: 1927
Comment: Standardize
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
= Stata Regress = | = Stata regress = |
Line 3: | Line 3: |
The '''`regress`''' command runs a regression model. | The '''`regress`''' command fits a [[Statistics/OrdinaryLeastSquares|linear model]]. |
Line 14: | Line 14: |
regress dependent independent | . 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 ------------------------------------------------------------------------------ |
Line 30: | Line 48: |
== Estimates == To store the estimation results, try: {{{ estimates store example }}} To display the estimation results, try: {{{ estimates table example estimates table example, b(%10.3f) star }}} The '''`star`''' option shows significance. While coefficients are always displayed by `estimates table`, they can optionally be formatted with the '''`b(%format)`''' option (as above). There are several optional statistics available as well: * '''`se`''' or '''`se(%format)`''' for standard errors * '''`t`''' or '''`t(%format)`''' for t- or z-statistics * '''`p`''' or '''`p(%format)`''' for p-values ---- |
|
Line 59: | Line 51: |
[[https://www.stata.com/manuals/rregresspostestimation.pdf|Stata manual for logistic post-estimation]] | [[https://www.stata.com/manuals/rregress.pdf|Stata manual for regress]] [[https://www.stata.com/manuals/rregresspostestimation.pdf|Stata manual for regress post-estimation]] |
Stata regress
The regress command 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