Math 318, Summer 2021, Garren

Required R Homework #3

due Sunday, June 6, 3 p.m.

----------------------------------------------------------------------

(A) Using R:

(1) Generate 15 random variates from a Normal(μ=60, σ=20) population.

(2) Label the variable as "X1", and print these data.

(3) Repeat parts (A1) and (A2) nine more times, except the nine additional sets of 15 numbers should be labeled as "X2" through "X10", and print these data.

(4) Use R to determine an 80% confidence interval on the mean for each of your 10 data sets. Highlight in YELLOW each confidence interval.

(5) Next to your 10 confidence intervals, write either "contains the mean" or "does not contain the mean" according to whether or not your confidence interval contains the population mean (i.e., μ=60).

(6) Based on your answers to part (A5), write the proportion of your 80% confidence intervals which contain the population mean.

----------------------------------------------------------------------

(B) Using R:

(1) Generate 200 random variates from a Binomial(n=300, p=0.4) population. Divide each of these 200 random variates by n(=300), so that you now have 200 sample proportions.

(2) Label the variable from part (B1) as "p_hat".

(3) Use R to determine the LOWER bound of the 90% confidence interval on p, for each of the 200 values of p_hat. Hence, your new variable is p_hat-1.64485*sqrt(p_hat*(1-p_hat)/300).

(4) Label your variable from part (B3) as "lower".

(5) Use R to determine the UPPER bound of the 90% confidence interval on p, for each of the 200 values of p_hat. Hence, your new variable is p_hat+1.64485*sqrt(p_hat*(1-p_hat)/300).

(6) Label your variable from part (B5) as "upper".

(7) Let "p_in_ci" be a new variable of 200 values, such that p_in_ci is equal to 1 if p is in your 90% confidence interval, but p_in_ci is equal to 0 if p is outside your 90% confidence interval. In other words, let p_in_ci = (lower less than 0.4)*(0.4 less than upper).

(8) Determine the proportion of your 200 90% confidence intervals which contain the true value of p(=0.4). In other words, determine the mean of p_in_ci.

(9) Highlight in PINK your answer from part (B8), and next to your answer, write the theoretical value (i.e., 90%).

(10) Determine the standard error of your answer from part (B8). In other words, compute sqrt(0.9*(1-0.9)/200).

----------------------------------------------------------------------

(C) Show your R-code and R-output. Order and label your output in the same order in which the problems were assigned above, including all of the random variates.

(D) Although you are allowed to receive help from others, list the names of those who helped you and the names of those whom you helped, as well as what type of help was given. If you did not give or receive help, then write, "No help." Submit your homework as a .pdf to Canvas.

----------------------------------------------------------------------

Return to Dr. Garren's home page.