[R] where is kurtosis??

Ross Ihaka ihaka at stat.auckland.ac.nz
Sun Mar 9 00:39:07 CET 2003


Shutnik wrote:
>  Dear friends,
>  I try to get started with R and can’t estimate kurtosis of a random sample by using one command.

Its probably worth saying that the point of a computing environment like 
R is that you can easily extend the environment by defining your own 
functions.  In the case of kurtosis you could use something like:

kurtosis <- function(x) {
	x <- x[!is.na(x)]
	sum( (x-mean(x))^4 )/ ((length(x) - 1) * var(x)^2)
}

or

kurtosis <- function(x) {
	x <- x[!is.na(x)]
	sum( (x-mean(x))^4 )/ ((length(x) - 1) * var(x)^2) - 3
}


-- 
Ross Ihaka                         Email:  ihaka at stat.auckland.ac.nz
Department of Statistics           Phone:  (64-9) 373-7599 x 85054
University of Auckland             Fax:    (64-9) 373-7018
Private Bag 92019, Auckland
New Zealand



More information about the R-help mailing list