Statistical Moment
moment.RdComputes the (optionally centered and/or absolute) sample moment of a certain order.
Arguments
- x
a numeric vector containing the values whose moment is to be computed.
- order
order of the moment to be computed, the default is to compute the first moment, i.e., the mean.
- center
a logical value indicating whether centered moments are to be computed.
- absolute
a logical value indicating whether absolute moments are to be computed.
- na.rm
a logical value indicating whether
NAvalues should be stripped before the computation proceeds.
Examples
x <- rnorm(100)
## Compute the mean
moment(x)
#> [1] -0.03857036
## Compute the 2nd centered moment (!= var)
moment(x, order=2, center=TRUE)
#> [1] 1.090357
## Compute the 3rd absolute centered moment
moment(x, order=3, center=TRUE, absolute=TRUE)
#> [1] 1.871141