Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Fitting probability histogram with a Gaussian' topicStudent Support Forum > General > "Fitting probability histogram with a Gaussian"

Next Comment >Help | Reply To Topic
Author Comment/Response
William Duhe
07/30/13 10:56pm


With the code bellow; What I want to do is get the probability density of the list generated by S1[\[Alpha,off], plot it in a Histogram and then fit that with a Gaussian curve and extract the statistics. The key quantities I'm looking for in the table are the mean and RMS of the distribution you get, and the chisq / NDF of the fit to the unit Gaussian.



off = 1000;(*Expected Number of Off Counts*)
\[Alpha] = .01;(*Ratio of On/Off Counts*)
Non = 1000;
Noff = RandomVariate[PoissonDistribution[off], 10000];


(*Normal Distribution*)
h2 = Plot[PDF[NormalDistribution[], x], {x, -6, 6},
PlotStyle -> Directive[Red, Thick]];


Attributes /@ {Greater, Sign}


{{Protected}, {Listable, NumericFunction, Protected, ReadProtected}}


S1[off_, \[Alpha]_] =
Sign[Non - \[Alpha]*Noff]*
Sqrt[2] (Non*Log[(1 + \[Alpha])/\[Alpha] (Non/(Non + Noff))] +
Noff*Log[(1 + \[Alpha]) (Noff/(Non + Noff))])^(1/2);

ListPlot[S1[off, \[Alpha]], Frame -> True, Axes -> False,
PlotLabel -> "Formula 17"]



hist22 = Histogram[S1[off, \[Alpha]], 26, "ProbabilityDensity",
PlotLabel -> "Formula 17", AxesLabel -> "Probability"];


Show[hist22, h2]

URL: ,

Subject (listing for 'Fitting probability histogram with a Gaussian')
Author Date Posted
Fitting probability histogram with a Gaussian William Duhe 07/30/13 10:56pm
Re: Fitting probability histogram with a Gaussian Bill Simpson 08/01/13 9:20pm
Re: Fitting probability histogram with a Gaussian Bill Simpson 08/02/13 01:12am
Next Comment >Help | Reply To Topic