5
$\begingroup$

I have a LogLog plot, and i'm unsure about how to fit a line to it. The data represents a calibration curve.

 calibdata = {{1, 39270.4}, {0.01, 4982.57}, {0.001, 1153.55}}
 ListLogLogPlot[calibdata, PlotMarkers -> {Automatic, Medium}]
$\endgroup$
  • 1
    $\begingroup$ LinearModelFit[Log10@calibdata, x, x]? $\endgroup$ – Kuba Feb 17 '14 at 7:02
5
$\begingroup$

There a number of approaches. This is a start (amplifying Kuba's comment):

lm = LinearModelFit[Log10@calibdata, {1, x}, x];
param = lm["ParameterTableEntries"]
coeff = First@Transpose@param
fun[x_] := 10^#1 x^#2 &@@ coeff

The parameters:

{{4.6208, 0.0963769, 47.945, 0.0132762}, {0.501766, 0.046298, 10.8378,
   0.0585751}}

Note the linear relationship is of borderline significance (slope coefficient is second row with p-value as last entry of this row). You can display the formatted table using lm["ParameterTable"].

The coefficient (point estimates):

{4.6208, 0.501766}

The power law fit can be displayed:

fun[a]

yields:

41763.4 a^0.501766

Visualizing fit:

enter image description here

Show[p1, LogLogPlot[fun[x], {x, 0.001, 1}]]

where p1 is original ListogLogPlot.

You can explore other "diagnostics" and standard errors (will need to be back transformed) for prediction bands (try lm["Properties"] or whatever you name you model object and review documentation: LinearModelFit)

$\endgroup$
1
$\begingroup$
calibdata = {{1, 39270.4}, {0.01, 4982.57}, {0.001, 1153.55}};
fit = LinearModelFit[Log10@calibdata, x, x];
% // Normal

4.6208 + 0.501766 x

Plot[Normal@fit, {x, -4, 1}, Axes -> False, Frame -> True, 
                             Epilog -> {PointSize@.02, Point@Log10@calibdata}]

enter image description here

$\endgroup$

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.