0
$\begingroup$

Suppose I have an ODE model and some incomplete time series data

data = {{0,1},{5,6.2},{14,18.4},{28,57.3},{90,105.2},{180,98}}

My question, can I still use NonlinearModelFit[data,model,...] even though the data set is missing the values for $y$.

Here is a toy problem:

T = 180;
soln = ParametricNDSolveValue[{x'[t] == 
r1 x[t] (1 - (x[t] + y[t])/k1), 
y'[t] == r2 y[t] (1 - (x[t] + y[t])/k2), x[0] == y[0] == 1}, {x,y}, {t, T},{r1, k1, r2, k2}];

data = {{0, 1.}, {7, 3.85818}, {14, 13.498}, {28, 65.3818}, {90, 
  90.4873}, {180, 90.4875}};
$\endgroup$
  • $\begingroup$ This question seems to be a duplicate of "Problem using NonlinearModelFit to 2 coupled differential equations". $\endgroup$ – Anton Antonov Aug 9 '18 at 1:42
  • $\begingroup$ You could try NonlinearModelFit[data, X = ParametricNDSolveValue[{x'[t] == r1 x[t] (1 - (x[t] + y[t])/k1), y'[t] == r2 y[t] (1 - (x[t] + y[t])/k2), x[0] == y[0] == 1}, x, {t, T}, {r1, k1, r2, k2}]; X[r1, k1, r2, k2][t], {r1, k1, r2, k2}, t ]. The idea is to only use the x-part of the NDSolve-solution. Unfortunately evaluation takes ~infinite time... Are there additional constraints for the parameter? $\endgroup$ – Ulrich Neumann Aug 9 '18 at 8:18
1
$\begingroup$

The examplary solution idea:

data = Table[{t, Exp[-t]}, {t, Sort[RandomReal[{0, 5}, 10]]}];(*{t,x}*) 

Set of two coupled ode, only x[t] is used to estimate the unknown parameter a:

mod = NonlinearModelFit[data,
X =ParametricNDSolveValue[ {x'[t] == a x[t] z[t] , x[0] == 1,z'[t] == 0, z[0] == 1}, x, {t, 0, 5}, a]  ;
X[a][t], {a} , t ] ;
mod["BestFitParameters"]
(*{a -> -1.} *)
$\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.