MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Fit Gaussian function to histogram

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117728] Re: Fit Gaussian function to histogram
  • From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
  • Date: Wed, 30 Mar 2011 04:14:58 -0500 (EST)

Hi

The first thing I would do would be to find m=Mean[ data ] and sd=StandardDeviation[ data ], and then plot together the histogram and something like

Plot[ PDF[ NormalDistribution[ m, sd  ], x ], {x, Min [data ], Max[ data] ],

and see if the Gaussian is at all a reasonable fit.

Fitting distributions to data is a big area, and there are tests for closeness of fit. Have a look through the Mathematica documentation.

There is

DistributionFitTest[ data, Automatic, "HypothesisTestData" ] in the documentation for DistributionFitTest.

(I found this by searching the online documentation for "Kolmogorov", because I know that the Kolmogorov-Smirnov test is such a test.)

Have a look also at AndersonDarlingTest[].

If you enter "fitting Normal distribution to data" into the search box for the online documentation, the second screen will lead you to

FindDistributionParameters[], and it will mention also EstimatedDistribution[].

Mathematica can give you a lot of power to attack a problem like this. There is a lot of example code in these documentation pages, too.

Cheers

Barrie

>>> On 29/03/2011 at 10:54 pm, in message <201103291154.GAA05840 at smc.vnet.net>,
cubsfan334 <cubsfan334 at gmail.com> wrote:
> Hi,
> 
> I realize that I can generate a histogram from a data set using the
> Histogram[{data},bin size] command, yet this only seems to create a
> graphic.  Is there anyway to fit a function (preferably Gaussian) to
> the histogram Mathematica creates?
> 
> Thanks!



  • Prev by Date: InheritScope in CDF player
  • Next by Date: Re: Off Topic: E-Mail Security in this Group
  • Previous by thread: Re: Fit Gaussian function to histogram
  • Next by thread: Re: Fit Gaussian function to histogram