文档介绍:Goals for Today’s Lab
Binary es
Linear probability model (LPM)
Logistic regression
Getting Started
Create your working folder on your desktop. Call it “Lab2”
Drag the file to your working folder: GSS08_small6
Open Stata
Open the do file editor to create a new do file
Type in the set mands to your do file, replacing with your own paths and filenames as appropriate:
cd "drive:directory_name"
capture log close
log using ,replace
Type in a couple of notes to yourself about what this is – . “Lab2 exercise”. Enclose them in /* and */
Type in the rest of the set mands to your do file:
clear all
set memory 500000
use
set more off
We’ll use this do file to type in today’mands and then run the do file. We can also type in mands as we go to see what Stata does.
Today, we return to the GSS to explore regression models with binary es. Let’s look at factors influencing the probability/odds of voting for e Bush in 2004. For our example, we will use the following variables:
pres04, e, region, educ, race, age
mands this lab:
logit (with “or” option),
logistic
Housekeeping:
We need to manipulate some of our variables for our analysis.
First, create a dummy for “voted for bush” and recode missing data:
replace pres04=. if pres04==6
gen bush=0
replace bush=1 if pres04==2
replace bush=. if pres04==.
Next, create a dummy v