sample.centralmoments {sn}R Documentation

Sample centralmoments

Description

Computes sample central moments up to a given order and the first moment from the origin

Usage

sample.centralmoments(x, w = rep(1, length(x)), order=4)

Arguments

x a vector of sample values
w an optional vector of weights
order the maximal order of the central moments to be computed; it must be a positive integer (default value 4)

Details

NA's are allowed but removed. Averaging of appropriate quantities is actually performed by weighted.mean

Value

A vector containing the first sample central moments, in position [2:order], and the first moment from the origin, in the first position of the returned vector

Note

The second component of the returned vector (if order>1) gives the sample variance; notice that it differs from the value returned by var(x), since this gives the corrected sample variance.

Used in conjunction with st.cumulants.inversion, this function allows to fit a skew-t distribution by the methods of moments; see the example below.

Author(s)

Adelchi Azzalini

See Also

st.cumulants.inversion, weighted.mean

Examples

data(ais, package='sn')
mom <- sample.centralmoments(ais[,"bmi"])
st.cumulants.inversion(cum=c(mom[1:3], mom[4]-3*mom[2]^2))
# parameters of the fitted ST distribution

[Package sn version 0.4-0 Index]