moment: Statistical Moment

Description Usage Arguments Details Author(s) See Also Examples

Description

Computes the (optionally centered and/or absolute) sample moment of a certain order.

Usage

1
moment(x, order=1, center=FALSE, absolute=FALSE, na.rm=FALSE)

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 NA values should be stripped before the computation proceeds.

Details

When center and absolute are both FALSE, the moment is simply sum(x ^ order) / length(x).

Author(s)

Kurt Hornik and Friedrich Leisch

See Also

mean, var

Examples

1
2
3
4
5
6
7
8
9
x <- rnorm(100)

## Compute the mean
moment(x)
## Compute the 2nd centered moment (!= var)
moment(x, order=2, center=TRUE)

## Compute the 3rd absolute centered moment
moment(x, order=3, center=TRUE, absolute=TRUE)


Search within the e1071 package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.