Ask Statistics Guy
Consider a normally distributed random variable with an expected value of 20 and standard deviation of 4. If you determine the value of this variable 8 times, then what is the chance that the 8 sample values yield an improved standard deviation between 4.9 and 5.3?
obs = 10000 # rows
tests = matrix(0, nrow = obs, ncol = 8) # 8 cols = 8 runs
set.seed(1003)
# populate with random values, mean = 20, sd = 4
for (i in 1:obs) {
for (j in 1:8) {
tests[i,j] <- rnorm(1, mean = 20, sd = 4)
}
}
#Find sd of each row
sds = apply(tests, 1, sd)
# Filled Density Plot
d <- density(sds)
plot(d, main="Kernel Density of Std. Dev.")
polygon(d, col="red")
abline(v = 4.9, col= "black")
abline(v = 5.3, col= "black")
# Counts for standard deviation between 4.9 and 5.3
counts = vector(mode = "integer", length = obs)
for (k in 1:obs) {
if ((sds[k] >= 4.9) & (sds[k] <= 5.3)) {
counts[k] <- 1
}
}
total = sum(counts)
print((sum(counts)/obs))
## [1] 0.0704
The percent probability of this event occurring is 7.04%.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.