i bit confused in poisson distribution. fitting poisson type distribution , need extract mean , error on mean. know poisson distribution
in root (c/c++ based analysis framework) defined function below
function = ( [0] * power( [1] / [2] , x/[2] ) * exp (-[1]/[2]) ) / gamma(x/[2] + 1) : [0] = normalizing parameter [1] / [2] -> mean (mu) x / [2] -> x gamma( x / [2] + 1 ) = factorial (x / [2])
so, in principle mean of poisson distribution mu = 1/2 , error standard deviation square root of mean.
but, if using value mean coming around 10 , hence error ~3.
while mean of distribution around 2 (as can see) confused. because parameter 1 's value coming out around 2 or 3. so, should use parameter 1 mean value or what??
please suggest should use , why?
my full code below:
th1f *hclustersize = new th1f("hclustersize","cluster size ge1/1", 10,0.,10.); tmptree->draw("g1ycl.ngeoch>>hclustersize","g1ycl@.getentries()==1 && g1xcl@.getentries()==1"); hclustersize->getxaxis()->settitle("cluster size"); hclustersize->getyaxis()->settitle("#entries"); tf1 *f1 = new tf1("f1","[0]*tmath::power(([1]/[2]),(x/[2]))*(tmath::exp(-([1]/[2])))/tmath::gamma((x/[2])+1)", 0, 10); f1->setparameters(hclustersize->getmaximum(), hclustersize->getmean(), 1); hclustersize->fit("f1"); // use option "r" = fit between "xmin" , "xmax" of "f1"
on root command line fitting poisson distribution can done this:
tf1* func = new tf1("mypoi","[0]*tmath::poisson(x,[1])",0,20) func->setparameter(0,5000) // set starting values func->setparameter(1,2.) // set starting values func->setparname(0,"normalisation") func->setparname(1,"#mu") th1f* hist = new th1f("hist","hist",20,-0.5,19.5) (int = 0 ; < 5000 ; i++) { hist->fill(grandom->poisson(3.5)); } hist->draw() hist->fit(func)
note that bin centers shifted wrt initial post, such bin center of 0 counts @ 0 , not @ 0.5 (and same other bins).
Comments
Post a Comment