# Sampling with inclusion/exclusion criteria from known distribution

Is there a simple way to determine (other than by simulation) the expected standard deviation of a sample, when sampling from a population with known distribution, for example a normal distribution with mean 25 and standard deviation 5, but the samples are included/excluded if they fall within certain limits ? In particular, I am interested in the case where the inclusion criteria is that the sampled values are between 25 and 30.

This is not homework.

• Do you take a fixed sample of size $n$ from the underlying distribution and then throw away the bad observations or do you continue sampling until you get a fixed sample size of "good" observations? Mar 30, 2012 at 18:21
• Thanks cardinal - the second one is correct (we are seeking a fixed sample size of observations meeting the criteria). So far I have just used the U(25,30) distribution as a guestimate, which I expect will not be far from correct, and simulations show that to be the case, but I'd like to know a more rigorous theory-based answer, if possible. Mar 30, 2012 at 18:32

The variance of a truncated normal distribution (with untruncated mean $\mu$ and variance $\sigma^2$, and bounds $a$ and $b$) as given by Wikipedia is: $$\sigma^2\left[1+\frac{\alpha\phi(\alpha)-\beta\phi(\beta)}{Z} -\left(\frac{\phi(\alpha)-\phi(\beta)}{Z}\right)^2\right]$$ With: $$\alpha=\frac{a-\mu}{\sigma}, \quad \beta=\frac{b-\mu}{\sigma}, \quad Z=\Phi(\beta)-\Phi(\alpha)$$
$\phi$ and $\Phi$ are the pdf and cdf respectively of a standard normal distribution. $\phi(x)$ has analytic form $\frac{1}{\sqrt{2\pi}} e^{-\frac{1}{2}x^2}$, and $\Phi(x)$ can be computed either by numerical integration of $\phi$, or by a number of other techniques. It is usually available as a predefined function in most mathematical libraries.
• This is the right underlying distribution and so is on the right track. The OP asks about the "expected sample standard deviation", which leaves a bit of work left to do. I suspect the answer is a bit messy due to the nonlinearity of the square-root. I think the suggestion to use a predefined function or other technique for approximating $\Phi(x)$ is generally much better than trying to do so by numerical integration, for many reasons. Mar 30, 2012 at 20:34