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 ... ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.