This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Using Stata 9 and Higher for OLS Regression – Page 1 Using Stata 9 & Higher for OLS Regression Introduction . Stata is a popular alternative to SPSS, especially for more advanced statistical techniques. This handout shows you how Stata can be used for OLS regression. It assumes knowledge of the statistical concepts that are presented. Several other Stata commands (e.g. logit , ologit ) often have the same general format and many of the same options. Rather than specify all options at once, like you do in SPSS, in Stata you often give a series of commands. In some ways, this is more tedious, but it also gives you flexibility in that you don’t have to rerun the entire analysis if you think of something else you want. As the Stata 9 User’s Guide says (p. 43) “The user-interface model is type a little, get a little, etc. so that the user is always in control.” For the most part, I find that either Stata or SPSS can give me the results I want, but there are some tasks that can be done more easily in one program than the other. For example, I personally prefer to do most of my database manipulation in SPSS and then convert the file to Stata, but that is partly because I am much more familiar with the SPSS commands than their Stata counterparts. Conversely, Stata’s statistical commands are generally far more logical and consistent (and sometimes more powerful) than their SPSS counterparts. Luckily, with the separate Stat Transfer program, it is very easy to convert SPSS files to Stata and vice-versa. Get the data. First, open the previously saved data set. (Stata, of course, also has means for entering, editing and otherwise managing data.) You can give the directory and file name, or even access a file that is on the web. For example, . use http://www.nd.edu/~rwilliam/stats1/statafiles/reg01.dta, clear Descriptive statistics. There are various ways to get descriptive statistics in Stata. Since you are using different commands, you want to be careful that you are analyzing the same data throughout, e.g. missing data could change the cases that get analyzed. The correlate command below uses listwise deletion of missing data, which is the same as what the regress command does, i.e. a case is deleted if it is missing data on any of the variables in the analysis. . correlate income educ jobexp race, means (obs=20) Variable | Mean Std. Dev. Min Max -------------+---------------------------------------------------- income | 24.415 9.788354 5 48.3 educ | 12.05 4.477723 2 21 jobexp | 12.65 5.460625 1 21 race | .5 .5129892 0 1 | income educ jobexp race -------------+------------------------------------ income | 1.0000 educ | 0.8457 1.0000 jobexp | 0.2677 -0.1069 1.0000 race | -0.5676 -0.7447 0.2161 1.0000 Using Stata 9 and Higher for OLS Regression – Page 2 Regression . Use the regress command for OLS regression (you can abbreviate it as reg )....
View Full Document
This note was uploaded on 02/29/2012 for the course SOC 63993 taught by Professor Richardwilliams during the Spring '11 term at Notre Dame.
- Spring '11