# Effective sample size

September 23, 2010
By

(This article was first published on Xi'an's Og » R, and kindly contributed to R-bloggers)

In the previous days I have received several emails asking for clarification of the effective sample size derivation in “Introducing Monte Carlo Methods with R” (Section 4.4, pp. 98-100). Formula (4.3) gives the Monte Carlo estimate of the variance of a self-normalised importance sampling estimator (note the change from the original version in Introducing Monte Carlo Methods with R ! The weight W is unnormalised and hence the normalising constant $kappa$ appears in the denominator.)

$frac{1}{n},mathrm{var}_f (h(X)) left{1+dfrac{mathrm{var}_g(W)}{kappa^2}right}$

as

$dfrac{sum_{i=1}^n omega_i left{ h(x_i) - delta_h^n right}^2 }{nsum_{i=1}^n omega_i} , left{ 1 + n^2,widehat{mathrm{var}}(W)Bigg/ left(sum_{i=1}^n omega_i right)^2 right},.$

Now, the front term is somehow obvious so let us concentrate on the bracketed part. The empirical variance of the $omega_i$‘s is

$frac{1}{n},sum_{i=1}^nomega_i^2-frac{1}{n^2}left(sum_{i=1}^nomega_iright)^2 ,,$

the coefficient $1+widehat{mathrm{var}}_g(W)/kappa^2$ is thus estimated by

$n,sum_{i=1}^n omega_i^2 bigg/ left(sum_{i=1}^n omega_iright)^2,.$

which leads to the definition of the effective sample size

$text{ESS}_n=left(sum_{i=1}^nomega_iright)^2bigg/sum_{i=1}^nomega_i^2,.$

The confusing part in the current version is whether or not we use normalised W’s and $omega_i$‘s. I hope this clarifies the issue!

Filed under: Books, R, Statistics Tagged: effective sample size, importance sampling, Introducing Monte Carlo Methods with R

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...