# Why it doesn't plot my fit? (And which function would you suggest to match this data?)

Could you let me know why it doesn't plot the fit? Which function would you recommend to use to match well this data? Thanks for your help.

reVData = {{4000, 0.79}, {10^4, 0.811}, {10^5, 0.849}, {10^6, 0.875}, {10^7, 0.893}, {10^8, 0.907}};
reVDataPlot = ListLogLinearPlot[reVData];
fit = FindFit[reVData, a*b^(c*x), {a, b, c}, x]
Plot[fit, {x, 10^3, 10^8}];
Show[reVDataPlot, fit]


First, FindFit gives rules not a function.

Second, you have to take the logarithm of the x values for this fit.

Here is the corrected code:

reVData = {{4000, 0.79}, {10^4, 0.811}, {10^5, 0.849}, {10^6,
0.875}, {10^7, 0.893}, {10^8, 0.907}};
reVDataPlot = ListLogLinearPlot[reVData, PlotMarkers -> Automatic]
fit = a + b Log[x] + c Log[x]^2 /.
FindFit[reVData, a + b Log[x] + c Log[x]^2, {a, b, c}, x];
plfit = LogLinearPlot[fit, {x, 10^3, 10^8}];
Show[reVDataPlot, plfit]


• Works without logarithm too: Show[{ListPlot[reVData, PlotRange -> All], Plot[fit , {x, 10^3, 10^8}, PlotRange -> All]}, PlotRange -> All] Commented Aug 22, 2023 at 9:38
• Many thanks @DanielHuber. Much appreciate. Commented Aug 22, 2023 at 9:52

One can't expect much with fitting 4 parameters ($$a$$, $$b$$, $$c$$, and $$\sigma$$ (error standard deviation)) with just 6 data points. In such cases one should be suspicious of a "good looking fit" and always consider prediction intervals. (FindFit only gives parameter estimates.)

In this case LinearModelFit works and provides various goodness-of-fit criteria:

reVData = {{4000, 0.79}, {10^4, 0.811}, {10^5, 0.849}, {10^6, 0.875}, {10^7, 0.893}, {10^8, 0.907}};

lmf = LinearModelFit[reVData, {Log[x], Log[x]^2}, x]

Show[ListLogLinearPlot[reVData],
LogLinearPlot[{lmf[x], lmf["MeanPredictionBands"]},
{x, Min[reVData[[All, 1]]], Max[reVData[[All, 1]]]},
PlotStyle -> {Blue, Gray, Gray}]]