CStats:SdevClipValue


The SdevClipValue method computes the clipped Standard Deviation about a value which is supplied, rather than calculated. 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:SdevClipValue( table, nHigh, nLow, nValue )

nStdDev = CStats:SdevClipValue( CImage, nHigh, nLow, nValue )

nStdDev = CStats:SdevClipValue( CImage, nHigh, nLow, nValue, CRect )

nStdDev = CStats:SdevClipValue( CArray, nHigh, nLow, nValue )

nStdDev = CStats:SdevClipValue( CArray, nHigh, nLow, nValue, CRect )

nStdDev = CStats:SdevClipValue( CMatrix, nHigh, nLow, nValue )

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

    nValue is the value about which to calculate the standard deviation.

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

Examples

Suppose a CImage I and CRect R exist. The following script returns the standard deviation inside the rectangle, calculated relative to a specified value. The 3 highest and 5 lowest values are clipped from the data sample:

S = CStats:new()

-- create a CStats object

std = S:SdevClipValue( I, 3, 5, R )

-- return the standard deviation

Printf("SD=%lg\n", std )

-- list the results

The following script returns the standard deviation of a table, relative to a specified mean value.relative to a specified mean value inside a rectangle on the image:

S = CStats:new()

-- create a CStats object

t = { 0, 1, 12, 3, -4, 5, 6, 6.2, 8.2 }

-- create a table to measure

H = 1 ; L = 1

-- number of high and low clip

m = 2.3

-- set a mean value

std = S:SdevClipValue( t, H, L, m )

-- return the standard deviation

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

-- list the results

Related Topics

Sdev

SdevClip

SdevValue

CStats Class