Does the kurtosis calculation in the e1071 package in R need more than 3 values?

211 views Asked by At

When calculating kurtosis using the e1071 package like the following:

x_test <- c(100,98, 4)
kurtosis(x_test)

I always get -2.33 no matter what 3 numbers I pick. With 2 numbers, it's always -2.75. However when using other methods (such as pandas in python), I will get a different kurtosis for each set of values I pick.

Is this an error in the package or am I using this package wrong? Thanks!

1

There are 1 answers

0
dcarlson On BEST ANSWER

If you look at the manual page for the function ?kurtosis, you will see that kurtosis can be defined in different ways. R provides 3 of those:

kurtosis(x_test, type=1)
# [1] -1.5
kurtosis(x_test, type=2)
# Error in kurtosis(x_test, type = 2) : 
#   Need at least 4 complete observations.
kurtosis(x_test, type=3)
# [1] -2.333333