= Stata regress = The '''`regress`''' command fits a [[Statistics/OrdinaryLeastSquares|linear model]]. <> ---- == 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 == [[https://www.stata.com/manuals/rregress.pdf|Stata manual for regress]] [[https://www.stata.com/manuals/rregresspostestimation.pdf|Stata manual for regress post-estimation]] ---- CategoryRicottone