# How to fit this data to be used in NIntegrate later?

I have a list of data points that resemble a chi-squared distribution (long tailed gaussian) that I am having trouble fitting or finding an equation with. The goal is to use the fitted equation in an NIntegrate routine. Things I've tried:

1. I tried fitting the FWHM of the peak to the FWHM of a gaussian, which is easy to describe mathematically. But, unfortunately this resulted in poor accuracy.

2. I tried using the Interpolation function of mathematica. This seemed to work well but I get an error when I try to integrate beyond the domain of the interpolated function. Also I am wary of it accuracy.

So, finally I am wondering if any of you mathematica ninjas have some idea of how I could possible fit this data and have an equation/expression that I could later include in an NIntegrate routine that will preserve accuracy! The data is located below thanks a bunch!!!!

{{-0.00146513, 0.}, {-0.00143553, 0.}, {-0.00140593,
0.}, {-0.00137633, 0.}, {-0.00134673, 0.}, {-0.00131714,
0.}, {-0.00128754, 0.}, {-0.00125794, 0.}, {-0.00122834,
0.709003}, {-0.00119874, 3.34244}, {-0.00116914,
9.62218}, {-0.00113954, 29.4743}, {-0.00110995,
59.3537}, {-0.00108035, 91.2588}, {-0.00105075,
123.974}, {-0.00102115, 125.899}, {-0.000991552,
104.932}, {-0.000961953, 88.2202}, {-0.000932355,
64.2154}, {-0.000902756, 52.4662}, {-0.000873158,
37.9823}, {-0.000843559, 31.6013}, {-0.000813961,
26.3344}, {-0.000784362, 24.8151}, {-0.000754763,
17.6238}, {-0.000725165, 16.8135}, {-0.000695566,
13.8762}, {-0.000665968, 11.5466}, {-0.000636369,
10.9389}, {-0.000606771, 9.31833}, {-0.000577172,
7.39389}, {-0.000547573, 5.97588}, {-0.000517975,
4.76045}, {-0.000488376, 4.65916}, {-0.000458778,
4.15273}, {-0.000429179, 4.15273}, {-0.000399581,
2.9373}, {-0.000369982, 2.53215}, {-0.000340383,
2.53215}, {-0.000310785, 2.32958}, {-0.000281186,
1.51929}, {-0.000251588, 1.62058}, {-0.000221989,
1.31672}, {-0.000192391, 0.709003}, {-0.000162792,
0.709003}, {-0.000133194, 0.607717}, {-0.000103595,
1.41801}, {-0.0000739964, 0.911575}, {-0.0000443978,
0.405145}, {-0.0000147993, 0.709003}, {0.0000147993,
0.506431}, {0.0000443978, 0.506431}, {0.0000739964,
0.709003}, {0.000103595, 0.405145}, {0.000133194,
0.405145}, {0.000162792, 0.101286}, {0.000192391,
0.607717}, {0.000221989, 0.303858}, {0.000251588,
0.810289}, {0.000281186, 0.405145}, {0.000310785,
0.607717}, {0.000340383, 0.303858}, {0.000369982,
0.303858}, {0.000399581, 0.101286}, {0.000429179, 0.}, {0.000458778,
0.101286}, {0.000488376, 0.101286}, {0.000517975,
0.}, {0.000547573, 0.}, {0.000577172, 0.}, {0.000606771,
0.202572}, {0.000636369, 0.}, {0.000665968, 0.}, {0.000695566,
0.101286}, {0.000725165, 0.101286}, {0.000754763,
0.101286}, {0.000784362, 0.101286}, {0.000813961, 0.}, {0.000843559,
0.101286}, {0.000873158, 0.}, {0.000902756, 0.}, {0.000932355,
0.}, {0.000961953, 0.}, {0.000991552, 0.}, {0.00102115,
0.}, {0.00105075, 0.}, {0.00108035, 0.}, {0.00110995,
0.}, {0.00113954, 0.}, {0.00116914, 0.101286}, {0.00119874,
0.}, {0.00122834, 0.101286}, {0.00125794, 0.}, {0.00128754,
0.}, {0.00131714, 0.}, {0.00134673, 0.}, {0.00137633,
0.}, {0.00140593, 0.}, {0.00143553, 0.}, {0.00146513, 0.}}

• I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Dec 15, 2014 at 15:54
• You've been using the site for 8 months now. You already asked 14 questions but never voted and never accepted an answer. It's time to participate more! Dec 15, 2014 at 15:55

Perhaps this is enough for you:

d1 = Transpose[{#[[1]] - #[[1, 1]], #[[2]]} &@ Transpose@Select[data, #[[2]] > 0 &]];
nlm = NonlinearModelFit[d1, c PDF[BetaDistribution[3, b], x], {b, c},  x];
Plot[nlm[x], {x, 0, .003}, PlotRange -> All, Epilog -> Point@d1]


Another option:

nlm = NonlinearModelFit[d1, c PDF[MoyalDistribution[.0002, b], x], {b, c}, x]
Plot[nlm[x], {x, 0, .003}, PlotRange -> All, Epilog -> Point@d1]


• Hmmm, these are great but is there a genralized routine, for let's say other data sets? When I tried these methods with my other data sets I got poorly fitted results. Thanks in advanced! Dec 15, 2014 at 15:37
• @user1886681 fitting is an art, not an automatic procedure. If you really need something more automatic you'll need to switch to something like this nutonian.com/products/eureqa Dec 15, 2014 at 15:52