Re: fitting

*To*: mathgroup at smc.vnet.net*Subject*: [mg104753] Re: [mg104711] fitting*From*: danl at wolfram.com*Date*: Sun, 8 Nov 2009 06:50:54 -0500 (EST)*References*: <200911071150.GAA10169@smc.vnet.net>

> 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 There are a few ways to go astray, and I imagine I replicated some of them. Here is something that seems to work. Rescale along the x axis so that those values are evenly spaced between zero and one. Now you can either also rescale on the y axis (e.g. divide each value by the total), or else simply make that scaling a part of the fit parametrization. I do the latter below. data = {8, 36, 74, 96, 123, 152, 201, 269, 415, 460, 444, 579, 711, 731, 602, 364, 151}; In[86]:= bfit = FindFit[Transpose[{(Range[Length[data]])/(Length[data] + 1), data}], n*PDF[BetaDistribution[a, b], x], {a, b, n}, x] Out[86]= {a -> 4.69588, b -> 2.34725, n -> 291.736} To test this, you might do Show[{ListPlot[ Transpose[{(Range[Length[data]])/(Length[data] + 1), data}]] /. bfit, Plot[n*PDF[BetaDistribution[a, b], x] /. bfit, {x, 0, 1}]}] One other thing I tried was to augment data by zeros at each end (and have x values starting at zero and ending at one). This did not work, at least not with the code I used. Another thing that failed was to let FindFit find scaling along the x axis. Hence the explicit scaling used above. Daniel Lichtblau Wolfram Research

**References**:**fitting***From:*Vadim Zaliva <krokodil@gmail.com>

**Re: Thikness of edges in a 3D graph**

**Re: Strange behavior when using pattern match and HoldAll**

**fitting**

**Re: fitting**