0

Inspired by this post Is Monte Carlo uncertainty estimation equivalent to analytical error propagation?, I try to check it myself using a simple function f=A/B, where A is 10 with uncertainty 1 and B is 5 with uncertainty 2. The error of f from error propagation is 0.6, however, the error of f from Monte Carlo simulation is 221.5. I'm very confused why this happens. I attached my code below:

    > runs = 100000    
    > A=10
    > sigmaA=1
    > B=5
    > sigmaB=2 
    > simA <- rnorm(runs,mean=meanA,sd=sigmaA)
    > simB <- rnorm(runs,mean=meanB,sd=sigmaB)
    > f=A/B
    > f
    [1] 2
    > sigmaf=sqrt(f^2*((sigmaA/A)^2+(sigmaB/B)^2-2*sigmaA*sigmaB/A/B))
    > sigmaf
    [1] 0.6
    > simf=simA/simB
    > sd(simf)
    [1] 221.5475

Thank you for your help!

yuqian
  • 1,234
  • 9
  • 8
  • 1
    First of all, your formula for the error propagation is not correct. Instead of `sigmaA*sigmaB` it should be `sigmaAB`, i.e., the covariance between A and B, which is zero here. Then you should consider the last sentence [there](https://en.wikipedia.org/wiki/Propagation_of_uncertainty#Simplification). If I correct the calculation of `sigmaf` to `sigmaf – Roland Mar 11 '16 at 09:11
  • 1
    Possible duplicate of [Propagation of large errors](http://stats.stackexchange.com/questions/7176/propagation-of-large-errors) – Roland Mar 11 '16 at 09:16
  • Hi Roland, Thanks! Now I understand that I made two mistakes. One is that I misunderstand sigmaAB, and the other is that I propagate large errors, which is explained clearly in the post you mention. Thank you so much! – yuqian Mar 13 '16 at 18:43

0 Answers0