CLsqFit:GetCovar
The GetCovar method returns the covariance between fit coefficients. The covariance measures the degree of relationship between the calculated coefficients. A lower value indicates greater significance in the independence between coefficient values.
nCovar = CLsqFit:GetCovar( nIndex1, nIndex2, nChan* ) nC1, nC2, nC3, nC4 = CLsqFit:GetCovar( nIndex1, nIndex2 ) |
This function returns the covariance between coefficients at two indices, nIndex1 and nIndex2. If multi-channel data has been enabled, then values are returned for all channels unless you specifically specify a channel. The errors of the coefficients can be obtained using GetCoefErr and the coefficients themselves can be obtained using GetCoef.
If using the built-in n-dimensional polynomial basis function with n > 1, then the index of the coefficient must be determined by calculating it from the polynomial dimensions or by using GetPolyCoefIndex.
The following script fits a 2x2 polynomial, then retrieves the covariance between coefficients at 1, 1 and at 2, 2.
|
-- create a CLsqFit object |
|
-- set 2x2 coefficients to fit a warped plane |
|
-- add a point with x = 3, y = 5, z = 5.15 |
|
-- add more points |
|
-- Fit the polynomial |
|
-- fetch the index of the coefficient at 1, 1 |
|
-- fetch the index of the coefficient at 2, 2 |
|
-- fetch the covariance between 1,1 and 2,2 |
|
-- list the covariance |
CLsqFit class, GetCoef, GetCoefErr, SetNumCoefs, GetPolyCoefIndex