STATA Simple Linear Regression for Econometrics with Example
This post will show how to calculate a simple linear regression in STATA, especially for Econometric purposes.
How to do a Simple Linear Regression in STATA
The command to do a simple linear regression in stata is:
regress y x
On the screen you will be shown the intercept and slope, the result of a 95% confidence interval for the slope and intercept and a hypothesis test at 95% whether the intercept or slope is zero.
Example of How to do a Simple Linear Regression in STATA
Using the auto.dta data set the command for a simple linear regression of price vs mpg is (price is the dependent variable, mpg is the independent variable):
regress price mpg
The STATA output is:
The top right shows you stats about the regression. The Bottom square shows you the result of the regression. Under the Coef. heading the _const is the intercept and mpg is the slope. Std. Err. stands for standard error which is shown for the slope and the intercept.