Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Stat 311 Homework 5

Most questions in this assignment require R, so do this assignment in rmarkdown and upload as a pdf file to Gradescope. This assignment requires you to install the infer package. General reminders:

•   We must be able to see your R code and the output. If you save things to an object, you need to print the object to display the output.

•    All non-R writing goes outside the code chunks after the code chunk.

•   Proofread your assignment. Make sure all the headers and sub headers display correctly. Comment out or delete code for anything extra that is not part of the problem.

•   Double check your pagination before your final submission in Gradescope. If a problem occurs on more than one page, the problem must be assigned to all the pages on which it occurs.

1.   The midterm scores in a large introductory physics class are distributed N(u = 77, a = 9). Let X be the midterm score for a randomly selected student. Use R to find the probabilities and midterm scores.

a)  Find P(X ≤ 75).

b)  Find P(X > 92).

c)  Find P(85 ≤ X ≤ 95).

d)  What midterm score corresponds to the 98th percentile of exam scores?

e)   What midterm score separates the top 87% of students from the rest of the students?

f)    You take a random sample of 35 students from the class. What is the distribution of ?

g)  For the random sample of 35 students, find P( > 78).

2.   The pet food store sells 30 lb. bags of your dog’s favorite pet food. However, the 30 lb. bags do not weigh exactly 30 lbs.  If we let Xi  be the weight of a randomly selected 30 lb. bag of pet food, historical data indicate that Xi ~N(u = 30.8, a = 1.10). The local grocery store sells 10 lb. bags of the same dog food, which also do not weigh exactly 10 lbs. If Yi  is the weight of a randomly selected 10 lb. bag of dog food, historical data indicate that Yi ~N(u = 10.4, a = 0.25). If we randomly select three of the smaller 10 lb. bags of dog food and one 30 lb. bag of dog food, what is the probability that the sum of the weights of the three 10 lb. bags exceeds the weight of one 30 lb. bag? We are assuming that the weights of the10 lb. bags are independent. What do you think is best, buying three smaller bags or one larger bag (of course based only on weight as price could be a consideration). For this problem you can use R to get the probability, but you must show some work to convince us you know what you are doing to solve this problem.

3.   The random variable X has a continuous uniform distribution on the interval from 1 to 7, that represents the waiting time, in minutes, to place your order at the favorite neighborhood coffee shop. Use this information to answer the following. Show your work.

a)  What is the height of the probability density function for X? Show your work.

b)  What is the expected value ofX? Show your work. Explain in layperson terms what this means in the context of the problem.

c)   Calculate P(X ≤ 3). Work out by hand and confirm your answer using R.

d)  Calculate P(1 ≤ X ≤ 5). Work out by hand and confirm your answer using R.

e)   Calculate P(X = 7).

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?

5.   This problem uses the PopularDietsCombined.csv data set. We are focusing on the WtLossKG variable (weight loss after 12 weeks in kg) and Diet. Round all confidence intervals to two decimal places in your reporting.

a)  Make a comparative boxplot to look at differences in WtLossKG by Diet type. Summarize what you see for weight loss by diet type. [Hint:  copy the code from Problem 4a and modify it for this problem]

b)  Since there does not seem to be too much difference by diet type, we will only work WtLossKG. What is the point estimate for mean weight loss across all diets?

c)  In the HW5 template we provide code to create 1000 bootstrapped samples using all 93 observations across all diets and to produce a histogram of the bootstrapped distribution for mean weight loss using ggplot. Describe the shape of the distribution.

d)  In the HW5 template we provide code that calculates the 95% bootstrap confidence interval. Report and  provide  an  interpretation of this  interval in the context of the problem. Note, we used set.seed(10).

e)   Copy/paste/edit the code from 5d to get the 90% and 99% bootstrap confidence intervals from the same bootstrap sample (this means use the same seed as used for part (d); you must reset the seed between each interval you calculate). Since we are using built-in functions in R for this, we rerun each time and change the confidence level). Describe how these intervals compare with the 95% interval reported in part (d).