Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2000
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2000

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

Search the Archive

Re: Gaussian fit

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23208] Re: [mg23148] Gaussian fit
  • From: BobHanlon at aol.com
  • Date: Mon, 24 Apr 2000 01:12:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Needs["Statistics`NormalDistribution`"]
Needs["Graphics`Graphics`"]

freq = {{-0.95, 0}, {-0.85, 0}, {-0.75, 0}, {-0.65, 1}, {-0.55, 2}, {-0.45, 
        9}, {-0.35, 26}, {-0.25, 36}, {-0.15, 23}, {-0.05, 15}, {0.05, 
        8}, {0.15, 7}, {0.25, 7}, {0.35, 1}, {0.45, 0}, {0.55, 2}, {0.65, 
        1}, {0.75, 0}, {0.85, 0}, {0.95, 0}};

step = freq[[2, 1]] - freq[[1, 1]];

data = Flatten[Table[#[[1]], {#[[2]]}] & /@ freq];

Estimates for the mean and standard deviation are

{m, s} = {Mean[data], StandardDeviation[data]};

The maximum likelihood estimate (MLE) equations are

eqns = ((D[ExpandAll[Times @@ 
                    (PDF[NormalDistribution[mu, sigma], #] & /@ data)], 
                #] == 0) & /@ {mu, sigma});

The MLE  for the distribution is

dist = NormalDistribution[mu, sigma] /. FindRoot[eqns, {mu, m}, {sigma, s}];

bc = GeneralizedBarChart[Transpose[
        {Table[-1. + step(k - 1/2), {k, Length[freq]}], 
          Transpose[freq][[2]]/(step*Length[data]), 
          Table[step, {Length[freq]}]}], Frame -> True, Axes -> False, 
      PlotRange -> All, DisplayFunction -> Identity];

plt = Plot[PDF[dist, x], {x, -1, 1}, Frame -> True, Axes -> False, 
      PlotStyle -> {{RGBColor[0, 0, 1], AbsoluteThickness[2]}}, 
      DisplayFunction -> Identity];

Show[{bc, plt}, DisplayFunction -> $DisplayFunction, ImageSize -> {500, 310}];

The same approach would be used for your refined data. However, the order of 
your second set of frequency data is the reverse of the order for your first 
set


Bob Hanlon

In a message dated 4/20/2000 4:29:35 AM, slipstk at olemiss.edu writes:

>I am trying to determine the best Gaussian fit to a series of data 
>points.
>
>Data={{-0.95,0},{-0.85,0},{-0.75,0},{-0.65,1},{-0.55,2},{-0.45,9},{-0.3
>5,26},{-0.25,36},{-0.15,23},{-0.05,15},{0.05,8},{0.15,7},{0.25,7},{0.35,1
>},{0.45,0},{0.55,2},{0.65,1},{0.75,0},{0.85,0},{0.95,0}}
>
>A more detailed histogram of this looks like
>
>{{0,-0.98},{0,-0.94},{0,-0.9},{0,-0.86},{0,-0.82},{0,-0.78},{0,-0.74},{0,
>-0.7},{0,-0.66},{1,-0.62},{0,-0.58},{1,-0.54},{2,-0.5},{5,-0.46},{3,-0.42
>},{10,-0.38},{14,-0.34},{10,-0.3},{13,-0.26},{15,-0.22},{10,-0.18},{9,-0.
>14},{7,-0.1},{3,-0.06},{9,-0.02},{3,0.02},{5,0.06},{1,0.1},{4,0.14},{2,0.
>18},{3,0.22},{4,0.26},{0,0.3},{0,0.34},{1,0.38},{0,0.42},{0,0.46},{0,0.5}
>,{1,0.54},{1,0.58},{0,0.62},{1,0.66},{0,0.7},{0,0.74},{0,0.78},{0,0.82},{
>0,0.86},{0,0.9},{0,0.94},{0,0.98}}
>
>I've tried using NonLinearFit, but I can't get the parameters to make 
>sense.  There is also the possibility that this may be indicative of two
>
>processes superimposed upon each other, in which case, the fit would be
>
>two Gaussian distributions added together.  I've also looked through the
>
>Archives, but there doesn't seem to be much on this that is directly 
>useful.  Either that, or the solution is so simple that I'm just not 
>seeing it.
>


  • Prev by Date: RE: A simple programming question.
  • Next by Date: Re: A simple programming question.
  • Previous by thread: Gaussian fit
  • Next by thread: Re: Gaussian fit