Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Stat 311 Homework 5 4. Recall the zone out duration (ZOD) data we looked at in one of the regression lectures from Lesson 3.
Stat 311 Homework 5 4. Recall the zone out duration (ZOD) data we looked at in one of the regression lectures from Lesson 3. An additional experiment was conducted to look at the impact of sugary desserts eaten at lunch, two hours before class, and ZOD. Twelve students volunteered to participate in the experiment. Students were randomly assigned to eat a large slice of apple or cherry pie, with six participants randomized in each group. Two hours later, their ZODs (in minutes) were recorded during a 50-minute lecture. The data are in the file ZODTwoGroups.csv. a) In the HW5 template, we provide code to produce a comparative boxplot for ZOD by pie type. Describe what you can get from the boxplots regarding the distributions of ZOD for apple and cherry pie. Does there appear to be a difference between the ZODs for the two groups? b) In the HW5 template, we provide code to create 1000 permutations for the difference of mean ZOD for cherry pie minus the mean ZOD for apple pie. Note, we use set. seed (10) so that all students will get the same permutations. What is the observed sample difference in means for the sample data? c) Write out the statistical hypotheses, using symbols, for testing that mean ZOD for cherry pie is greater than the mean ZOD for apple pie. d) In the HW5 template, we use ggplot to produce a histogram of the null distribution with an added vertical line for the observed sample difference. Describe the shape of the null distribution and how the observed sample difference compares with the overall distribution. e) In the HW5 template, we provide code to calculate the p-value for this permutation test. What is the meaning of this p-value as a probability? f) What do you conclude for this hypothesis test in the context of the problem? 106 107 #### Part 4a) 108- 109 110 111 112 4 {r comparative boxplot} ggplot (ZOD, aes(x=Pie, y=ZOD)) + geom_boxplot() + xlab("Pie") + ylab ("Zone Out Duration (minutes)") Zone Out Duration (minutes) 0- 6- Apple Pie Cherry K ^ X 115 #### Part 4b) {r create permutations} PermsOut % # added call to rep_sample_n rep_sample_n(size 116 117 118 set.seed(10) 119 120 121 122 123 124 125 126 127 PermsOut 128- mutate (ZOD_perm = = nrow(ZOD), reps = 1000, replace = FALSE) %>% sample (ZOD) %>% # added replicate to group_by group_by(replicate, Pie) %>% summarize(mean_ZOD_perm summarize(diff_perm = = mean (ZOD_perm), mean_ZOD = mean (ZOD)) %>% diff(mean_ZOD_perm), diff_orig = diff(mean_ZOD)) # Cherry Apple summarise) has grouped output by 'replicate'. You A 1,000 x can override using the groups argument. R Console A tibble: 1,000 3 tbl_df 1000 x 3 n K ^ replicate diff_perm diff_orig 1 -0.1666667 3.666667 2 2.3333333 3.666667 3 0.1666667 3.666667 4 3.3333333 3.666667 5678 -1.6666667 3.666667 -1.6666667 3.666667 -1.5000000 3.666667 -1.8333333 3.666667 9 -1.0000000 3.666667 10 -1.0000000 3.666667 1-10 of 1,000 rows Previous 1 2 3 4 5 6 100 Next 0- 134 135 #### Part 4d) 136- 137 138 139 140 {r Histogram of Null Distribution} origdiff 4 145 #### Part 4e) 146- {r p-value} 147 PermsOut %>% 148 149 150 summarize(count = proportion 151 A tibble: 1 x 2 1 row sum(diff_orig
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started