[R] Writing R code for "moments"
Ben Bolker
bbolker at gmail.com
Fri Oct 8 16:18:39 CEST 2010
July <iowncup <at> gmail.com> writes:
> (1) How can I write R code to compute the moments around zero of order one
> to four?
>
> (2) How can I write R code to compute the moments around the mean of order
> one to four?
Just checking: is this homework? Why do you need to do this?
What is your input: a list of numbers, a function that encodes
a probability distribution, ... ? If the former, there are
existing skew and kurtosis functions out there
(install.packages("sos"); library("sos"); findFn("kurtosis")),
and it's pretty easy to do something like mean(x), mean(x^2),
mean(x^3), mean(x^4) for the non-central moments ...
More information about the R-help
mailing list