# Nonlinearfit with incomplete data

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 == y == 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}};

• This question seems to be a duplicate of "Problem using NonlinearModelFit to 2 coupled differential equations". – Anton Antonov Aug 9 '18 at 1:42
• 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 == y == 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? – Ulrich Neumann Aug 9 '18 at 8:18

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