Parametric bootstrap

August 7, 2015

(This article was first published on Muestreo y estadísticas oficiales - El blog de Andrés Gutiérrez, and kindly contributed to R-bloggers)

Assume we want to know the mean square error (MSE) of the sample median as a estimator of a population mean under normality. As you know, this is not a trivial problem. We may take advantage of the Bootstrap method and solve it by means of simulation. 

This way, for $b=1,\ldots, B$, we generate $X_{b1},\ldots, X_{bn} \sim N(\hat{\mu}, \hat{\sigma}^2)$. Then, we compute the sample median $\tilde{X}_b$ for each sample in the bootstrap. Finally, an estimator of the MSE is given by

$$\widehat{MSE} = B^{-1} \sum_{b=1}^B(\tilde{X}_b – \hat{\mu})^2$$

In R, the simulation should look like this for a sample size of ten units:

n <- 10
x <- rnorm(n, 10, 1)
(mu.hat <- mean(x))
(sigma.hat <- sd(x))
boot.MSE.median <- function(B, mu.hat, sigma.hat){
x.s <- rnorm(n, mu.hat, sigma.hat)
SE <- (median(x.s) - mean(mu.hat)) ^ 2
B <- 500
boot.SE <- replicate(B, boot.MSE.median(B, mu.hat, sigma.hat))
(MSE.hat <- mean(boot.SE))

To leave a comment for the author, please follow the link and comment on their blog: Muestreo y estadísticas oficiales - El blog de Andrés Gutiérrez. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)