The rationale was to try to get a little better estimate of the first derivative when the data isn’t good. InterpolationOrder 3 uses four points to calculate the derivative instead of two points, and some additional smoothing with Method “Spline”.
The graphs below show that nothing can help bad data very much. But if you can imagine a parabola through the points, the blue dots might be a little better. The “RSquared” for the quadratic fit is a little better for the Interpolation[] solution, with the bad data but not with the good data.
The good data actually look like a parabola either way.
The graphs below show that nothing can help bad data very much. But if you can imagine a parabola through the points, the blue dots might be a little better. The “RSquared” for the quadratic fit is a little better for the Interpolation[] solution, with the bad data but not with the good data.
The good data actually look like a parabola either way.
In[]:=
data=deathCases;dataFn=Interpolation[data,Method"Spline"];dataDE={dataFn[#],dataFn'[#]}&/@data[[All,1]];dataDE1=Transpose[{Rest@#,Differences[#]}&@data[[All,2]]];ListPlot[{dataDE,dataDE1}]deModel=kx1-;deNLM=NonlinearModelFit[dataDE,deModel,{k,L},x];deNLM1=NonlinearModelFit[dataDE1,deModel,{k,L},x];
x
L
Out[]=
In[]:=
deNLM@"RSquared"deNLM1@"RSquared"
Out[]=
0.853797
Out[]=
0.778268
In[]:=
data=notHubeiCases;dataFn=Interpolation[data,Method"Spline"];dataDE={dataFn[#],dataFn'[#]}&/@data[[All,1]];dataDE1=Transpose[{Rest@#,Differences[#]}&@data[[All,2]]];ListPlot[{dataDE,dataDE1}]deModel=kx1-;deNLM=NonlinearModelFit[dataDE,deModel,{k,L},x];deNLM1=NonlinearModelFit[dataDE1,deModel,{k,L},x];
x
L
Out[]=
In[]:=
deNLM@"RSquared"deNLM1@"RSquared"
Out[]=
0.966408
Out[]=
0.977219
Centering the differences about the midpoint of the differences may help a little.
In[]:=
data=deathCases;dataFn=Interpolation[data,Method"Spline"];dataDE={dataFn[#],dataFn'[#]}&/@data[[All,1]];dataDE2=Transpose[{Mean/@Partition[data[[All,2]],2,1],Differences[data[[All,2]]]}];ListPlot[{dataDE,dataDE2}]deModel=kx1-;deNLM=NonlinearModelFit[dataDE,deModel,{k,L},x];deNLM2=NonlinearModelFit[dataDE2,deModel,{k,L},x];
x
L
Out[]=
In[]:=
deNLM@"RSquared"deNLM2@"RSquared"
Out[]=
0.853797
Out[]=
0.782479