[R] skewness, kurtosis

Andreas Weingessel Andreas.Weingessel at ci.tuwien.ac.at
Wed Jul 28 11:32:55 CEST 1999


>>>>> On Wed, 28 Jul 1999 10:57:25 CET (+0100),
>>>>> Wolfgang Koller (WK) wrote:

WK> Dear R-Users and Developpers,
WK> Currently R does not include functions to compute the skewness and 
WK> kurtosis. I programmed it myself in the following way, but probably 
WK> *real* programmers/statisticians can do that better:

The package e1071 (available at CRAN) contains some statistical
functions we find useful, including our versions of skewness and
kurtosis. (They are more or less the same as your functions, besides
an additional na.rm-flag).

WK> mykurtosis <- function(x) {  
WK> m4 <- mean((x-mean(x))^4) 
WK> kurt <- m4/(sd(x)^4)-3  
WK> kurt
WK> }

WK> myskewness <-  function(x) {
WK> m3 <- mean((x-mean(x))^3)
WK> skew <- m3/(sd(x)^3)
WK> skew
WK> }

-aw

************************************************************************
*                          Andreas Weingessel                          *
************************************************************************
* Institut für Statistik      *               Tel: (+43 1) 58801 10716 *
* Technische Universität Wien *               Fax: (+43 1) 58801 10798 *
* Wiedner Hauptstr. 8-10/1071 *     Andreas.Weingessel at ci.tuwien.ac.at *
* A-1040 Wien, Austria        * http://www.ci.tuwien.ac.at/~weingessel *
************************************************************************

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list