Re: Histogram fitting
- To: mathgroup at smc.vnet.net
- Subject: [mg30659] Re: [mg30638] Histogram fitting
- From: BobHanlon at aol.com
- Date: Mon, 3 Sep 2001 20:32:34 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/8/31 8:11:32 PM, Adam.Bouchta at cern.ch writes: >How does one fit a histogram with a Gaussian? >I do: >Histogram[data] > >and would like to make a gaussian fit of the resulting histogram... > Needs["Graphics`Graphics`"]; Needs["Graphics`Colors`"]; Needs["Statistics`NormalDistribution`"]; Needs["Statistics`DataManipulation`"]; data = RandomArray[ NormalDistribution[10*Random[], 2*Random[]], 100]; mu = Mean[data]; sigma = StandardDeviationMLE[data]; (DisplayTogether[ Histogram[data, HistogramScale -> 1], Plot[PDF[NormalDistribution[mu, sigma], x], {x, Min[data], Max[data]}, PlotStyle -> {AbsoluteThickness[2], Blue}], Frame -> True, Axes -> False, FrameLabel -> {"x", "PDF\n"}, PlotLabel -> "Data Distribution", ImageSize -> 360]; Print["data: ", LocationReport[data]]) Bob Hanlon Chantilly, VA USA