CStats:SdevClip


The SdevClip method computes the clipped Standard Deviation for the distribution of values in a data sample. Extreme values above the number nHigh of highest values and below nLow lowest values are excluded from the calculation. The sample may be a Lua table or a class object of type CImage, CArray, or CMatrix. For CImage and CMatrix objects, an optional CRect object can be used to define the points used in the calculation.

Syntax

nStdDev = CStats:SdevClip( table, nHigh, nLow )

nStdDev = CStats:SdevClip( CImage, nHigh, nLow )

nStdDev = CStats:SdevClip( CImage, nHigh, nLow, CRect )

nStdDev = CStats:SdevClip( CArray, nHigh, nLow )

nStdDev = CStats:SdevClip( CArray, nHigh, nLow, CRect )

nStdDev = CStats:SdevClip( CMatrix, nHigh, nLow )

where

    table is a lua table containing the data.

    CImage, CArray, and CMatrix are class objects containing the data to measure,

    CRect is a CRect rectangle object that defines the region to measure.

    nHigh and nLow specify the high and low percentiles to reject from the data distrubution, in the range 0 through 100.

    nStdDev is the clipped standard deviation of the data. On failure, 0 is returned.

Examples

Suppose a CImage I and a CRect R exist. The following script returns the clipped standard deviation values inside a rectangle on the image:

S = CStats:new()

-- create a CStats object

H = 4 ; L = 5

-- specify the upper and lower points to clip

std = S:SdevClip( I, H, L, R )

-- calculate the statistic for I and R

Printf("S(%lg,%lg)=%lg\n", H, L, std )

-- list the results

The following script returns the clipped standard deviation for a table of data. The 2 highest values and 1 lowest value are excluded from the calculation:

S = CStats:new()

-- create a CStats object

t = { 4,1,4,2,2.1,5,6.4,2,-1.4,-.5,3,4 }

-- create some data in a table

Printf("mean=%lg\n", S:SdevClip(t,2,1) )

-- list the result

Related Topics

Sdev

SdevValue

SdevClipValue

CStats Class