CLsqFit:SetRejDefault CLsqFit:GetRejSigmaHigh

CLsqFit:SetRejSigmaHigh


The SetRejSigmaHigh method sets the high sigma clipping parameter for rejecting outlying data far above the fit. This parameter is a string that specifies a list of k values for iterative k-sigma clipping.

Syntax

CLsqFit:SetRejSigmaHigh( sSigmaHigh, nChannel* )

Remarks

This method configures the high clipping parameter for use when data rejection is enabled by calling DoRejection. Here, "sigma" corresponds to the standard deviation of the fit (see GetSigmaFit). Points having residuals further than k-sigmas above the fit will be discarded and the fit then recomputed in an iterative process. This method specifies the list of k values as the comma-separated string sSigmaHigh. The currently assigned value of sSigmaHigh may be obtained using GetRejSigmaHigh. See Rejecting Outliers from the Fit for a detailed description of this parameter.

If the nChannel parameter is absent, all channels are assigned the same value of sSigmaHigh.

Example

The example below fits a line to (x,y) pair data which includes 1 point significantly above the trend. Without data rejection, the bad point is included in the fit and the standard deviation is high. Data rejection is then enabled (with default rejection parameters) and the fit rejects the outlying point, giving a significantly lower standard deviation. Finally, the SetRejSigmaHigh method is called with a large value for the high rejection threshold. Although data rejection is still enabled, the outlier is not rejected because it does not exceed the larger rejection threshold.

L = CLsqFit:new()

-- create a CLsqFit object

L:SetNumCoefs( 2 )

-- set 2 coefficients to fit a line

L:AddPt( -3, -1 )

-- add data points

L:AddPt( 4, 12 )

 

L:AddPt( -1, 3 )

 

L:AddPt( 5, 100 )

-- significantly above the trend

L:AddPt( 6, 16.5 )

 

L:AddPt( 12, 29 )

 

L:AddPt( 3, 10.7 )

 

L:AddPt( 5, 15.3 )

 

L:AddPt( 2, 9.3 )

 

L:AddPt( 8, 20.8 )

 

L:AddPt( 4, 12.7 )

 

L:AddPt( 5, 15.3 )

 

L:AddPt( 3, 11.3 )

 

L:AddPt( 11, 27.1 )

 

L:Fit()

-- Fit the polynomial

sd = L:GetSigmaFit()

-- standard deviation of the fit

n = L:GetNumPtsUsed()

-- how many points used in the fit?

Printf( "sd(%d) = %lg\n", n, sd )

-- result: sd(10) = 6.93996

 

 

L:DoRejection()

-- enable data rejection with default parameters

L:Fit()

-- re-do the fit using data rejection

sd = L:GetSigmaFit()

-- standard deviation of the fit

n = L:GetNumPtsUsed()

-- how many points used in the fit?

Printf( "sd(%d) = %lg\n", n, sd )

-- result: sd(9) = 0.40018

 

 

L:SetRejSigmaHigh( "10" )

-- set high clipping to 10 sigmas

L:Fit()

-- re-do the fit using data rejection

sd = L:GetSigmaFit()

-- standard deviation of the fit

n = L:GetNumPtsUsed()

-- how many points used in the fit?

Printf( "sd(%d) = %lg\n", n, sd )

-- result: sd(10) = 6.93996

Related Topics

CLsqFit class, GetRejSigmaHigh, SetRejSigmaLow, SetRejCycles, SetRejDefault, Rejecting Outliers from the Fit