PS2
Instructions
Create a new markdown document where you will answer all questions. Submit (1) your code as an .Rmd
file, and (2) a rendered html file including only what you wish to present, to the Problem Set 2
assignment under the Assignments tab in Canvas. The problem set is due Friday, 31 January, by 10:00 EST. Name your files lastname_ps02
(.html
and .Rmd
).
All submitted work must be your own.
Data
You will use data from the carData
package for this assignment; specifically, the BEPS
data, or British Election Panel Study.
- Load the data and name it
beps
. - Use
?carData::BEPS
to see what each variable is and how it is coded. - Create a professional-looking summary table of all variables which includes their respective means and standard deviations.
Problem 1
- Estimate the following model using OLS via
lm
. Store the model inm1
.
\[ \text{Europe}_i = \beta_0 + \beta_1\text{age}_i + \beta_2\text{economic.cond.household}_i + u_i \]
Intercept all coefficient estimates substantively (including the intercept). Make sure to interpret the coefficients in terms of the scales of their respective variables and the dependent variable, so the reader has a sense of the effect size.
What is the mean squared error, the \(R^2\), and the adjusted \(R^2\) for this model? Interpret each one - explain what it means.
Problem 2
- Now estimate the following model using OLS via
lm
. Store the model inm2
.
\[ \text{Europe}_i = \beta_0 + \beta_1\text{age}_i + \beta_2\text{economic.cond.household}_i + \beta_3\text{economic.cond.national}_i + u_i \]
Describe how \(\hat{\beta}_2\) and adjusted \(R^2\) change from
m1
tom2
. Why do you think they change in the way they do - what does that tell us about how economic conditions relate to the dependent variable (theoretically-speaking)?Create a figure that plots (in the same plot) the relationship between \(\text{economic.cond.household}\) and the dependent variable and the relationship between \(\text{economic.cond.national}\) and the dependent variable. Make sure the figure looks nice and all necessary components are labeled.
Using
m2
, generate the following predicted values forEurope
:- holding
age
at 40, and both economic variables at 5 - when
age
is 20, 40, and 60, and both economic variables are at their means (3 separate predictions)
- holding
Problem 3
Estimate
m2
again, but this time, use only observations where \(\text{political.knowledge} \geq 2\). Name the modelm3
.Compare \(\hat{\beta}_3\) and the adjusted \(R^2\) between
m2
andm3
: how did they change? Come up with a theoretical explanation for why they change the way they do, and how the changes relate to political knowledge.Create a professional-looking figure that plots the relationship between
economic.cond.national
andEurope
, with one line for the relationship inm2
and one for the relationship inm3
(they should be on the same plot). Make sure to label all necessary components of the figure so the reader can interpret it.