different results of Skewness and kurtosis from timDate and Moments packages
let a = c(1:9,1)
, in library(timeDate)
(which is imported in library(fBasics)
too), skewness(a)
= 0.10901 and kurtosis(a)
= -1.634, .
in 开发者_运维问答library(moments)
, skewness(a)
= 0.1277 and kurtosis(a) - 3
= -1.313, which match the results from Matlab.
is this a bug in one of these packages?
There are a number of ways to estimate the population moments. You can compare these different methods using the skewness and kurtosis functions in the e1071 package
> library(e1071)
> skewness(a,,1)
[1] 0.1277249
> skewness(a,,2)
[1] 0.1514631
> skewness(a,,3)
[1] 0.1090534
> kurtosis(a,,1)
[1] -1.313042
> kurtosis(a,,2)
[1] -1.356985
> kurtosis(a,,3)
[1] -1.633564
All of these measures are valid, and unbiased (at least in the case of normality). according to D. N. Joanes and C. A. Gill (1998) (Comparing measures of sample skewness and kurtosis. The Statistician, 47, 183–189.), type 3 performs better in non-normal populations, whereas type 2 performs best in normal looking populations. Type 1 is an older definition.
In large samples the difference between these estimators becomes negligible. see ?skewness for the formulas used.
精彩评论