Thursday, October 14, 2010

Looking at poisson error bars

So far, the fits to a power law have all been using error bars that are obtained by computing the dispersion among the 6 runs for each set of initial conditions. I have now used Poisson error bars to do the same thing. Here I present a comparison. For one of the cold runs I have studied, here are the fits to a power law using the two different sets of error bars:



These look visually equivalent, though the reduced chi squared value is much smaller for the Poisson error bars. In order to compare the two sets, I made the following plot

Here it's clearly apparent that the Poisson error bars are systematically larger than those obtained using the dispersion among the runs. Just to be very specific, here is a snippet of code to illustrate how these two error bars were computed:

#this part is inside a loop ii over the 6 runs
d1[:,ii] =dens1 #these are the densities
d2[:,ii] =dens2
ep1[:,ii]=dens1/N.sqrt(h1[0]) #Poisson errors for the individual run
ep2[:,ii]=dens2/N.sqrt(h2[0]) #h1[0] is the number of particles in the bin

#Some statistics and output file
avgd1=d1.mean(axis=1) #This is the average density of the 6 runs
avgd2=d2.mean(axis=1)
if poisson==0:
stdd1=d1.std(axis=1) #This is the std. dev. of the 6 densities for each bin
stdd2=d2.std(axis=1)
else:
stdd1=N.sum(ep1*ep1,axis=1) #This step combines the Poisson error
stdd2=N.sum(ep2*ep2,axis=1) #bars from each run to get the error
stdd1=N.sqrt(stdd1)/N.sqrt(6) #on the mean.
stdd2=N.sqrt(stdd2)/N.sqrt(6)


I have also done the k-s test for these two cases, here are the plots.



In conclusion, it looks to me that the discrepancy between the chi square statistic and the outcome of the k-s test is not resolved by using Poisson errors instead of the run-run dispersion, indeed the Poisson errors are in fact larger than the dispersion errors, which causes the chisq statistic to improve. At the percent level, the choice of error bar affects the fit value of the exponent, but this is not an especially huge effect, obviously.

No comments:

Post a Comment