HWK10

.docx

School

University of Wisconsin, Madison *

*We aren’t endorsed by this school

Course

371

Subject

Statistics

Date

May 5, 2024

Type

docx

Pages

14

Uploaded by AmbassadorRaven4190 on coursehero.com

Stat 371 Homework #10 Rachel Marten Submit your homework to Canvas by the due date and time. Email your instructor if you have extenuating circumstances and need to request an extension. If an exercise asks you to use R, include a copy of the code and output. Please edit your code and output to be only the relevant portions. If a problem does not specify how to compute the answer, you many use any appropriate method. I may ask you to use R or use manually calculations on your exams, so practice accordingly. You must include an explanation and/or intermediate calculations for an exercise to be complete. Be sure to submit the HWK 10 Auto grade Quiz which will give you ~20 of your 40 accuracy points. 50 points total: 40 points accuracy, and 10 points completion Analysis of Variance Exercise 1. A study was conducted to explore the effects of ethanol on sleep time. Fifteen rats were randomized to one of three treatments. Treatment 1 got only water (control). Treatment 2 got 1g of ethanol per kg of body weight, and treatment 3 got 2g/kg. The amount of REM sleep in a 24hr period was recorded, in minutes. Data are given below. The researchers plan to perform a test to help decide between a model that says a mean amount of REM sleep for all three treatment is equal H 0 : μ 1 = μ 2 = μ 3 and a model that allows for at least one group mean to be different H A : at least one μ i is different. a. Make a preliminary boxplot of the data that enables you to compare the centers and spreads of the three samples. Does this graph suggest the three samples come from populations with the same mean value ( H 0 is true)? What about the graph makes you say that? Also comment on the equal variance assumption for the three groups. They don’t have the same mean balue since the mean values are vastly different. As you look from left to right on the boxplot, the mean seems to decrease. The equal variance’s seem to be around the same based on visuals. # Q1 data trt1 <- c ( 63 , 56 , 69 , 59 , 67 ) trt2 <- c ( 45 , 60 , 52 , 56 ) trt3 <- c ( 31 , 40 , 44 , 33 , 37 , 28 ) Q1vals <- c (trt1, trt2, trt3) Q1trt <- c ( rep ( "trt1" , times = 5 ), rep ( "trt2" , times = 4 ),
rep ( "trt3" , times = 6 )) boxplot (trt1, trt2, trt3, main = "Ethanol on Sleep Time" , xlab = "Treatment" , ylab = "Minutes" , names = c ( "trt1" , "trt2" , "trt3" ) ) b. Complete the following table of summary statistics that will be useful in an ANOVA analysis. Keep values to at least 3 decimal places. Treatment 1 Treatment 2 Treatment 3 Overall mean 62.8 53.25 35.5 ?? sd 5.404 6.397 ?? 13.452 n 5 ?? 6 ?? sd (trt3) ## [1] 5.958188 treatment = c ( 63 , 56 , 69 , 59 , 67 , 45 , 60 , 52 , 56 , 31 , 40 , 44 , 33 , 37 , 28 ) mean (treatment) ## [1] 49.33333
# Group means, SDs, and sample sizes ybar1 <- mean (trt1); s1 <- sd (trt1); n1 <- length (trt1) ybar2 <- mean (trt2); s2 <- sd (trt2); n2 <- length (trt2) ybar3 <- mean (trt3); s3 <- sd (trt3); n3 <- length (trt3) # Overall mean, SD, and sample size ybar <- mean (Q1vals); s <- sd (Q1vals); N <- length (Q1vals) # Answers for table: ybar; s3; n2; N ## [1] 49.33333 ## [1] 5.958188 ## [1] 4 ## [1] 15 pf ( 30.445 , 2 , 12 , lower.tail= FALSE ) ## [1] 1.991039e-05 treatment = c ( 63 , 56 , 69 , 59 , 67 , 45 , 60 , 52 , 56 , 31 , 40 , 44 , 33 , 37 , 28 ) time = c ( rep ( "trt1" , 5 ), rep ( "trt2" , 4 ), rep ( "trt3" , 6 )) time_mod = aov (treatment ~ time) summary (time_mod) ## Df Sum Sq Mean Sq F value Pr(>F) ## time 2 2116 1058.1 30.45 1.99e-05 *** ## Residuals 12 417 34.8 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 c. Fill in the blanks for the ANOVA table below (by hand), then check your work with the aov function in R. The aov function will round the SS terms to the nearest integer, but keep MS and F as decimals, so you may want to do the same. Source DF SS MS F p-value Treatment 2 21 16 1058.1 30.45 1.991039e- 05 Error 12 41 7 34.8 Total 14 25 33
d. Use the plot() function on your ANOVA aov object to obtain a residual plot and qqnorm() plot of the residuals. Use the graphs and the summary values above to explain why the assumptions for an ANOVA analysis are well met for this data. plot (time_mod)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help