I have a small data set of six points:
data1={{2014.,0.015},{2015.,0.005},{2016.,0.0},{2017.,0.01},{2018.,0.02},{2019.,0.014}};
ListPlot[data1
,Frame->True
,PlotRange->{{2013.,2022.},{-0.01,0.03}}
,PlotStyle->Directive[Orange,PointSize[Large]]
]
giving the following plot
The Mean and Standard Deviation of data1 are
Mean[data1]
StandardDeviation[data1]
{2016.5,0.0106667}
{1.87083, 0.00725718}
The data1 can be transformed to data2, having zero Mean and unit Standard Deviation, by utilizing Standardize[.]
data2=Standardize[data1];
ListPlot[data2
,Frame->True
,PlotRange->{{-2.,2.},{-2.,2.}}
,PlotStyle->Directive[Orange,PointSize[Large]]
]
In any case, LinearModelFit[.] allows to fit a polynomial trough the data
lmFit[data_List,degree_Integer]:=LinearModelFit[data,Table[x^i,{i,degree}],x]
Mathematically, a 5th degree polynomial fits exactly through any six data points. However, trying to fit a polynomial of degree=5 to gives quite different results
lmFitPlot[data_List,degree_Integer,{xmin_,xmax_,ymin_,ymax_}]:=Module[{lmf,ss},
lmf=lmFit[data,degree];
ss=Total[lmf["FitResiduals"]^2]; (* Sum of squared residuals *)
Show[
{Plot[lmf[x],{x,xmin,xmax}
,PlotRange->{{xmin,xmax},{ymin,ymax}}]
,ListPlot[data,PlotStyle->Directive[Orange,PointSize[Large]]]
}
,Frame->True
,FrameLabel->{{"",""},{"Year",Row[{"Sum squared residuals= ",ss}]}}
,ImageSize->Medium
]
]
For data1
lmFitPlot[data1,5,{2013.,2022.,-0.01,0.03}]
gives a very noisy fit
While for data2 the fit is quite decent
lmFitPlot[data2,5,{-2.,2.,-2.,2.}]
This discrepancy is caused by the poor rank of the Design Matrix for data1
MatrixRank[lmFit[data1,5]["DesignMatrix"]]
MatrixRank[lmFit[data2,5]["DesignMatrix"]]
3
6
Since there exists is a straightforward Geometric Transformation between data1 and data2
FindGeometricTransform[data1,data2]
my question is: Does there exist an inverse geometric transformation which transforms the decent linear regression model of data2 back to the original coordinate system of data1?
Wikipedia shows a few interesting transformation examples Geometric transformation
Thanks.
TransformationFunction
you could useInverseFunction
(see documantation ) $\endgroup$y=(A.x+b)/(c.x+1)
$\endgroup$