Answer To: Take one of your classmates’ data sets. Take 30 random samples of 5 data points each (one way: Past...
Shubham answered on Feb 01 2021
A classmates datasets are chosen which represent the hours of slept on different days in a week
>x = c(9,7,6,5,6,8,8)
> days = c("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
> names(x)= days
# Barplot of original data
> barplot(x,col = "blue",ylab = "Hours slept", main = "Barplot of hours slept" )
From the bar plot we see that the data is not normally distributed, So further we perform CLT to see
Whether the sample means are normally distribted.
# Generating a arbitrary matrix and assigning 30 random samples of 5 data point each.
> sample_data = matrix(c(1,2),nrow = 30,ncol = 5,byrow = T)
> for( i in 1:30){
+ y=sample(x,size = 5,replace = F)
+ for (j in 1:5){
+ sample_data[i,j]=y[j]
+ }
+ }
> sample_dat
# Each row of matrix represent a sample with 5 observations each
[,1] [,2] [,3] [,4] [,5]
[1,] 6 8 6 5 8
[2,] 6 8 6 8 7
[3,] 6 9 ...