This preview shows page 1. Sign up to view the full content.
Unformatted text preview: ers. Hint:
Both numbers come out of summary(lm1) (if your lm object is called lm1).
Here is my version:
## The R-squared
with(nes08.df, var(fitted(lm1))/var(relig.money, na.rm = TRUE))
 0.00187 Class 12 — Political Science 230
An Interlude about Data and Final Reports— October 8, 2013— 3 ## The typical variation in residuals: standard deviation of the residuals
## or: square root of sum of squared residuals/valid sample size minus 1
sqrt(sum(residuals(lm1)^2)/(length(residuals(lm1)) - 1))
## A slightly different measure of fit: residual standard error differs from sd in that it adjusts for number of coefficients
sqrt(sum(residuals(lm1)^2)/(length(residuals(lm1)) - length(coef (lm1))))
 0.436 My model does not ﬁt very well: only about .2 % of the variation in the outcome is captured by the ﬁtted model and the typical
residual is about .4 — which is a lot when the outcome is 0 or 1 [i.e. it would not be surprising to ﬁnd a residual as big as .4 from
the ﬁtted line — if the line were exactly ﬂat and showing no relationship and in the middle of the points at .5, we would expect
residuals to be .5]
8. Congratulations! You’ve just done about half of what will be required for the ﬁnal paper for this class.
The other half will involve, roughly speaking, (1) ﬁnding a dataset with variables that appeals to you rather than using one that I
chose; (2) actually writing some paragraphs to explain your expectations, model, analysis, results, and conclusions; (3) using R
to illustrate the expectations part rather than drawing it by hand; (4) choosing a third variable to estimate the partial relationship
between your explanatory and outcome variables (to clarify the eﬀect of your explanatory on the outcome); (5) interpreting the regression coeﬃcients as telling us something about partial relationships; and (6) discussing relevant hypothesis tests and conﬁdence
intervals related to your expectations. Class 12 — Political Science 230
An Interlude about Data and Final Reports— October 8, 2013— 4...
View Full Document
This note was uploaded on 02/07/2014 for the course PS 230 taught by Professor Staff during the Fall '08 term at University of Illinois, Urbana Champaign.
- Fall '08
- Political Science