CLsqFit:GetRejSigmaHigh CLsqFit:GetRejSigmaLow

CLsqFit:SetRejSigmaLow


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

Syntax

CLsqFit:SetRejSigmaLow( sSigmaLow, nChannel* )

Remarks

This method configures the low 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 below 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 sSigmaLow. The currently assigned value of sSigmaLow may be obtained using GetRejSigmaLow. 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 sSigmaLow.

Example

The example below fits a line to (x,y) pair data which includes 1 point significantly below 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 SetRejSigmaLow method is called with a large value for the low 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, -10 )

-- significantly below 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:SetRejSigmaLow( "10" )

-- set low 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, GetRejSigmaLow, SetRejSigmaHigh, SetRejCycles, SetRejDefault, Rejecting Outliers from the Fit