Basic regression in Stata 1

June 10, 2019

In this post we’ll briefly be looking at regression in Stata by exploring two commands, correlate and pwcorr. The difference between these two is that the correlate only computes on combinations of values that dont include any missing data for any of the variables supplied. Generally speaking, pwcorr on the other hand will work on all combinations of data. So both are usable depending on the data available and the purpose at hand.
Let’s load the nlsw88 data and try out the correlate command:

sysuse nlsw88, clear correlate collgrad wage c_city

Here we’re running correlate on three variables. There’s no missing data in this selection so running pwcorr on the same variables will yield the same result.

Result of correlate command

We can see that the wage and c_city (ie. lives in central city) variables are positively correlated to collgrad. c_city is also positively correlated to wage which implies that those living in central city have higher wages.


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