2
$\begingroup$

I want to simulate a process in which a system is subdivided into $n$ parts. At a given time each part suffer a change that can be measured using a random variable whose probability distribution is $\mathcal N(0,\sigma ^2)$. The following restraint has to be satisfied: The sum of the changes must be zero.

I do not know how to perform the sample. My first attempt would be:

  1. Take $n$ samples of the distribution.

  2. Subtract the sample mean to each of the $n$ values.

I feel that there is something wrong with this procedure: If I repeat this process at many ($m$) different times, I would expect that for each part, the $m$ values correspond to a sample of $\mathcal N(0,\sigma ^2)$. Clearly, it is not the case if $n=1$ (I would obtain 0 ,0 , 0... $m$ times). So, I am not sure if it is the right procedure.

Does it works for $n>1$? If yes, why? If not, Is there any correct procedure? Which one?

$\endgroup$
1
  • 2
    $\begingroup$ If you have a constraint, like the overall mean is zero, the simulated data would have to become dependent -- if you know that you have larger values in the first few cases, then you know that the subsequent cases need to be small; while independence means, you know nothing. Your sample cannot be i.i.d., but you can make it marginally $N(0,\sigma^2)$ for each $i$ with some effort. Note that subtracting the sample mean compresses the distribution, so your marginal variance will be smaller than $\sigma^2$ (and more like $\frac{n-1}n \sigma^2$). $\endgroup$
    – StasK
    Commented Jul 24, 2017 at 18:16

1 Answer 1

1
$\begingroup$

It does not quite work because of this:

Let $X_1 .. X_n$ come from the normal distribution, then

$Var(X_1 - \bar{X})=\\Var(X_1 - X_1/n -\sum_2^n(X_i)/n)=\\ Var(\frac{n-1}{n}X_1)+\sum_2^nVar(X_i/n)=\\ \frac{(n-1)^2}{n^2}\sigma^2 + \frac{(n-1)}{n^2}\sigma^2\neq\sigma^2$

To fix that, just use $(X_1 - \bar{X})\sqrt{\frac{n}{n-1}}$

Of course things don't work for N=1 because if you want the mean to be zero, then you just have a zero.

$\endgroup$
2
  • $\begingroup$ Thank you very much for your answer. It is exactly what I need. I really appreciate if you can expand just a little bit on the steps for the last equality. $\endgroup$ Commented Jul 24, 2017 at 18:52
  • 2
    $\begingroup$ edited. does that work better? $\endgroup$
    – djma
    Commented Jul 24, 2017 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.