Simple regression in Stata | Johan Osterberg - Product Engineer

Simple regression in Stata

June 14, 2019

For this post let's look at simple linear regression in Stata. As discussed previously, simple regression basically involves one independent variable and one dependent variable whose relationship is approximated by a straight line. As far as regression involving one or more independent variables (multiple regression), we will look further into that in another post. Either way, the basic command syntax is: regress depvar [indepvars]. For example:

sysuse auto, clear regress mpg weight

Simple regression

The resulting view lists many points of interests, for now though let's focus on the variables in the first column. First there's the slope coefficient, weight. The y-intercept is simply labeled _cons, short for "constant". The slope for the estimated regression is negative (-.0060087), indicating that, as weight increases mpg goes down. Moreover, the p-value is at 0.000 which indicates statistical significance.


Profile picture

Written by Johan Osterberg who lives and works in Gothenburg, Sweden as a developer specialized in e-commerce. Connect with me on Linkedin

2024 © Johan Osterberg