# extrapolation data

I need help to extrapolate these data:

θ = {20.7, 28.62, 32.04};
ω = {5, 6, 7};


using this equation:

θ(ω)=θ(ω⟶∞)+ c /ω^n to know what the values of c and n

I found a result using the below plot:

ListLinePlot[
Transpose[{ω^-4,#}]&/@{θ},
FrameLabel->{"1/\!$$\*SuperscriptBox[\(ω$$, $$4$$]\)","θ"},
Axes->True,
Frame->True,
AxesStyle->Directive[{Bold,25},{Black,25}],
BaseStyle->{FontWeight->Bold,FontSize->14},
PlotRange->All,
PlotMarkers->{"◆",18}
]


But my problem how to obtain the fits using the extrapolation for the above equation using Mathematica.

• I hope your statistics class mentioned that fitting a curve with 3 parameters and 3 data points is crazy and then expecting to be able to extrapolate (let alone interpolate) when there is by definition a perfect fit (i.e., no ability to estimate error) is even crazier.
– JimB
Jan 25, 2020 at 23:56

For such a simple model, you don't need explicit NonlinearModelFit since you can just use the trasformed predictors in LinearModelFit as follows to achieve the desired fit:

ClearAll[fittedFunction];
fittedFunction=LinearModelFit[Transpose@{ω,θ},{1,x^-4},x]["Function"];


Now you can call this function outside your existing domain for extrapolation:

fittedFunction[4]


-1.39249

fittedFunction[8]


33.6831

you can see fit errors:

θ-fittedFunction[ω]


{0.00330966, -0.0110303, 0.00772069}

To just do an extrapolation based on existing edge gradients without using least square technique, just use linear interpolation as follows:

ClearAll[fittedFunction];
fittedFunction=With[{
interpolatedFunction=Interpolation[Transpose@{ω^-4,θ},InterpolationOrder->1]
},
Function[ω,Quiet@interpolatedFunction[ω^-4],Listable]
];


Now you can call this function (like before) outside your existing domain for extrapolation:

fittedFunction[4]


-1.34926

fittedFunction[8]


33.6999

you can see fit errors are zeros since existing gradients are used:

θ-fittedFunction[ω]


{0., 0., 0.}

• Thanks a lot! suppose we don't know what is the value of n, is there a way to know the values of n and c using the extrapolation? Jan 27, 2020 at 5:07
• If you want the n to be determined by the model as well then the situation is non-linear than you can use the NonlinearModelFit[Transpose@{ω,θ},β0+c/x^n,{β0,c,n},x] suggested in the other answer. But since you don't have enough data to allow the degrees of freedom needed for another parameter it won't work! You need at least 4 points. Jan 27, 2020 at 7:34
• another option is to just run model=LinearModelFit[Transpose@{ω,θ},{1,x^-n},x] for different values of n and look at the significance of the x^-n term in the model["ParameterTable"] and overall variance explainability of the model using model["RSquared"]. Jan 27, 2020 at 7:36
• Note the lack of degrees of freedom can be seen in the LinearModelFit as well if you introduce another parameter (coefficient) to be estimated in the model. Since you have insufficient data to allow an additional degree of freedom for the new term, it results in a perfect fit. For example, model=LinearModelFit[Transpose@{ω,θ},{1,1/x,1/x^4},x] will have an model["RSquared"]==1 i.e. perfect fit with no variance unexplained. Jan 27, 2020 at 7:41
• Thank you again! your comments are so useful. Jan 27, 2020 at 20:02

Given n==4 you might try

fit = NonlinearModelFit[ωθ, θ0 + c/ω^4 , {θ0, c, n}, ω]
Normal[fit]
(*36.0214 - 9577.97/ω^4*)


This approach might be extended to although fit n (more data necessary)

• Thank you very much for your help!! Jan 27, 2020 at 20:03