关键词 > R代写

R Exercise 5 Key

发布时间:2021-03-07

R Exercise 5 Key

Economics 3818

 

Instructions

You may work in groups of up to three people, but you must each turn in your own work.

• Write up your answers and paste the R code you used in a word document

• Separate the R code above and below by three asterisks (***)

• Copy and paste all plots generated into the word document

• Upload to Canvas

 

Suppose our population distribution is binomial with 20 trials and p=0.05, that is Y~B(20,0.05).

1.  What is the sample space?

2.  Plot the population distribution. I did this in lecture and posted the code. Feel free to reuse it. Does this distribution look similar to the normal distribution?

3.  Let’s take a sample of 5 observations from this distribution and calculate the sample average. We’ll do this 10,000 times. Again, feel free to reuse my code my lecture. Paste in the histogram of this sampling distribution of the sample mean. Use the set.seed(1234) command to get the same sequence of realizations. This is included in my code. Does this sampling distribution of the sample mean look approximately normally distributed?

4.  Looking at my code, what does each element of the X vector used in 3 represent?

5.  Repeat 3 but increase the sample size to 50 and paste in the histogram of this new sampling distribution. Does this sampling distribution look closer to being normally distributed than the case where n=5? Why?

Question 2-5 were answered in class. Now, we’ll repeat the analysis except let’s set the probability of success p=0.50 instead of p=0.05, that is we have Z~B(20,0.5). Simply modify the code from the previous question slightly.

6.  Plot this new population distribution. Does this population distribution look closer to being normally distributed than the population distribution where p=0.05?

7.  Repeat 3 with a sample of 5 observations but sample from the new population distribution. Does this sampling distribution look normally distributed, at least more so than the previous sampling distribution with a sample size of 5 and p=0.05? Why?

8.  Which sampling distribution converges to the normal distribution faster,  or . Why?

9.  What is population mean and variance of Z, that is E(Z) and V(Z)?

10. Calculate E, E, V, and V? How does this compare to the population mean and variance?