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

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

View Full Document Right Arrow Icon
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)
Image of page 1

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

View Full Document Right 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 > > ## Group 4 == Europe > Yeu = income[region=="Europe"] > Neu = length(Yeu) > Neu ; mean(Yeu) ; var(Yeu) [1] 18 [1] 3040.222 [1] 2071527
Image of page 2
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.
Image of page 3

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern