Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We recall that, if XN(, 2 ) with unknown and 2 , then for an independent random

ID: 3058500 • Letter: W

Question

We recall that, if XN(, 2) with unknown and 2, then for an independent random sample X1, . . . , Xn, with sample mean X and sample variance S2, XS/ntn1.
a) Investigate the rnorm function in R, which can be used to generate random numbers from a normal distribution. For a mean and variance of your choice, run the rnorm command to produce 10 random numbers.
b) Investigate the qt function in R, which can be used to find values asuch that P(tn < b) =p, for some given n and p. Use this function to find a 95% confidence interval (a, b), so that P(a < t9< b) = 0.95.
c) Hence, by using R to calculate the sample mean and sample variance of the data produced in part (a), use R to construct a 95% confidence interval (c, d) for . [All calculations should be done using R].
d) Based on parts (b) and (c), construct a function in R that will compute a p % confidence interval for the mean of a normally distributed random variable, given some data. The function should take as input the observed data and the value of p. As output it should return the confidence interval as a vector.
e) Run the code from part (d) and find a 96% confidence interval using 100 random numbers from a normal distribution with mean = 5 and 2= 4.

Explanation / Answer

We recall that, if XN(, 2) with unknown and 2, then for an independent random sample X1, . . . , Xn, with sample mean X and sample variance S2, XS/ntn1.
a) Investigate the rnorm function in R, which can be used to generate random numbers from a normal distribution. For a mean and variance of your choice, run the rnorm command to produce 10 random numbers.
b) Investigate the qt function in R, which can be used to find values asuch that P(tn < b) =p, for some given n and p. Use this function to find a 95% confidence interval (a, b), so that P(a < t9< b) = 0.95.
c) Hence, by using R to calculate the sample mean and sample variance of the data produced in part (a), use R to construct a 95% confidence interval (c, d) for . [All calculations should be done using R].
d) Based on parts (b) and (c), construct a function in R that will compute a p % confidence interval for the mean of a normally distributed random variable, given some data. The function should take as input the observed data and the value of p. As output it should return the confidence interval as a vector.
e) Run the code from part (d) and find a 96% confidence interval using 100 random numbers from a normal distribution with mean = 5 and 2= 4.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote