Skip to content

Instantly share code, notes, and snippets.

@jirilukavsky
Created May 5, 2020 09:55
Show Gist options
  • Save jirilukavsky/adfeec817826508f1a7efb0b4a582779 to your computer and use it in GitHub Desktop.
Save jirilukavsky/adfeec817826508f1a7efb0b4a582779 to your computer and use it in GitHub Desktop.
Single variance estimate
# When we calculate variance (SD) from single observation (one group),
# how good/bad estimate this can be of the underlying SD?
B <- 100
n <- 6
m <- 50
s <- 15
estim_sd <- numeric(B)
set.seed(1010)
for (i in 1:B) {
x <- rnorm(n, mean = m, sd = s)
estim_sd[i] <- sd(x)
}
hist(estim_sd, breaks = seq(0, 40, by = 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment