Below are the solutions to these exercises on data display.

#################### # # # Exercise 1 # # # #################### iter <- 10000 means <- rep(NA, iter) for (i in 1:iter){ sam_50 <- sample(data$mass, 50) means[i] <- mean(sam_50) } hist(means)

hist(data$mass)

#################### # # # Exercise 2 # # # #################### mean(data$mass)

## [1] 31.99258

sd(data$mass)/sqrt(50)

## [1] 1.114989

#OR mean(means)

## [1] 31.98233

sd(means)

## [1] 1.081871

#################### # # # Exercise 3 # # # #################### library(moments) skewness(means)

## [1] -0.0333564

# slight positive skewness, which means that it is slightly light tailed kurtosis(means)

## [1] 3.064367

# The kurtosis is close to the expected value 3. #################### # # # Exercise 4 # # # #################### z = (30.5-mean(data$mass))/(sd(data$mass)/sqrt(50)) z

## [1] -1.338649

#################### # # # Exercise 5 # # # #################### pnorm(z)

## [1] 0.09034253

#################### # # # Exercise 6 # # # #################### z = (31-mean(data$mass))/(sd(data$mass)/sqrt(150)) #################### # # # Exercise 7 # # # #################### pnorm(z)

## [1] 0.06154952

#################### # # # Exercise 8 # # # #################### z*sd(data$mass)/sqrt(150)

## [1] -0.9925781

#################### # # # Exercise 9 # # # #################### z = 1.96 low <- 31 - z*sd(data$mass)/sqrt(250) high <- 31 + z*sd(data$mass)/sqrt(250) low;high

## [1] 30.02267

## [1] 31.97733

#################### # # # Exercise 10 # # # #################### z = 2.33 low <- 31 - z*sd(data$mass)/sqrt(250) high <- 31 + z*sd(data$mass)/sqrt(250) low;high

## [1] 29.83817

## [1] 32.16183

z = 2.58 low <- 31 - z*sd(data$mass)/sqrt(250) high <- 31 + z*sd(data$mass)/sqrt(250) low;high

## [1] 29.71351

## [1] 32.28649

**What's next:**

- Explore all our (>1000) R exercises
- Find an R course using our R Course Finder directory
- Subscribe to receive weekly updates and bonus sets by email
- Share with your friends and colleagues using the buttons below

Jose Farfan says

thank you very much for this material.

I am in the Yucatan in Mexico

Vasileios says

Thanks for your kind words! I hope you enjoy the rest of the series!

Cheers!