1
$\begingroup$

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.

Thanks in advance!

$\endgroup$
1
  • 3
    $\begingroup$ 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. $\endgroup$ – JimB Jan 25 '20 at 23:56
1
$\begingroup$

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.}

$\endgroup$
5
  • $\begingroup$ 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? $\endgroup$ – Ghady Jan 27 '20 at 5:07
  • $\begingroup$ 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. $\endgroup$ – user13892 Jan 27 '20 at 7:34
  • $\begingroup$ 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"]. $\endgroup$ – user13892 Jan 27 '20 at 7:36
  • $\begingroup$ 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. $\endgroup$ – user13892 Jan 27 '20 at 7:41
  • $\begingroup$ Thank you again! your comments are so useful. $\endgroup$ – Ghady Jan 27 '20 at 20:02
1
$\begingroup$

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)

$\endgroup$
1
  • $\begingroup$ Thank you very much for your help!! $\endgroup$ – Ghady Jan 27 '20 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.