This preview shows page 1. Sign up to view the full content.
Unformatted text preview: =0
table(nes08.df$freemkt.vs.govt, nes08.df$V085106, useNA = "ifany") ## Check the recode
1
0
1514
1
0
<NA>
0 2 <NA>
0
0
543
0
0 265 table(nes08.df$relig.money, nes08.df$V085201e, useNA = "ifany")
1
0
0
1
1563
<NA>
0 ## Check the recode 5 <NA>
535
0
0
0
0 224 3. How do you expect your explanatory variable to relate to your outcome variable? Please sketch the scatterplot you expect to see
and draw a line on this scatterplot to represent your expected relationship. Hint 1: Recall that the outcome deﬁnes the vertical axis
and the explanatory the horizontal axis. Hint 2: The line does not have to be a straight line.
In my case, I am guessing that free market ideology should not have any systematic relationship with donating money to religious
groups:
Hypothetical Relationship between No par(mfrow=c(1,1),pty="s",mar=c(3,3,3,0))
plot(c(0,1),c(.5,.5),xlim=c(0,1),ylim=c(0,1),axes=FALSE,
xlab="Strong Gvt to Free Mkt",
ylab="Money to Relig Org (No to Yes)",
main="Hypothetical Relationship between \n
Religious Donations and Economic Ideology",
type="l",lwd=3)
axis(1,at=c(0,1),labels=c("Gvt","Mkt"))
axis(2,at=c(0,1),labels=c("No","Yes")) Money to Relig Org (No to Yes) Yes Religious Donations and Economic Ideology Gvt Mkt 4. What model design would allow you to assess your expectations? If you had to recode your variable, use the new name from now
on. Hint: Recall that a model design is a statement about a relationship, like y ∼ x for a simple linear relationship or y ∼ x + x 2 + x 3
for a more curvy relationship or y ∼ x ∗ I ( x > 20) for the situation where the relationship between y and x may change before
versus after x = 20 or, another version of the same idea, y ∼ x ∗ g where g is a variable representing a particular group or type Class 12 — Political Science 230
An Interlude about Data and Final Reports— October 8, 2013— 2 of row (indicating diﬀerent eﬀects of x on y for diﬀerent values of g), etc . . . . Since these are both binary variables (also called
dichotomous or ’twovalued’) only a linear relationship is sensible. My proposed model design is:
relig.money ∼ 1 + freemkt.vs.govt
5. Fit this model design to the data using lm(). What coeﬃcients do you get? Interpret the coeﬃcients. Hint 1: If you have a
nonlinear term (like x 2 ) in your formula, you’ll need to use the I() function. For example, I might write:
lm1<lm(y~x+I(x^2),data=mydata)
@ which would include a quadratic term. \emph{Hint 2:} Make sure to
save the results of your linear model fitting as I did here in
\Verb+lm1+ for use in the next question. \emph{Hint 3:} If you decide
on a nonlinear term like $x^2$, I recommend using the \Verb+predict()+
command rath...
View
Full
Document
 Fall '08
 Staff
 Political Science

Click to edit the document details