Last chance! 50% off unlimited learning
Sale ends in
moment(x, order=1, center=FALSE, absolute=FALSE, na.rm=FALSE)
NA
values
should be stripped before the computation proceeds.center
and absolute
are both FALSE
, the
moment is simply sum(x ^ order) / length(x)
.mean
,
var
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)
Run the code above in your browser using DataLab