420Hw10ans - STAT 420 (10 points) (due Friday, April 18, by...

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

View Full Document Right Arrow Icon
STAT 420 Spring 2008 Homework #10 (10 points) (due Friday, April 18, by 4:00 p.m.) 1. One Way ANOVA. Exercise 14.4 . Use the infmort data set where Y is income and the grouping variable is region (Asia, Europe, Americas and Africa). a) Draw a boxplot of income for each of the four regions. > library(faraway) > data(infmort) > attach(infmort) > boxplot(income ~ region)
Background image of page 1

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

View Full DocumentRight Arrow Icon
b) Compute the sample mean and sample variance for each of the regions. > mean(income[region=="Africa"]) [1] 273.2353 > var(income[region=="Africa"]) [1] 264522.3 > > mean(income[region=="Americas"]) [1] 939.8696 > var(income[region=="Americas"]) [1] 1851366 > > mean(income[region=="Asia"]) [1] 638.8667 > var(income[region=="Asia"]) [1] 937319.4 > > mean(income[region=="Europe"]) [1] 3040.222 > var(income[region=="Europe"]) [1] 2071527 OR > ## Group 1 == Africa > Yaf = income[region=="Africa"] > Naf = length(Yaf) > Naf ; mean(Yaf) ; var(Yaf) [1] 34 [1] 273.2353 [1] 264522.3 > > ## Group 2 == Americas > Yam = income[region=="Americas"] > Nam = length(Yam) > Nam ; mean(Yam) ; var(Yam) [1] 23 [1] 939.8696 [1] 1851366 > > ## Group 3 == Asia > Yas = income[region=="Asia"] > Nas = length(Yas) > Nas ; mean(Yas) ; var(Yas) [1] 30 [1] 638.8667 [1] 937319.4
Background image of page 2
> ## Group 4 == Europe > Yeu = income[region=="Europe"] > Neu = length(Yeu) > Neu ; mean(Yeu) ; var(Yeu) [1] 18 [1] 3040.222 [1] 2071527 c) A visual inspection of the boxplots may lead us to conclude that the equal variance assumption may not be satisfied and that some transformation may be needed. Nevertheless, for the moment, let us fit the model Y i = μ 1 v 1 i + μ 2 v 2 i + μ 3 v 3 i + μ 4 v 4 i + ε i , where ε i ’s are iid N ( 0 , σ 2 ), and the indicator variables are v 1 i is 1 if the i -th country is in Asia and 0 otherwise, v 2 i is 1 if the i -th country is in Europe and 0 otherwise, v 3 i is 1 if the i -th country is in the Americas and 0 otherwise, v 4 i is 1 if the i -th country is in Africa and 0 otherwise. Suppose that you want to test the hypothesis that all population means are identical, i.e., H 0 : μ 1 = μ 2 = μ 3 = μ 4 . i. Specify the model under the null hypothesis H 0 . Y i = μ + ε i , where ε i ’s are iid N ( 0 , σ 2 ). I.e., Y i = μ 1 + ε i , where ε i ’s are iid N ( 0 , σ 2 ). ii. Conduct the F test at significance level α = 0.05. > summary(aov(glm(income ~ factor(region)))) Df Sum Sq Mean Sq F value Pr(>F) factor(region) 3 96878763 32292921 29.158 1.157e-13 *** Residuals 101 111857493 1107500 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Background image of page 3

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

View Full DocumentRight Arrow Icon
OR > Y = c(Yas, Yeu, Yam, Yaf) > Gas = c(rep(1,Nas), rep(0, Neu), rep(0, Nam), rep(0, Naf)) > Geu = c(rep(0,Nas), rep(1, Neu), rep(0, Nam), rep(0, Naf)) > Gam = c(rep(0,Nas), rep(0, Neu), rep(1, Nam), rep(0, Naf)) > Gaf = c(rep(0,Nas), rep(0, Neu), rep(0, Nam), rep(1, Naf)) > fit1 = lm(Y ~ Gas + Geu + Gam + Gaf - 1) > summary(fit1) Call:
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

420Hw10ans - STAT 420 (10 points) (due Friday, April 18, by...

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

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