Published on SOCY 7112G (

More on Logistic Regression

By Professor Shortell
Created 12/02/2013 - 4:37pm

# We'll look at another example of logistic regression and
# model specification. This time, we'll use the ANES 2012.


# First, we'll create a binary vector for party affiliation
# that compares just Democrats and Republicans. With the
# new variable, "repub", we'll be building a model that
# tries to predict the characteristics associated with the
# odds of identifying as a Republican rather than a Democrat.

repub=0; repub[pid_self==1]<-0; repub[pid_self==2]<-1

# Now, we'll specify our base model.

# We'll use the index that measures attitude toward federal
# spending that we created earlier. The source code is here:

# Let's create a binary vector for marital status (married, not married):
married=0; married<-ifelse(dem_marital==1,1,0)

# We'll use a pair of binary vectors to measure race. The
# code is here:

# We'll use binary vectors for education and region:

# Now we can run the base model.


Source URL: