Learn R Programming

nprcgenekeepr (version 3.0.0)

calcKurtosis: Calculate bias-adjusted sample excess kurtosis

Description

Part of the Genetic Value Analysis

Usage

calcKurtosis(x, na.rm = TRUE)

Value

The bias-adjusted sample excess kurtosis, a single number; NA when degenerate (see Details).

Arguments

x

A numeric vector.

na.rm

Logical; remove NA values before computing. Default TRUE.

Details

The bias-adjusted Fisher-Pearson standardized EXCESS kurtosis coefficient, G2 = ((n + 1) * g2 + 6) * (n - 1) / ((n - 2) * (n - 3)), where g2 = m4 / m2^2 - 3 and m2/m4 are the second/fourth central sample moments of x -- the "Method 2" adjustment of Joanes and Gill (1998), the same convention SPSS, SAS, and Excel report by default and the type = 2 option in the e1071 CRAN package. Excess (not raw) kurtosis: a normal distribution reads 0. Positive values indicate heavier tails / a sharper peak than normal; negative, lighter tails / a flatter peak.

Returns NA when na.rm = FALSE and x contains an NA, when x has fewer than 4 non-NA values (n <= 3, the adjustment term divides by (n - 2) * (n - 3)) or has zero variance (all remaining values identical) -- both would otherwise divide by zero.

References

Joanes, D.N. and Gill, C.A. (1998) "Comparing measures of sample skewness and kurtosis." Journal of the Royal Statistical Society: Series D (The Statistician), 47(1), 183-189.

See Also

calcSkewness

Other genetic value analysis: calcA(), calcFE(), calcFEFG(), calcFG(), calcFGSE(), calcGU(), calcGUSE(), calcGeneDiversity(), calcNeSexRatio(), calcNeVariance(), calcRetention(), calcSkewness()

Examples

Run this code
calcKurtosis(c(1, 2, 3, 4, 100)) # 4.986866, heavy-tailed
calcKurtosis(c(1, 2, 3, 4, 5)) # -1.2, flatter than normal

Run the code above in your browser using DataLab