2. Assume that you are going to toss a fair coin 50 times and compute the sample mean of the number of heads. Repeat the sampling 1,000 times and plot the sampling distribution of the sample mean.Hint: A. Sample 50 observations from (0,1). There are a few functions to do, such as, sample(), rbinom(), etc.B. Repeat Step A 1,000 times to create a sampling distribution. C. Compute the mean of 50 observations in Step A. Then you will get 1,000 sample means. D. Plot the 1,000 sample means. The histogram may look similar to the plot below:

Respuesta :

Answer:

You should only copy and paste in R (R statistical programming language) the next code to reproduce the histogram below.

Step-by-step explanation:

set.seed(1) # We set a seed to reproduce exactly each step in the future

MEAN <- NULL # We create an empty vector

for(j in 1:1000){ # B. We repeat this process 1000 times using the function "for"

# A. We sample 50 observations from {0, 1} and save it in the object x

x <- mean(sample(x = c(0, 1), size = 50, replace = TRUE))

# C. We compute the mean of the 50 observations and then save it in the object m

m <- mean(x)

# We save the mean m in the vector MEAN

MEAN <- c(MEAN, m)

}

# The 1000 sample means are in the vector MEAN.

# D. We plot the 1000 sample means with help of the function "hist"

hist(MEAN)

Ver imagen jennerfranco
ACCESS MORE