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 )

CLsqFit:SetRejSigmaHigh( sSigmaHigh, nChannel )

bullet.gif    sSigmaHigh is a string giving the sequence of sigmas used for high value rejection. The default is "2.8,2.8,2.8". The string can specify from 1 to many values.

bullet.gif    nChannel an optional parameter which specifies the channel. If omitted, values are set for all channels.

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 = new_lsqfit()

-- 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


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.