# 420Hw03ans - STAT 420(10 points(due Friday September 19 by...

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

STAT 420 Fall 2008 Homework #3 (10 points) (due Friday, September 19, by 3:00 p.m.) 1. Use Packages > Install Package(s)… to download and install package (library) faraway . Use the infmort data set where Y is income and the grouping variable is region (Asia, Europe, Americas and Africa). > library(faraway) > data(infmort) > infmort[1:5,] # to see what the data set looks like region income mortality oil Australia Asia 3426 26.7 no oil exports Austria Europe 3350 23.7 no oil exports Belgium Europe 3346 17.0 no oil exports Canada Americas 4751 16.8 no oil exports Denmark Europe 5029 13.5 no oil exports > attach(infmort) After attach(infmort) , you may refer to the variables in the data set directly, i.e., income instead of infmort\$income . a) Draw a boxplot of income for each of the four regions on the same set of axes. > boxplot(income ~ region)

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

View Full Document
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 > > ## 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. Transformation: Consider the new response variable W = ln Y. i. Draw the boxplots of ln ( income ) for each of the four regions on the same set of axes. Note that the spread in the income is more or less stabilized across groups.

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 ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern