Last active
May 6, 2019 05:08
-
-
Save Harshit1694/e0d60d839a1a46052ec826b152961609 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#We will take sample size=30, 50 & 500 samples=9000 | |
#Calculate the arithmetice mean and plot the mean of sample 9000 times | |
s30 <- c() | |
s50 <- c() | |
s500 <- c() | |
n =9000 | |
for ( i in 1:n){ | |
s30[i] = mean(sample(data$Wall.Thickness,30, replace = TRUE)) | |
s50[i] = mean(sample(data$Wall.Thickness,50, replace = TRUE)) | |
s500[i] = mean(sample(data$Wall.Thickness,500, replace = TRUE)) | |
} | |
par(mfrow=c(1,3)) | |
hist(s30, col ="lightblue",main="Sample size=30",xlab ="wall thickness") | |
abline(v = mean(s30), col = "red") | |
hist(s50, col ="lightgreen", main="Sample size=50",xlab ="wall thickness") | |
abline(v = mean(s50), col = "red") | |
hist(s500, col ="orange",main="Sample size=500",xlab ="wall thickness") | |
abline(v = mean(s500), col = "red") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment