Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: fitting

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104772] Re: fitting
  • From: Mark Fisher <particlefilter at gmail.com>
  • Date: Mon, 9 Nov 2009 05:45:55 -0500 (EST)
  • References: <hd3mt8$9sd$1@smc.vnet.net>

On Nov 7, 6:50 am, Vadim Zaliva <kroko... at gmail.com> wrote:
> Hi!
>
> I am very new to Mathematica and I am failing in trying to do
> something very simple.
> I am have the following data:
>
> x = {8, 36, 74, 96, 123, 152, 201, 269, 415, 460, 444, 579, 711, 731,
>    602, 364, 151};
>
> Which is a curve, similar to PDF function of Beta distribution:
>
> ListLinePlot[x]
>
> And I am trying to fit it to:
>
> PDF[BetaDistribution[\[Alpha], \[Beta]], x
>
> finding Alpha and Beta values.
>
> I will appreciate it somebody can give me a hint how to do this
> properly using FindFit or
> any other means. I am too embarrassed to post my modest attempts here,
> but trust
> me, I've spent few hours trying before posting :)
>
> Vadim

Borrowing from both Ray and Dan, I interpret the data as bin counts
and use FindFit:

Clear[a, b, x];
bincounts = {8, 36, 74, 96, 123, 152, 201, 269, 415, 460, 444, 579,
   711, 731, 602, 364, 151};
nbins = Length[bincounts];
bincenters = Range[1/2, nbins]/nbins;
binheights = Normalize[bincounts, Total[#]/nbins &];
bindata = Transpose[{bincenters, binheights}];
fit = FindFit[bindata, PDF[BetaDistribution[a, b], x], {a, b}, {x}];
dist = BetaDistribution[a, b] /. fit;
Plot[PDF[dist, x], {x, 0, 1},
 Epilog -> {ColorData[1][2], Point[bindata]},
 PlotLabel -> Column[(fit /. Rule -> Equal)]]

--Mark


  • Prev by Date: Re: Complex solutions to simple equations
  • Next by Date: Give arrow a certai color
  • Previous by thread: Re: fitting
  • Next by thread: Re: fitting