Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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}]
share|improve this question
1  
LinearModelFit[Log10@calibdata, x, x]? –  Kuba Feb 17 at 7:02
add comment

2 Answers

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

share|improve this answer
add comment

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)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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