I have the following two sets of data, which show the dependencies of two quantities, namely, $S$ and $B$, on time ($0$ h, $3$ h, $6$ h, $9$ h, $15$ h, $18$ h, $21$ h, and $24$ h):
Sdata = {{0, 9.74},{3, 4.92},{6, 8.29},{9, 5.54},{15, 2.08},{18, 1.38},{21, 1.99},{24, 0.893}};
Bdata = {{0, 0.915094},{3, 0.736097},{6, 0.793694},{9, 0.833664},{15, 1},{18, 0.99578},{21, 0.897964},{24, 0.214499}};
I have modeled the dynamics of the above system by a coupled ODE system:
$$\frac{dS(t)}{dt} = - \frac{a}{1 + B(t)} S(t),$$
$$\frac{dB(t)}{dt} = \frac{c}{1 + S(t)} B(t) - d B^2(t) \Big( \frac{1 - B(t)}{B(t)} \Big)^n,$$
where $a$, $c$, $d$, and $n$ are constants to be determined from the data.
Using Mathematica for fitting, we obtain:
Sdata = {{0, 9.74}, {3, 4.92}, {6, 8.29}, {9, 5.54}, {15, 2.08}, {18,
1.38}, {21, 1.99}, {24, 0.893}};
Bdata = {{0, 0.915094}, {3, 0.736097}, {6, 0.793694}, {9,
0.833664}, {15, 1}, {18, 0.99578}, {21, 0.897964}, {24, 0.214499}};
order = 1;
interpolatedData = {intS,
intB} = {Interpolation[Sdata, InterpolationOrder -> order],
Interpolation[Bdata, InterpolationOrder -> order]};
sys = {S'[t] == -a/(1 + B[t]) S[t],
B'[t] == c B[t]/(1 + S[t]) - d B[t]^2 ((1 - B[t])/B[t])^n};
squareDiffs = MapApply[(#1 - #2)^2 &, sys];
withInt[t_] = squareDiffs /. {S -> intS, B -> intB};
totalSquaredError = Total@Flatten[withInt /@ (Range[0, 24, 3])];
forMin = Join[{totalSquaredError}, restrictions];
restrictions = Thread[{a, c, d, n} > 0];
{resid, bestFitParams} =
NMinimize[forMin, {a, c, d, n}, Method -> "RandomSearch"]
init = {S[0] == Sdata[[1, 2]], B[0] == Bdata[[1, 2]]};
new = Join[sys /. bestFitParams, init];
{sSol[t_], bSol[t_]} = NDSolveValue[new, {S[t], B[t]}, {t, 0, 24}];
lp = ListPlot[Bdata];
p = Plot[bSol[t], {t, 0, 24}, PlotRange -> All];
Show[lp, p]
lpp = ListPlot[Sdata];
pp = Plot[sSol[t], {t, 0, 24}, PlotRange -> All];
Show[lpp, pp]
See here the fitted curves. (Blue points show $S(t)$ data and red points show $B(t)$ data.)
The fitted curve to the red points, i.e., $B(t)$, cannot capture the bump in the data around $t = 15$. I appreciate any insight or hint for how changing my ODE system slightly in order to capture this bump before falling down of the values.
EDIT
The datasets with standard deviations:
SdatawithSD = {{0, Around[9.74, 2.89]}, {3, Around[4.92, 1.65]}, {6,
Around[8.29, 4.04]}, {9, Around[5.54, 2.45]}, {15,
Around[2.08, 1.91]}, {18, Around[1.38, 0.962]}, {21,
Around[1.99, 2.41]}, {24, Around[0.893, 0.359]}};
BdatawithSD = {{0, Around[0.915094, 0.1]}, {3,
Around[0.736097, 0.091668]}, {6, Around[0.793694, 0.082575]}, {9,
Around[0.833664, 0.070242]}, {15, Around[1, 0.002851]}, {18,
Around[0.99578, 0.015591]}, {21, Around[0.897964, 0.04783]}, {24,
Around[0.214499, 0.01231]}};

