TransWikia.com

Find Fit error 4P logistic

Mathematica Asked by user76744 on May 3, 2021

I am trying to fit a four parameter logistic curve to my data set. I have the estimated values for each coefficint, but it says the jacobian is not a matrix…

Here is my data:

xydata = {{1000,18},{750,65},{500,67},{200,101},{100,88},{50,91},{25,86},{0,92}}

model = (a1 - a2)/(1 + (x/x0)^p) + a2

FindFit[xydata, model, {{a1, 93}, {a2, -2}, {x0, 800}, {p, 4}}, x]

Any suggestions?
Thanks!

One Answer

There are several (non-Mathematica) issues. You only have 8 data points to estimate 5 parameters (a1, a2, x0, p, and the error variance). The model is essentially overparameterized.

Changing the model to allow for x = 0 and adding in MaxIterations->1000 gets a "result":

xydata = {{1000, 18}, {750, 65}, {500, 67}, {200, 101}, {100, 88}, {50, 91}, {25, 86}, {0, 92}};
model = (a1 - a2)/(1 + If[x == 0, 0, (x/x0)^p]) + a2
ff = FindFit[xydata, model, {{a1, 93}, {a2, -2}, {x0, 800}, {p, 4}}, x, MaxIterations -> 1000]
(* {a1 -> 90.7083, a2 -> -4.19539*10^7, x0 -> 175708., p -> 2.57191} *)

This will give you an equation that will give a plausible fit.

However, you should avoid FindFit as it doesn't give you any diagnostics. Use NonlinearModelFit instead:

nlm = NonlinearModelFit[xydata, model, {{a1, 93}, {a2, -2}, {x0, 800}, {p, 4}}, x, MaxIterations -> 1000];
nlm["BestFitParameters"]
(* {a1 -> 90.7083, a2 -> -4.19539*10^7, x0 -> 175708., p -> 2.57191} *)

Now you can look at some diagnostics:

(* Parameter correlation matrix *)
nlm["CorrelationMatrix"] // MatrixForm

Parameter correlation matrix

(* Rank of parameter covariance matrix *)
MatrixRank[nlm["CovarianceMatrix"]]
(* 2 *)

These diagnostics (and maybe the estimated values of a2 and x0) suggest that you have an overparameterized model. The result reasonably reproduces the data but you certainly shouldn't attempt to interpret the values of the parameters - either their absolute value or sign.

Solutions? (1) Get more data if you can. (2) Don't bet the farm on the results.

Correct answer by JimB on May 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP