Use regression analysis to examine the effect of Foreign Born Percent on Difference in Interest in Trump relative to Clinton Google searches. Before beginning this portion, make sure you have downloaded the "trumpclinton_googlesearch.csv", and variable explanations text as well as completed Code Video from the Week 4 Code folder.
1. Generate a new variable for “Foreign Born Percent”. What is the correlation between Foreign Born Percent and Difference in Interest in Trump relative to Clinton (hint: try to cor() function)?
2. Create a linear regression model that uses Foreign Born Percent to explain Difference in Interest in Trump Relative to Clinton. Make a scatter plot of Foreign Born Percent (x) on Difference in Interest in Trump Relative to Clinton (y) with proper axes labels, and add the regression line to your plot. Paste the plot below.
3. Look at the summary statistics for your regression model. Interpret the intercept, coefficient estimate, and R-squared below.
4. Construct a 95% confidence interval, and interpret what it means below.
5. Let’s now say we want to control for previous partisanship at the state level, and we decide to use Vote for Romney in 2010. Create a linear regression model that now includes this variable. Look at the summary statistics of your new regression model, and interpret the intercept, coefficient estimate, and R-squared below.
6. Construct a 95% confidence interval, and interpret what it means below.