The lab is loosely based on the research conducted by Doan & Kirkpatrick (2013) entitled “Giving Girls a Shot: An Examination of Mandatory Vaccination Legislation” and published on Policy Studies Journal, 41(2), 295-318
There are 4 sets of questions to be answered. You can get up to 100 points + bonus questions. Points are indicated next to each question.
Remember to:
Research question:
What factors influence a state’s decision to introduce a mandatory HPV vaccine legislation for young girls?
Doan and Kirkpatrick (2013) analyze state’s decision to introduce a mandatory vaccine for the human papillomavirus (HPV) for all fifth- and sixth-grade girls in public schools. The vaccine was approved in 2006 and patented by Merck & Co. The two researchers were particularly interested in the influence of competing morality, economic, and public-health determinants on states’ decision making.
With regards to morality, they suggest that state politicians are responsive to the public opinion within their own state, such that they will respond to positive or negative approval of the new legislation. For instance, a high proportion of Evangelics or Catholics within the state might discourage mandatory HPV vaccine legislation as those groups have conservative view regarding sexuality and sexual activity and might disapprove the vaccine at such early age. Similarly, a high rate of negative media attention might decrease politicians’ motivation to introduce legislation mandating the HPV vaccine in order to remaining aligned with the electorate’s preferences.
By contrast, we could expect politicians to support their party’s values. “Social welfare” is generally an issue associated with Democrats, which might have greater incentives to pass a mandatory HPV vaccine regulation to appeal their electoral basis as compared to Republicans.
Finally, politicians might respond to political interests and support policies in favor of private organizations providing resources for their electoral campaign. We might expect that states were politicians receive more money from Merck & Co will be more likely to adopt such legislation.
In summary:
Hypotheses
Media salience is negatively correlated with mandatory legislation.
Proportion of stage legislature that is Democrat is positively correlated with mandatory legislation.
Religiosity (percentage of the population that is Catholic or Evangelical) is negatively correlated with mandatory legislation.
Merck PAC contribution is positively correlated with mandatory legislation.
The following variables are available in your dataset.
Variable name | Description |
---|---|
Adoption | Whether a state legislature has considered a mandatory vaccine law (=1) or not (=0) |
Democrats | Percentage of House Democrats in the state legislature |
Evangelic | Percentage of Evangelic population |
Catholics | Percentage of Catholic population |
Media | Number of articles covering the HPV vaccine issue in major news sources in a state in the past year |
Merck | Average total dollar amount of contributions given to candidates for state offices |
Given that the dependent variable is a binary outcome (1/0), a probability model is appropriate.
Answer the questions below using a linear probability model and a logistic regression model.
Robust standard errors mitigate the effects of skew or outliers in the residuals to offer a more robust standard error statistic when the data is idiosyncratic for a number of reasons, including binary outcomes.
It is harder to add these to Stargazer than it should be. Here is some code to help out:
x1 <- rnorm(100)
x2 <- rnorm(100)
y <- 3*x1 + x2 + rnorm(100,0,10)
m.01 <- lm( y ~ x1 )
m.02 <- lm( y ~ x2 )
# install.packages( "sandwhich" )
# install.packages( "lmtest" )
library(sandwich)
library(lmtest)
# Adjust standard errors
cov1 <- vcovHC( m.01, type="HC1" )
robust1 <- sqrt( diag( cov1 ) )
cov2 <- vcovHC( m.02, type="HC1" )
robust2 <- sqrt( diag( cov2 ) )
# add to stargazer
stargazer( m.01, m.02, type = "html" ,
se = list( robust1, robust2 ) )
Dependent variable: | ||
y | ||
(1) | (2) | |
x1 | 2.947*** | |
(0.969) | ||
x2 | 2.352** | |
(1.125) | ||
Constant | -0.694 | -0.567 |
(1.091) | (1.107) | |
Observations | 100 | 100 |
R2 | 0.070 | 0.047 |
Adjusted R2 | 0.060 | 0.038 |
Residual Std. Error (df = 98) | 10.975 | 11.104 |
F Statistic (df = 1; 98) | 7.321*** | 4.886** |
Note: | p<0.1; p<0.05; p<0.01 |
Load some fake data:
x <-
c(46.59, 86.78, 45.32, 43.84, 46.21, 65.81, 32.87, 66.48, 70.33,
60.67, 46.95, 47.73, 66.35, 43.47, 52.3, 68.96, 29.99, 52.02,
41.06, 49.2, 25.25, 83.67, 70.03, 40.11, 58.56, 36.95, 75.59,
65.7, 61.71, 31.88, 34.55, 59.54, 65.05, 51.58, 39.99, 74.07,
34.52, 71.39, 62.21, 59.58, 50.44, 55.16, 57.27, 39.26, 45.2,
79.51, 52.55, 60.19, 54.65, 40.35, 34, 38.52, 42.43, 53.18, 63.25,
47.66, 65.05, 56.93, 45.52, 52.52, 50.12, 90.88, 49.37, 75.18,
42.12, 73.65, 37.05, 67.82, 83.61, 42.52, 75.39, 30, 68.18, 28.47,
70, 65.92, 44.28, 68.76, 26.2, 41.43, 52.42, 41.78, 28.81, 49.69,
72.89, 60.7, 42.96, 50.37, 41.42, 45.75, 51.91, 73.37, 39.56,
40.46, 61.07, 17.06, 77.2, 53.92, 46.6, 56.79, 56.14, 19.29,
50.72, 46.81, 63.36, 51.67, 46.21, 39.67, 49.37, 33.76, 44.53,
39.16, 66.31, 50.19, 52.85, 31.35, 65.67, 51.21, 51.17, 68.92,
65.74, 45.14, 47.64, 50.57, 58.8, 44.07, 67.51, 35.62, 51.4,
41.7, 36.29, 61.57, 39.96, 66.7, 68.16, 59.72, 39.74, 61.38,
63.07, 46.73, 7.25, 70.38, 24.06, 47.06, 65.43, 43.34, 98.56,
39.76, 44.27, 62.66, 58.9, 53.56, 58.09, 50.46, 55.13, 63.2,
31.77, 63.5, 25.31, 76.19, 67.15, 77.16, 69.08, 42.72, 56.07,
54.69, 59.37, 43.75, 35.89, 47.94, 60.64, 55.77, 30.65, 58.8,
25.82, 41.76, 59.03, 52.64, 56.2, 44.02, 46.65, 93.41, 55.49,
77.04, 47.83, 38.24, 38.33, 46.15, 36.63, 34.68, 59.35, 61.9,
60.84, 58.63, 43.13, 39.33, 62.84, 34.3, 32.98, 54.86, 55.17,
71.94, 85.42, 67.71, 56.8, 87.22, 37.43, 58.75, 55.4, 53.96,
39.3, 54.59, 49.27, 72.27, 45.87, 57.76, 52.03, 30.27, 50.09,
46.78, 50.87, 36.76, 83.08, 24.62, 57.31, 44.42, 65.81, 61.69,
47.37, 50.2, 34.16, 39.32, 23.41, 28.34, 64.48, 58.33, 26.2,
32.26, 42.33, 72.26, 53.96, 53.02, 27.95, 39.57, 49.78, 47.67,
52.88, 60.14, 43.2, 53.6, 49.51, 61.87, 57.19, 34.14, 45.85,
30.48, 25.17, 95.49, 30.49, 67.65, 20.31, 53.2, 59.59, 23.3,
69.17, 56.53, 83.15, 82.37, 37.52, 72.91, 53.38, 27.89, 42.35,
60.64, 40.15, 46.8, 55.89, 65.34, 26.79, 53.42, 29.32, 59.56,
3.58, 26.05, 74.53, 64.33, 56.16, 53.05, 43.58, 65.3, 67.23,
51.51, 67.18, 46.52, 67.23, 52.69, 86.47, 26.92, 37.1, 71.38,
58.89, 56.78, 45.5, 26.76, 0, 82.8, 40.22, 69.83, 45.74, 48.52,
35.19, 54.92, 66.41, 61.22, 66.74, 47.16, 54.76, 50.84, 41.96,
59.16, 35.58, 38.05, 67.93, 30.08, 39.57, 41.86, 33.65, 56.86,
73.62, 52.85, 47.11, 47.02, 51.98, 90.47, 75.57, 32.55, 64.02,
60.36, 38.68, 48.95, 78.61, 17.67, 56.11, 52.56, 80.47, 46.53,
48.87, 39.82, 54.52, 43.98, 49.61, 61.64, 35.1, 42.77, 48.54,
67.27, 30.81, 51.43, 52.2, 19.42, 6.83, 62.42, 49.41, 76.39,
51.36, 57.38, 47.63, 61.48, 38.27, 53.98, 66.16, 61.58, 27.03,
54.6, 35.93, 82.12, 66.03, 72.39, 58.67, 70.66, 29.54, 52.64,
36.29, 64.7, 71.15, 22.71, 70.2, 59.65, 70.6, 59.81, 38.81, 26.21,
43.8, 10.36, 38.88, 33.27, 77.2, 43.78, 61.19, 47.86, 36.31,
86.2, 79.23, 55.38, 65.23, 41.6, 22.9, 26.78, 50.09, 52.16, 26.36,
35.93, 51.45, 36.25, 91.05, 43.9, 70.46, 53.45, 54.79, 58.6,
50.17, 22.2, 49.39, 60.11, 50.86, 46.83, 7.47, 56.35, 26.67,
46.84, 66.39, 34.29, 49.96, 67.96, 45.21, 57.54, 39.37, 31.3,
72, 80.81, 84.69, 43.15, 71.02, 30.27, 40.58, 55.57, 51.85, 66.1,
60.79, 50.84, 50.23, 61.4, 46.26, 29.91, 60.64, 55.38, 73.27,
50.31, 46.89, 66.88, 51.5, 53.64, 63.39, 48.53, 53.62, 58.05,
46.07, 43.33, 67.29, 70.44, 20.95, 82.71, 46.65, 74.47, 53.57,
45.96, 41.27, 59.5, 76.77, 39.18, 70.77, 18.45, 51.57, 67.43,
53.43, 65.73, 55.41, 52.69, 48.88, 83.06, 57.47, 58.09, 67.39,
58.2, 76.8, 67.06, 58.24, 71.32, 68.09, 38.98, 55.85, 40.83,
13.59, 79, 49.27, 63.48, 53.77, 60.99, 59.19, 45.16, 23.05, 24.1,
33.74, 50.45, 33.57, 57.68, 72.07, 54.91, 41.82, 62.99, 49.68,
31.79, 53.46, 42.46, 30.14, 34.67, 50.81, 82.53, 30.64, 42.87,
39.9, 30.56, 59.37, 55.56, 59.39, 39.38, 41.12, 46.27, 22.35,
52.44, 76.11, 34.51, 45.43, 46.98, 38.25, 39.22, 48.2, 65.32,
34.58, 64.51, 18.57, 76.92, 34.79, 53.16, 46.2, 72.39, 16.22,
54.58, 44.95, 36.19, 64.65, 70.24, 65.91, 49.33, 100, 17.87,
78.74, 46.5, 71.25, 16.18, 45.79, 32.05, 46.54, 69.03, 53.15,
95.06, 78.88, 43.45, 78.92, 17.19, 50.62, 43.02, 73.6, 72.1,
55.48, 51.42, 39.79, 34.54, 39.32, 41, 51.89, 53.65, 54.02, 48.34,
76.93, 36.35, 70.11, 50.8, 55.88, 34.91, 41.54, 66.54, 66.01,
25.42, 61.85, 53.09, 48.4, 40.87, 40.05, 49.92, 54.27, 20.87,
32.74, 57.32, 27.76, 65.55, 27.79, 47.98, 48.8, 52.51, 66.62,
71.85, 42.78, 55.53, 35.76, 66.94, 27.76, 43.38, 58.9, 46.79,
67.39, 35.1, 52.86, 72.29, 80.1, 63.5, 43.01, 48.42, 42.93, 78.74,
70.01, 10.08, 84.72, 72.07, 45.04, 45.09, 53.65, 33.58, 54.33,
60.01, 88.56, 71.52, 57.4, 50.3, 34.42, 72.12, 63.99, 50.16,
67.91, 32.11, 68.76, 28.86, 48.72, 31.77, 37.84, 74.53, 73.01,
12.99, 58.78, 32.46, 90.56, 26.74, 50.61, 41.64, 53.02, 62.84,
51.09, 65.92, 23.59, 58.59, 24.22, 44.45, 49.74, 66.69, 36.98,
53.63, 43.77, 67.64, 45.65, 59.71, 33.17, 81.85, 56.05, 58.13,
49.16, 68.47, 67.26, 67.92, 33.15, 76.85, 69.63, 54.41, 43.63,
61.44, 51.03, 42.72, 42.96, 11.27, 40.21, 26.23, 44.17, 58.24,
56.2, 67.82, 21.25, 32.14, 73.85, 43.48, 65.87, 63.82, 43.03,
45.27, 49.63, 38.74, 34.66, 72.93, 45.94, 37.74, 43.57, 56.73,
35.83, 69.79, 64.69, 49.72, 55.93, 59.08, 32.97, 40.8, 47.91,
31.23, 38.05, 14.63, 62.48, 66.41, 58.11, 74.11, 68.45, 39.95,
70.36, 50.13, 78.43, 93.53, 41.47, 67.65, 10.79, 49.32, 40.17,
69.8, 57.8, 46.25, 50.02, 61.49, 55.33, 53.25, 46.34, 47.34,
59.3, 37.17, 34.9, 50.17, 33.89, 54.34, 28.24, 46.06, 13.57,
65.84, 58.16, 17.04, 71.31, 62.06, 54.66, 33.04, 60.73, 57.31,
52.64, 17.01, 63.61, 47.86, 46.92, 58.15, 60.82, 43.54, 52.2,
30.97, 83, 38.84, 52.4, 65, 68.42, 57.14, 43.11, 49.01, 47.41,
37.03, 34.19, 65.04, 51.21, 51.24, 48.47, 42.18, 70.53, 49.28,
48.76, 68.59, 57.94, 36.33, 23.17, 61.03, 65.89, 44.34, 65.3,
70.95, 58.02, 77.53, 26.52, 43.44, 40.17, 54.94, 70.28, 47.47,
62.76, 51.01, 64.28, 43.22, 97.09, 43.17, 94.9, 69.11, 69.03,
76.24, 45.37, 62.78, 53.08, 20.19, 40.51, 65.5, 78.57, 37.38,
41.3, 62.39, 42.98, 66.75, 12.68, 75.03, 64.64, 54.92, 52.46,
34.14, 42.77, 21.84, 52.6, 46.26, 44.16, 74.93, 32.57, 60.42,
34.39, 63.61, 54.7, 60.31, 33.65, 42.97, 60.45, 32.99, 59.36,
71.69, 29.31, 66.35, 63.79, 47.75, 48.45, 38.57, 75.52, 20.06,
45.72, 51.88, 64.33, 82.36, 81.54, 43.05, 56.55, 37.79, 51.85,
35.45, 38.96, 63.71, 43.54, 53.77, 58.93, 66.12, 81.99, 48.6,
66.51, 44.99, 29.98, 72.54, 18.65, 76.13, 66.46, 55.77, 65.34,
31.7, 33.84, 82.54, 48.45, 57.26, 49.9, 35.66, 31.75, 73.11,
59.83, 43.91, 53.12, 64.39, 64.73, 58.63, 41.66, 33.09, 58.08,
29.92, 55.21, 45.22, 41.17, 67.57, 73.68, 43.77, 49.23, 46.62,
41.92, 49.95, 46.88, 68.31, 67.1, 60.99, 52.08, 42.65, 33.76,
36.32, 20.72, 72.53, 30.22, 61.42, 54.38, 82.5, 43.32, 82.3,
79.13, 71.48, 50.17, 66.64, 70.75, 57.04, 63.79, 35.4, 26.29,
66.53, 36.76, 49.02, 58.08, 62.02, 32.44, 61.13, 41.19, 64.6,
33.81, 55.69, 55.01, 24.18, 15.66, 48.19, 46.56, 36.22, 33.67,
47.65, 21.15, 42.68, 49.56, 55.57, 41.45, 38.88, 74.98, 30.51,
37.75, 64.2, 50.62, 46.44, 68.58, 61.24, 59.64, 50.33)
y <-
c(1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0,
0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0,
1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1,
0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0,
1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0,
1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1,
1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1,
1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1,
1, 0, 1, 1, 0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1, 1, 1, 0, 1, 0,
0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1,
0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1,
1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1,
1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0,
1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1)
Basic plot:
# create bins
min.x <- min(x)
max.x <- max(x)
bins <- seq( from=min.x, to=max.x, length.out=50 )
# preview bins
plot( x, y, pch=19, col=gray(0.5,0.2), cex=1.5, bty="n" )
abline( v=bins, col="steelblue", lty=3 )
Average X and Y values within each bin:
groups <- cut( x, breaks=bins )
group.x <- tapply( x, groups, mean )
ave.y <- tapply( y, groups, mean )
# fix couple of empty bins in lower tail
ave.y[ is.na( ave.y ) ] <- 0
plot( x, y, pch=19, col=gray(0.5,0.3), bty="n" )
points( group.x, ave.y, pch=19, col="steelblue", cex=1.2, type="b" )
# add a smoothed prob estimate
# averages 3 points together to smooth out noise:
smooth.y <- smooth( ave.y )
plot( x, y, pch=19, col=gray(0.5,0.1), bty="n", cex=1.5,
ylab="Prob( Y=1 for bin of X )", xlab="Independent Variable" )
abline( h=seq(0,1,0.1), lty=3, col=gray(0.5,0.5) )
abline( v=seq(0,100,5), lty=3, col=gray(0.5,0.5) )
points( group.x, ave.y, pch=19, col=adjustcolor( "steelblue", alpha=0.5), cex=1.5 )
points( group.x, smooth.y, pch=19, col="firebrick", cex=1.2, type="b" )
# show model fit of linear prob and logit
m1 <- lm( y ~ x )
m2 <- glm( y ~ x, family="binomial" )
plot.order <- order(x)
plot( x, y, pch=19, col=gray(0.5,0.1), bty="n", cex=1.5,
ylab="Prob( Y=1 for bin of X )", xlab="Independent Variable" )
abline( h=seq(0,1,0.1), lty=3, col=gray(0.5,0.5) )
abline( v=seq(0,100,5), lty=3, col=gray(0.5,0.5) )
points( group.x, ave.y, pch=19, col=adjustcolor( "steelblue", alpha=0.5), cex=1.5 )
lines( x, m1$fitted.values, col="firebrick", lwd=1.5 )
lines( x[ plot.order ], m2$fitted.values[ plot.order ], col="firebrick", lwd=1.5 )
First, let’s run a linear probability model.
Alternatively we can use a logit model.
Interpretation of the coefficient in a logit model can be tricky.
Another way to interpret the coefficients is using marginal effect
Q4a: Which variable has the highest marginal effect between Media and Evangelics? (5 points)
Q4b Does an increase in Evangelic population have a greater effect in a state where the current % is equal to 20% or 40%? (5 points)
Q4c: Imagine to work for an advocacy group that is trying to promote the adoption of mandatory HPV vaccine legislation across states. Part of your effort is to decrease negative media coverage. Would you rather invest in a state where the media coverage is equal to 200 or in a state where the media coverage is equal to 400? (10 points)