I have derived and implemented an equation of an expected value. To show that my code is free of errors i have employed the Monte-Carlo computation a number of times to show that it converges into the same value as the equation that i derived.
As I have the data now, how can i visualize this? Is this even the correct test to do? Can I give a measure how sure i am that the results are correct?
Why not just do a simple t-test? From your theoretical equation, you have the true mean mu_0
and your simulators mean,mu_1
. Note that we can't calculate mu_1
, we can only estimate it using the mean/average. So our hypotheses are:
H_0: mu_0 = mu_1 and H_1: mu_0 does not equal mu_1
The test statistic is the usual one-sample test statistic, i.e.
T = (mu_0 - x)/(s/sqrt(n))
where
mu_0
is the value from your equationx
is the average from your simulators
is the standard deviationn
is the number of values used to calculate the mean.In your case, n
is going to be large, so this is equivalent to a Normal test. We reject H_0
when T
is bigger/smaller than (-3, 3). This would be equivalent to a p-value < 0.01.
A couple of comments:
p-value/N
where N
is the number of tests you are running.n=....
T
is bigger/smaller than (-3, 3) just comes from the Normal distribution.