stat209_09hw1.sol

stat209_09hw1.sol - Page 1 of 6 Stat209 D Rogosa Solutions...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Stat209/ D Rogosa 1/18/09 Solutions Assignment 1. Assignment 1. Review regression, properties of regression coefficients 1. Yule's Data via Freedman (deep review regression) The purpose here is just to get started reading in data and doing standard regression fits. Also to remind us that Yule(1989) was doing much the same sort of analysis as is done more than 100 years later. File yuledoc.dat contains the data in Table 3, p.10 of Freedman http://www-stat.stanford.edu/~rag/stat209/yuledoc.dat Note that I commmented out the two leading lines of text in that data file with leading "#" so that teh file would read without modification. But it is always good to look at the data file before attempting statistical analysis. a. replicate Yule's regression equation for the metropolitan unions, 1871--81. See chapter 1. (Subtract 100 from each entry to get the percent changes.) I scanned and posted p10-11 of Freedman's text for reference on the variables and fit http://www-stat.stanford.edu/~rag/stat209/DAFp10.pdf The results, shown below, are similar to those reported p.11 but don't match perfectly > yule = read.table("http://www-stat.stanford.edu/~rag/stat209/yuledoc.dat", header = T) > yule paup outrelief old pop 1 27 5 104 136 2 47 12 115 111 3 31 21 85 174 4 64 21 81 124 5 46 18 113 96 6 52 27 105 91 7 81 36 100 97 8 61 39 103 141 9 61 35 101 107 10 59 35 101 132 11 33 22 91 150 12 76 30 103 85 13 64 27 97 81 14 79 33 95 93 15 79 64 113 68 16 52 21 108 100 17 46 19 102 106 18 35 6 93 93 19 37 6 98 98 20 34 10 87 101 21 43 15 102 113 22 37 20 102 135 23 52 22 100 111 24 57 32 102 110 25 57 38 99 122 26 23 18 91 168 27 30 14 83 168 28 55 37 94 131 29 41 24 100 142 30 76 20 119 110 31 38 29 101 142 32 38 49 86 203 > cor(yule) # a quick overview of association, outrelief is the policy variable paup outrelief old pop paup 1.0000000 0.59403244 0.3952942 -0.59343318 outrelief 0.5940324 1.00000000 0.1088055 -0.01223797 old 0.3952942 0.10880553 1.0000000 -0.52813161 pop -0.5934332 -0.01223797 -0.5281316 1.00000000 > pairs(yule) # gives you the scatterplot array > attach(yule) > # to go to percentage change over time > # transform variables > paupPercent = paup - 100 > outreliefPercent = outrelief - 100 > oldPercent = old - 100 > popPercent = pop - 100 > lm.yule = lm( paupPercent ~ outreliefPercent + oldPercent + popPercent ) > summary(lm.yule) Call: lm(formula = paupPercent ~ outreliefPercent + oldPercent + popPercent) Page 1 of 6 06/12/2010 http://www-stat.stanford.edu/~rag/stat209/09hw1.sol
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Residuals: Min 1Q Median 3Q Max -17.475 -5.311 -1.829 3.132 25.335 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 12.88356 10.36722 1.243 0.224 outreliefPercent 0.75209 0.13499 5.572 5.83e-06 *** oldPercent 0.05560 0.22336 0.249 0.805 popPercent -0.31074 0.06685 -4.648 7.25e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 9.547 on 28 degrees of freedom Multiple R-Squared: 0.6972, Adjusted R-squared: 0.6647
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 08/20/2011 for the course STATS 209 taught by Professor Rogosa,d during the Winter '09 term at Stanford.

Page1 / 6

stat209_09hw1.sol - Page 1 of 6 Stat209 D Rogosa Solutions...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online