
21 Mar
2011
21 Mar
'11
6:24 p.m.
On Mon, 21 Mar 2011, Tom Nielsen wrote:
sampler = do x <- gauss 0.0 1.0 y <- gauss 0.0 1.0 return $ (2*x, x+y)
main = do xys <- take 100000 `fmap` runSamplerIO sampler print $ runStat (both (before varF fst) (before varF snd)) $ xys
=> (3.9988971177326498,2.0112123117664975) that is, (variance of 2*x, variance of x+y)
Variances of independent random variables (here x and y) are additive, for dependent variables (say, x and x) this does not hold.