hw4.sol

# hw4.sol - Page 1 of 6 Stat209/Ed260 D Rogosa Solutions...

This preview shows pages 1–2. Sign up to view the full content.

Stat209/Ed260 D Rogosa 1/31/09 Solutions Assignment 4. Multilevel data, ecological fallacy Problem 1 Following p.750 Greenland and Robins American Journal of Epidemiology Vol. 139, No. 8: 747-760 Reading through their exposition probably is helpful here's my attempt (it can be done more elegantly) #make the region indices > r = c(0:40) > r [1] 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [26] 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 #now radon concentrations > regradon = .1 + .3*sqrt(r) > regradon [1] 0.1000000 0.4000000 0.5242641 0.6196152 0.7000000 0.7708204 0.8348469 [8] 0.8937254 0.9485281 1.0000000 1.0486833 1.0949874 1.1392305 1.1816654 [15] 1.2224972 1.2618950 1.3000000 1.3369317 1.3727922 1.4076697 1.4416408 [22] 1.4747727 1.5071247 1.5387495 1.5696938 1.6000000 1.6297059 1.6588457 [29] 1.6874508 1.7155494 1.7431677 1.7703293 1.7970563 1.8233688 1.8492856 [36] 1.8748239 1.9000000 1.9248288 1.9493242 1.9734994 1.9973666 > # set up smoking variable (counterbalanced with radon) > u = rnorm(41) > var(u) [1] 0.9883518 > mean(u) [1] 0.1323434 > #that's a good enough u > s = .2*(34 + .4*r -u) + .4*(13 - .2*r -.5*u) > s [1] 11.65626 12.02922 11.45928 11.86984 11.96606 12.05849 11.54374 11.99844 [9] 11.42576 12.42389 11.88704 12.42439 11.93378 12.39780 11.55852 11.78481 [17] 11.69073 11.74597 12.69344 12.01483 11.84285 10.74535 11.70950 12.54065 [25] 12.25184 12.75854 12.22308 12.12930 11.85289 12.27538 11.76754 11.37832 [33] 12.27040 12.22711 11.75117 11.99551 12.49188 12.12246 11.60682 11.72744 [41] 11.59924 #smoking proportions > p0 = 53 - .2*r + 1.5*u > p1 = 34 + .4*r - u > p2 = 13 - .2*r - .5*u #eq2 p.751 > lungc = .40*(1 + .2*regradon)*exp(s/10)*(p0 + 2.7183*2.7183*p1 + exp(4)*p2) #resulting data > cor(lungc, s) [1] 0.8518681 > cor(lungc, regradon) [1] -0.2588493 > cor(s, regradon) [1] 0.1254401 > plot( regradon, lungc) #my plot is at http://www-stat.stanford.edu/~rag/stat209/hw4p1.pdf #run the regression > luncreg = lm(lungc ~ regradon + s) > summary(luncreg) Call: lm(formula = lungc ~ regradon + s) Residuals: Min 1Q Median 3Q Max -165.490 -28.550 9.463 38.072 77.763 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2012.52 239.73 -8.395 3.48e-10 *** regradon -102.60 16.80 -6.107 4.06e-07 *** s 298.39 20.21 14.768 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 50.42 on 38 degrees of freedom Multiple R-Squared: 0.8616, Adjusted R-squared: 0.8543 F-statistic: 118.2 on 2 and 38 DF, p-value: < 2.2e-16 even with confounder (smoking) "controlled for" [laughter supressed] radon concentration negatively associated with lung cancer in this regional-level regression. Causal conclusion--start pumping radioctive gas into everyone's basements?

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

hw4.sol - Page 1 of 6 Stat209/Ed260 D Rogosa Solutions...

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

View Full Document
Ask a homework question - tutors are online