0
$\begingroup$

With the help of @JimB, I could fit some experimental data with a CDF using NonLinearFitModel. The set of data is the following:

data ={{0.995, 0.142}, {3.003, 0.2}, {5.908, 0.25}, {10.525, 0.36}, {13.617,
  0.498}, {24.321, 0.616}, {33.917, 0.599}, {47.843, 0.7}, {64.172, 
  0.835}, {91.353, 1.102}, {126.745, 1.083}, {174.118, 
  1.225}, {225.059, 1.133}, {292.998, 1.165}, {369.133, 
  1.298}, {640.295, 1.365}, {828.169, 1.298}, {1255.39, 
  1.373}, {1496.61, 1.409}, {1942.79, 1.538}} 

and the suggestion of @JimB (code below) gives as a best fit the following result:

nlm = NonlinearModelFit[data, b CDF[NormalDistribution[c, d], Log10[t]], {b, c, d}, t];

rateOfChange = D[nlm[10^log10t], log10t] /. 10^log10t -> t

enter image description here

I'd like to know if there is a way to fit this data with not only one CDF, but the superposition of two (or, in most precise way, as many CDF as possible to reach te best fit). What I'm attempting to get as result is something like this:

enter image description here

(Obs: These data above are not the same as the fitted data in the first figure. I just posted it as an ilustrative example of what I'm trying to do with my data)

I know that it can be possible with the use of some algorithms as Maximum Likelihood Estimation (MLE) and Gaussian Mixture Model (GMM) to iteratively fit CDFs with the measured data to get the best fit. But I'm pretty new in programming and it have been certainly a challenge for me.

EDIT:

The simple replacement b CDF[NormalDistribution[c, d] to b1 CDF[NormalDistribution[c1, d1] + b2 CDF[NormalDistribution[c2, d2] proposed by @JimB gives as result: enter image description here

The black line represents the sum of both (red and blue) CDFs. The final result doesn't show a good improvement if compared with the case of only one CDF. I'd like to see a more precise fitting when using two CDFs instead of just one

So if someone could help me, I'd be very grateful

Cheers

$\endgroup$
  • $\begingroup$ Just a point of clarification: You are estimating a curve that has the same shape as a Gaussian distribution as opposed to estimating a Gaussian probability density (or CDF) from a random sample. In other words you are performing a regression and the procedures (Gaussian Mixture Model and maximum likelihood estimation from a random sample) associated with estimating the parameters do not apply. $\endgroup$ – JimB Jul 25 at 16:11
  • $\begingroup$ Why not just replace ` b CDF[NormalDistribution[c, d]` with ` b1 CDF[NormalDistribution[c1, d1] + b2 CDF[NormalDistribution[c2, d2]` ? Providing example data would be helpful to provide specific advice. $\endgroup$ – JimB Jul 25 at 16:12
  • $\begingroup$ The data size 20 is too small to make reliable conclusions. Statistics begins from 30 (see google.com.ua/… ). $\endgroup$ – user64494 Jul 25 at 16:32
  • 1
    $\begingroup$ @user64494 Have you read very many of the search results? There is no minimum sample size that applies to some applications of some fields of study even some of the time. A sample of size 2 is a valid sample size. Whether any sample size is adequate (as opposed to "valid") depends on the variability of the samples, objectives of the study, desired levels of precision, how well various assumptions hold, etc. In this forum I have complained multiple times when someone wants to fit a fifth-degree polynomial with just six data points. In short, "It depends." $\endgroup$ – JimB Jul 25 at 17:04
  • $\begingroup$ @JimB, Thanks for the feedback and for the clarification. And yes, what I'm trying to do is to perform a regression and the reason for my insistence in trying to relate this best fit with a CDF is that I want to associate this measured data with a (supposed) random variable that can be described in terms of a probabilistic distribution. In order words, the shape of this curve (which in my approach looks like a -or a set of- CDFs) can be interpreted as a result of the presence of one or more different PDFs. $\endgroup$ – José Augusto Devienne Jul 25 at 17:47
1
$\begingroup$

Given the variability of the data and that you are summing strictly monotonic increasing functions, you're not going to get much of a better fit.

Consider the following 4 models:

nlm1 = NonlinearModelFit[data, b CDF[NormalDistribution[c, d], Log10[t]], {b, c, d}, t];

nlm2 = NonlinearModelFit[data, a + b CDF[NormalDistribution[c, d], Log10[t]], {a, b, c, d}, t];

nlm3 = NonlinearModelFit[data, b1 CDF[NormalDistribution[c1, d1], Log10[t]] + 
  b2 CDF[NormalDistribution[c2, d2], Log10[t]], {b1, c1, d1, b2, c2, d2}, t];

nlm4 = NonlinearModelFit[data, a + b1 CDF[NormalDistribution[c1, d1], Log10[t]] + 
  b2 CDF[NormalDistribution[c2, d2], Log10[t]], {a, b1, c1, d1, b2, c2, d2}, t, MaxIterations -> 10000];

The $AIC_c$ values are

#["AICc"] & /@ {nlm1, nlm2, nlm3, nlm4}
(* {-41.6726, -39.9895, -39.1015, -32.8893} *)

The smallest AICc value is for the first model (single multiple of a Gaussian shape) and the estimated mean square error is

nlm1["EstimatedVariance"]^0.5
(* 0.0704803 *)

$AIC_c$ is a relative measure of fit and suggests that the single Gaussian CDF shape fits at least as well as the other 3 more complicated models.

One needs a specific (and application appropriate) measure of goodness-of-fit rather than a "I'll know it when I see it" approach.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.