Question of the day?
Suppose we have a normal population with a mean of 3 and a standard deviation of 1, how would we illustrate the bootstrap method here?
set.seed(1)
srs <- rnorm(25, mean=3)
resamps <- replicate(1000, sample(srs, 25, TRUE), simplify = FALSE)
x_bar_star <- sapply(resamps, mean, simplify =TRUE)
Let’s create a histogram here and fit normal curve.
hist(x_bar_star, breaks = 40, prob = TRUE)
curve(dnorm(x, 3, 0.2), add = TRUE)
We can calculate the difference now.
mean(x_bar_star)
## [1] 3.167102
mean(srs)
## [1] 3.168665
mean(x_bar_star) - mean(srs)
## [1] -0.001562762
Now we observe the standard error of the mean x_bar_star with the sample standard deviation of the resample statistics.
sd(x_bar_star)
## [1] 0.1826719
Share this post
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Email