CStats:Skewness


The Skewness method computes the skewness parameter for a data sample. 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.

Skewness measures the assymmetry of a sample distribution. A distribution with Skewness=0 is symmetric. Skewness > 0 indicates that the distribution has a larger tail in the positive direction.

Syntax

nSkewness = CStats:Skewness( table )

nSkewness = CStats:Skewness( CImage, )

nSkewness = CStats:Skewness( CImage, CRect )

nSkewness = CStats:Skewness( CArray )

nSkewness = CStats:Skewness( CArray, CRect )

nSkewness = CStats:Skewness( CMatrix )

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.

    nSkewness is the skewness of the data distribution. On failure, 0 is returned.

Examples

The following script computes the skewness parameter for a table of numbers:

S = CStats:new()

-- create a CStats object

t = { 5, 6, 7, 8, 9, 10.5 }

-- create a table to measure

nKurt = S:Skewness(t)

-- returns the Skewness parameter

Printf("Skewness=%lg\n", nKurt)

-- list the result

The following script computes the skewness parameter for a table of numbers:

S = CStats:new()

-- create a CStats object

t = { 5, 6, 7, 8, 9, 10.5 }

-- create a table to measure

Printf("Skewness=%lg\n", S:Skewness(t) )

-- list the result

Related Topics

Kurtosis

Mean

CStats Class