Another Logistic Regression

Logistic Regression

Let's test a model to predict voting for Trump in 2016.

First, some recodes:
Vote4Trump<-ifelse(V162034a==2,1,0) #This will be our DV
Gender<-'NA'; Gender[V161342==1]<-1; Gender[V161342==2]<-0
V161310r<-'NA'; V161310r[V161310a>=0]<-0; V161310r[V161310a==1]<-1

Now, the model:
summary(glm(Vote4Trump~Gender+V161310r+V161126,family=binomial))
exp(coef(glm(Vote4Trump~Gender+V161310r+V161126, family=binomial)))

Introduction to Logistic Regression

Using the 2016 ANES, build a model to predict political identity (to make it comparable to the model shown in class, recode political identity to Republican/Not Republican). Post your code below your interpretation so that we can see your recoding.

Introduction to the Linear Model (Multivariate Regression)

DATAFRAME: ANES 2012
ANES2016<-read.csv("http://www.shortell.nyc/online/files/anes_timeseries_2016.csv")

DV: Favorability to Democratic Party (ft_dem)

IVs: Political view (libcpre_self)
Attitude toward DACA (immig_citizen) * recoded
Attitude toward affirmative action (aa_uni) * recoded
Religiosity (relig_import)
Gender (gender_respondent)

RECODES
immig_citizenr<-ifelse(immig_citizen==1,1,0)
aa_unir<-ifelse(aa_uni==1,1,0)

Group Exercise: Correlation and Linear Regression

Use the ANES 2016 to:
(a) examine the relationship between political view and a favorability variable with a correlation coefficient; and,
(b) compute a linear regression for the same variables and interpret the results.

How is the interpretation of the correlation and linear regression different?

More practice with factorial ANOVA

Post your interpretation the results of your factorial analysis of variance, based on the model shown in class.

Group Exercise: Factorial Analysis of Variance

Select a different DV from the class demonstration and compute a factorial analysis of variance and interpret the results.

Group Exercise: Analysis of Variance (F-test)

A. Select another categorical variable to use as an independent variable and test mean differences for our DV: V162098, FT Labor unions.

B. Next, select a new DV and run another test for mean differences.

Group Exercise: T-test

Identify a numeric dependent variable from ANES 2016. Select a binary independent variable to compare two groups. (You may need to recode a categorical variable into a binary.) Perform the hypothesis test and interpret the results, as appropriate.

Group Exercise: Confidence Interval

# ANES2012<-read.csv("http://www.courseserve.info/files/ANES2012r.csv")
# ANES2016<-read.csv("http://www.shortell.nyc/online/files/anes_timeseries_2016.csv")

In 2012, the mean favorability toward the Democratic Party was 54.9 degrees. We can use this to formulate a hypothesis about favorability toward the Democrats in 2016.

H0: muDems = 54.9
H1: muDems =/= 54.9

Group Exercise: Another Z-test

Let's say that we're studying household size in Kings County. The mean HH size is 4.2 persons, with a standard deviation of 1.8 persons.

You can compute the area under the normal curve here: http://www.stat.berkeley.edu/~stark/SticiGui/Text/clt.htm#normal_curve

Pages

Subscribe to SOCY 7112 RSS