CLASS EXERCISE: REGRESSION USING STATA
GET YOUR DATA FROM THE SYLLABUS AND SAVE IT
- Go to your syllabus: http://www.csuchico.edu/~shockley/syllabi/SYL_fs103s00.html
And click on "FTES Data for Class Exercise."
- Save your FTES data to C:\temp or a floppy.
ADD SOME DATA TO YOUR SPREADSHEET
- Go to Chico State’s web site & copy the Spring 00 FTES data into your spreadsheet. (Hint: search for enrollment data.)
- Insert a column on the left of your spreadsheet & label it time. Then type "1" in the first row, "2" in the second … 19 in the last.
- Change all the labels to all lower case & change the format to omit commas.
.
COPY YOUR DATA INTO STATA
- Double click on the Stata icon & click on the "Data Editor" icon.
- Copy the data from your spreadsheet & paste it into Stata’s "Data Editor."
GENERATE SOME LAGGED VARIABLES
In order to generate a 1 period lag in Stata, at the Stata prompt type:
gen univlag1 = univ[_n-1]
In a similar manner, generate a univ variable that is lagged by 2 periods, 3
periods, & 4 periods.
ADD A DUMMY VARIABLE
10. A dummy variable has a value of 0 or 1. Use a value of 1 for spring semesters and 0 for fall semesters.
REGRESS YOUR DATA
- At the Stata prompt, type the following:
reg psy univ dummy
12. Keep dummy in your regressions if it is significant. Otherwise, drop it from future regressions.
13. Regress psy with the lagged univ variables. Use the one with the highest R square to report in you spreadsheet.
ADD YOUR REGRESSION DATA TO YOUR SPREADSHEET
14. Add some rows to your spreadsheet. Label the first you add, "Fall 2000" and the remaining rows "Coefficient", "t" , "R Sq" & "Lag." Fill in the appropriate values for psy from Stata.
ANALYZE YOUR RESULTS
15. What does the coefficient(s) tell you?
- What is R2? How do you interpret it? (Hint: what does the number that you got for R2 mean? Check the definition in your text if you do not remember.)
- Is the independent variable(s) significant? (Hint: check the probability that there is "no relationship" between the dependent and independent variable in the results table that you get after you run the regression.)
SAVE YOUR DATA & GET OUT OF STATA
- At the Stata prompt, type:
save, replace
exit
DO ANOTHER REGRESSION
- Start at step 10 and repeat the above steps using another department of your choice. Generate a log file that shows steps 10 through 13.
- Use your best regression equation for Psychology and for the other department to forecast FTES for Fall 2000 and for Spring 2001.
E-MAIL ME ABOUT YOUR RESULTS
21. Send me an e-mail with a6 as the subject.
- Answer questions 13-15 above in a word document.
- Attach your spreadsheet, the word document and your spreadsheet.
STATA HINTS
- You can use Page Up to go back to previous lines you typed. Sometimes it’s easier to edit a previous line than it is to type in a new line. You can also click on a previous command & edit it.
- You can get a menu of commands by typing the following at the Stata prompt:
menu
- If you need to edit your data file, click on editor and make the changes.
- Before you exit, type: save, replace