# How to find a formula that models this plot? [duplicate]

This question already has an answer here:

Here is the data that I used to get this plot:

{0., 2.61706*10^-15, 6.94662*10^-9,
1.27056*10^-6, 0.0000197033, 0.000110735, 0.000369473, 0.000907843,
0.00183323, 0.00323707, 0.00519123, 0.00774869, 0.0109459, 0.0148059,
0.0193404, 0.0245531, 0.0304405, 0.0369943, 0.0442024, 0.0520496,
0.0605186, 0.0695905, 0.0792451, 0.0894615, 0.100218, 0.111494,
0.123266, 0.135513, 0.148212, 0.161342, 0.174881, 0.188807, 0.203099,
0.217736, 0.232697, 0.247961, 0.263508, 0.279318, 0.295372, 0.311648,
0.328129, 0.344794, 0.361624, 0.378602, 0.395708, 0.412923, 0.430229,
0.447608, 0.465042, 0.482512, 0.5, 0.517488, 0.534958, 0.552392,
0.569771, 0.587077, 0.604292, 0.621398, 0.638376, 0.655206, 0.671871,
0.688352, 0.704628, 0.720682, 0.736492, 0.752039, 0.767303, 0.782264,
0.796901, 0.811193, 0.825119, 0.838658, 0.851788, 0.864487, 0.876734,
0.888506, 0.899782, 0.910538, 0.920755, 0.93041, 0.939481, 0.94795,
0.955798, 0.963006, 0.96956, 0.975447, 0.98066, 0.985194, 0.989054,
0.992251, 0.994809, 0.996763, 0.998167, 0.999092, 0.999631, 0.999889,
0.99998, 0.999999, 1., 1., 1.}


I've tried using the Fit[] function (as well as several other similar ones, such as FindFit[], NonlinearModelFit[], etc.). The function FindFormula[] also doesn't seem to be working for me.

This data was obtained from the answer to another question I asked here: Mathematica won't evaluate this integral (thanks to user @rmw for pointing out that I should include this).

Many thanks.

## marked as duplicate by Anton Antonov, Community♦May 9 at 14:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• This question is a duplicate of "Exact function that generated the data". The Quantile Regression part of my answer works well for OP's data. (Voting to close.) – Anton Antonov May 9 at 13:56
• @AntonAntonov I notice your answer makes use of the FindFormula function. That doesnt seem to be working for me. Would you have any idea of why that is – Spencer Keller May 9 at 14:03
• Not working for you in what way, @SpencerKeller? – Carl Lange May 9 at 14:03
• Because what you seem to have is a cumulative function that starts at zero and levels off a 1, you might consider fitting the following "transformation" of your data: d=Differences[data]; ListPlot[d]. – JimB May 9 at 14:10
• @Spencer Keller Do not adorn yourself with strange feathers. This data is the answer to your last question. The least that one can expect is a hyperlink to this question to see the connection! – rmw May 9 at 14:46

## 1 Answer

I voted to close as duplicate, but here is the code that produces a good fit function. The number of knots and interpolation order were chosen in order to get a simple piecewise function.

Import["https://raw.githubusercontent.com/antononcube/\
MathematicaForPrediction/master/MonadicProgramming/\
MonadicQuantileRegression.m"];

qFunc = (QRMonUnit[data]⟹
QRMonQuantileRegression[2, 0.5, InterpolationOrder -> 5]⟹
QRMonTakeRegressionFunctions)[0.5];
qFunc[x] // PiecewiseExpand

(* Piecewise[{{0., x > 101 || x < 1},
{-2.9127770125151263*^-10*(-1.3126687232358341*^9 + 1.2871943717684059*^8*x - 5.006740594672578*^6*x^2 + 61658.23677244847*x^3 - 365.5990578684925*x^4 + 1.*x^5),
Inequality[51, Less, x, LessEqual, 101]}, {-2.912777012516119*^-10*(-1.3126687232355044*^9 + 1.2871943717680834*^8*x - 5.006740594671325*^6*x^2 + 61658.236772436394*x^3 - 365.59905786845366*x^4 + 1.*x^5), x == 51}}, 8.16877578309725*^-10*(11721.13368695652 - 10571.645339684148*x - 14233.673466685465*x^2 + 13298.748355372993*x^3 - 215.56319797248383*x^4 + 1.*x^5)] *)

QRMonUnit[data]⟹
QRMonQuantileRegression[2, 0.5, InterpolationOrder -> 5]⟹
QRMonPlot⟹
QRMonErrorPlots["RelativeErrors" -> False];


• Thanks for your help. I noticed that in your other answer you remarked that quantile regression produces less error than FindFormula. Would you consider this difference appreaciable? I've also confirmed this question as a duplicate as to redirect readers to your other answer. – Spencer Keller May 9 at 14:21
• @SpencerKeller If you compute ffFunc = FindFormula[data] and compare the values ffFunc /@ Range[Length[data] - 1] with the corresponding values obtained with Quantile Regression the absolute differences are very small (<0.006). It looks like FindFormula` "neglects" the x-value 101. – Anton Antonov May 9 at 15:11