PreviousTable of ContentsNext


The ReturnCovariance Option

The square root of the diagonal terms of the covariance matrix are the errors in the fitted parameters. LinearFit assumes that the off-diagonal terms of the covariance matrix are small, which means that the correlation between fitted parameters are similarly small.

By setting ReturnCovariance to True, the full covariance matrix is returned so that this assumption can be checked. For example, we fit thermocouple calibration data to a second order polynomial and have the fitter return the covariance matrix by setting the relevant section of the Fit Options screen to look like this:

ReturnCovariance

True
False (default)

Return the full covariance matrix of the fit in a separate window.

The result of the fit is:

A0 = -0.886 ± 0.030
A1 = 0.0352 ± 0.0014
A2 = 0.000060 ± 0.000013
Chi Squared = 1.0066 for 18 Degrees of Freedom
(Chi-squared probability: 100.)
[Graphics:../Images/index_gr_112.gif]

The separate window containing the covariance matrix looks like this:

0.00089074 –0.0000347261 2.82326×10–7
–0.0000347261 1.91298×10–6 –1.78311×10–8
2.82326×10–7 –1.78311×10–8 1.78311×10–10

The (1,1) term, the square of the error in A0, is equal to 0.00089074, which is the largest number in the first row. Similarly, the(2,2) term, the square of the error in A1, is larger than the (2,3) term. So in this case the assumption of LinearFit appears to be reasonable; this will not always be true.

For example, an LRC circuit driven by an AC voltage will have a phase shift theta across the capacitor. If omega is the frequency of the applied voltage and y = Cot[theta], then the theoretical model for this data involves two terms.

[Graphics:../Images/index_gr_118.gif]

We will fit to this, setting ReturnCovariance to True and also setting the UseSignificantFigures option discussed below to False. The main fit results are:

A-1 = -593540. ± 111416.
A1 = 0.00101597 ± 0.000199079

Chi Squared = 2.19143 for 3 Degrees of Freedom
(Chi-squared probability: 53.3638)
[Graphics:../Images/index_gr_120.gif]

and the covariance matrix is:

1.24136 × 1010 –22.0507
-22.0.507 3.96324 ×10–8

Here the off-diagonal terms of the covariance matrix are large. The remainder of this document discusses how to use the full covariance matrix to determine resistance and inductance, including their experimental errors. We will use Mathematica to do the calculations.

The two numbers desired from this experiment are the resistance r and inductance ind of the circuit. The resistance is given symbolically by

[Graphics:../Images/index_gr_124.gif]
[Graphics:../Images/index_gr_125.gif]

Here c = 0.02 uF. Note that we have evaluated this definition with the Mathematica kernel because we will be using it later.

We can evaluate the resistance and its error using the Datum construct supplied by the Experimental Data Analyst package for Mathematica; further details on this construct may be found here.

[Graphics:../Images/index_gr_126.gif]
[Graphics:../Images/index_gr_127.gif]

Here the units are ohms.

The inductance is given here.

[Graphics:../Images/index_gr_128.gif]
[Graphics:../Images/index_gr_129.gif]

Note that the value of ind depends on both a[1] and through r on a[-1].

If the off-diagonal term of the covariance matrix were neglible, we could evaluate the value of the inductance and its error using simple propagation of errors.

[Graphics:../Images/index_gr_130.gif]
[Graphics:../Images/index_gr_131.gif]

The value of the inductance above is correct, but its error is wrong because the off-diagonal term of the covariance is not negligible. We will store the value of the inductance for future use.

[Graphics:../Images/index_gr_132.gif]
[Graphics:../Images/index_gr_133.gif]

Let us rewrite the error in the resistance in terms of the covariance matrix. First, recall the definition of r.

[Graphics:../Images/index_gr_134.gif]
[Graphics:../Images/index_gr_135.gif]

This is its derivative with respect to a[-1]

[Graphics:../Images/index_gr_136.gif]
[Graphics:../Images/index_gr_137.gif]

The value of the derivative can be calculated.

[Graphics:../Images/index_gr_138.gif]
[Graphics:../Images/index_gr_139.gif]

The error in the value of r, then, can be calculated.

[Graphics:../Images/index_gr_140.gif]
[Graphics:../Images/index_gr_141.gif]

Note that this is the value we got before, except the significant figures here have not been adjusted.

We can similarly duplicate the wrong value for the error in the inductance by taking the derivatives of ind with respect to both a[-1] and a[1], squaring each and multiplying by the corresponding diagonal term from the covariance matrix, adding, and taking the square root.

[Graphics:../Images/index_gr_142.gif]
[Graphics:../Images/index_gr_143.gif]

However, when the "cross" term involving the off-diagonal term is added, we get an added term.

[Graphics:../Images/index_gr_144.gif]

We now evaluate this expression.

[Graphics:../Images/index_gr_145.gif]
[Graphics:../Images/index_gr_146.gif]

So we achieve our final result, using an EDA function to adjust the significant figures.  We first calculate the value and error in the inductance, indValue, and then list the value and error in the resistance, rValue.

[Graphics:../Images/index_gr_147.gif]
[Graphics:../Images/index_gr_148.gif]
[Graphics:../Images/index_gr_149.gif]
[Graphics:../Images/index_gr_150.gif]

The units of these are henrys and ohms, respectively.


PreviousTable of ContentsNext


Authors

This help document is Copyright © 1999 David M. Harrison. The sample screens are Copyright © 1999 Solomon R.C. Douglas and David M. Harrison. This is version 1.1 of the help document, date (m/d/y) 11/25/99.