420Hw02ans - STAT 420 Homework #2 (due Friday, February 1,...

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

View Full Document Right Arrow Icon
STAT 420 Homework #2 Spring 2008 (due Friday, February 1, by 4:00 p.m.) 1. We would like to test the effect of drugs 1 and 2 on a physiological measure X. Consider the model: X 1 1 , X 1 2 , … , X 1 n are i.i.d. N ( μ 1 , σ 2 ) X 2 1 , X 2 2 , … , X 2 n are i.i.d. N ( μ 2 , σ 2 ) Assume that μ 1 = 6, μ 2 = 5, σ 2 = 4, n = 25. Let 1 X = = n i i n 1 1 X 1 , 2 X = = n i i n 1 2 X 1 , D = 1 X – 2 X . a) Find P ( 0 < D < 2 ). D = 1 X – 2 X ~ N ( μ 1 μ 2 , n n 2 2 + ) = N ( 6 – 5 , 25 4 25 4 + ) D ~ N ( 1 , 0.32 ) 32 . 0 1 D - = Z ~ N ( 0 , 1 ) P ( 0 < D < 2 ) P ( – 1.77 < Z < 1.77 ) = 0.9232 . b) Empirical distribution of D: Generate S = 1000 datasets for each of group 1 and group 2. For each of the s = 1 : 1000 datasets, compute d s = s x 1 s x 2 . Plot the histogram for the 1000 values of d . What is the proportion of values of d ( among the 1000 values of d generated ) that are between 0 and 2? > N = 25 > mu1 = 6 > mu2 = 5 > std = 2 > > S=1000 > num = 0 > diffall = c(1:S)
Background image of page 1

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

View Full DocumentRight Arrow Icon
> for (i in 1:S){ + data1 = rnorm(N, mu1, std) + data2 = rnorm(N, mu2, std) + diffall[i] = mean(data1) - mean(data2) + if ((diffall[i] > 0) && (diffall[i] < 2)){ + num = num + 1}} > > num/S [1] 0.925 > > hist(diffall) You will get different values every time you generate datasets.
Background image of page 2
2. The upper management at Initech wants to examine the relationship between the number of years on the job ( x ) and the number of TPS reports produced ( y ) for the middle-management employees. The data are as follows: x 1 2 3 3 4 5 Y 7 4 13 10 10 16 Consider the model Y i = β 0 + β 1 x i + ε i , where ε i ’s are i.i.d. N ( 0, σ 2 ). Use a computer to find the equation of the least-squares regression line. Give an estimate for σ , the standard deviation of the observations about the true regression line? Create a scatterplot and add the least-squares regression line to it. > x = c(1,2,3,3,4,5) > y = c(7,4,13,10,10,16) > > fit = glm(y ~ x) > summary(fit) Call: glm(formula = y ~ x) Deviance Residuals: 1 2 3 4 5 6 1.8 -3.6 3.0 0.0 -2.4 1.2 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.800 2.939 0.953 0.395 x 2.400 0.900 2.667 0.056 . ---
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

420Hw02ans - STAT 420 Homework #2 (due Friday, February 1,...

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

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