Overview
Please see attached Campaign Data Excel file to complete the following exercise.
You are working on the campaign for a political candidate and have been able to obtain some anonymous survey data from a reliable source. The individuals surveyed were randomly selected, and the demographics of individuals appear to be representative of the voter population (i.e., they vary in age, income, and location). There are 300 individuals in the sample.
You are tasked with identifying the characteristics of those that are more and less likely to be supporters. The hope is that you can leverage this information to target campaign efforts to those who are less likely to be a supporter and sway them to become one.
You will analyze the data provided in R using the Excel file. You must first save the relevant sheet as a .CSV and import that data into R: camp <- read.csv("Campaign Data.csv"). You can then run some quick summary statistics to better understand the data.
Run a logistic regression. Your dependent variable will be "Supporter". Interpret the regression results, and describe the coefficients with respect to odds (i.e., calculate the odds ratios by taking the exponent -> exp(your coefficient value)).
For example:
camp_fit <- glm(Supporter~Age+Democrat+Income,
family=binomial,
data=camp)
print(summary(camp_fit))
#print coefficients
camp_fit$coefficients
#print the exp()
exp(coef(camp_fit))
1. Compare the null deviance to the residual/model deviance. Does your model improve upon the null?
2. Predict the probability of the individual being a supporter using a probability cutoff of 0.5.
3. Create a confusion matrix to summarize how your actual supporter/nonsupporter count compares to the predicted count. In other words, what is your prediction accuracy?
4. What are the characteristics of supporters? What are the characteristics of nonsupporters (i.e., who should you target next)?