image thumbnail

skseboot

version 1.0.0 (6.1 KB) by ArchNW
Function to calculate three basic measures for both skewness and kurtosis with standard errors for each measure.

9 Downloads

Updated 11 Jun 2021

View License

This function takes a single input array and calculates three measures for both skewness (g1, G1, b1) and kurtosis (g2, G2, b2). Confidence intervals are calculated for each measure as are standard errors.
Optionally, the function can calculate bootstrap based standard errors with or without associated confidence intervals for each measure.
Inputs:
x – a n by 1 numerical vector
flag (optional) – 0 = no bootstrap standard errors
1 = (default) calculate bootstrap standard errors
2 = calculate bootstrap standard errors with confidence
intervals - Note: This will take time to complete. In
testing using a 200 observation dataset and running on a
current, relatively quick cpu, the skseboot took
approximately 30 seconds to complete.
Outputs:
skewse_out – a cell array of skewness measures and standard errors
kurtse_out – a cell array of kurtosis measures and standard errors
Calculating skewness and kurtosis are basic steps in summarizing and exploring data. However, the exact versions of skewness and kurtosis used in a reported study may (Linares, Coma, Garrabou, Díaz, & Zabala, 2008) or may not (Klimeka, Yegorovb, Hanela, & Thurnera, 2012) be reported. And, in fact, most statistical packages do not make clear which measures are being produced.
Wright & Herrington (2011) define three measures of skewness (g1, G1, b1) and kurtosis (g2, G2, b2). Each of these measures has a corresponding standard error. While Wright and Herrington associate each of these measures with different commercially available statistical software packages, there is no set standard for which measure is used. Nor, having reviewed the technical documentation for several of these software packages, are there standard algorithms for calculating the measures. Part of the impetus for writing this function was to compare these various implementations. The equations used in the final version of this function are based on Wright and Herrington.
There is ongoing debate concerning which measure works best under which conditions. For instance, Joanes and Gill (1998) state that “b1 and b2 gave smaller variances and mean-squared error in normal samples, but SAS’s G1 and G2 have smaller mean-squared error in samples from a very skewed distribution such as the chi-square distributions.” However, for very large samples from a normal distribution, there is very little difference between measures.
Standard errors for skewness and kurtosis are calculated by several statistical packages, although not all and not Matlab. As a general guideline, a ratio of skewness or kurtosis to its respective standard error between -2 and 2 indicate a normal distribution (Sokal & Rohlf 1995). Wright and Herrington point out that this particular method for informally testing sample distribution is problematic. They recommend using a bootstrap method to produce confidence intervals for skewness and kurtosis measures and/or an alternate standard error.
Note that this function uses the “minus 3” convention when calculating kurtosis values.
By default, skseboot uses Matlab's bootci function to calculate confidence intervals. But also note, for n observations less than 10, either no confidence intervals or parametric confidence intervals are calculated. Warnings will be printed alerting the user when alterations to the defaults are triggered.
Works Cited:
Efron, B., & Tibshirani, R. J. (1993). An Introduction to the Bootstrap.
Dordrecht: Springer Science+Business Media.
Joanes, D. N., & Gill, C. A. (1998). Comparing Measures of Sample
Skewness and Kurtosis. Journal of the Royal Statistical Society. Series
D (The Statistician), 41(1), 183-189.
Klimeka, P., Yegorovb, Y., Hanela, R., & Thurnera, S. (2012). Statistical
detection of systematic election irregularities. Proceedings of the
National Acadamy of Science, 109(41), 16469-16473.
Linares, C., Coma, R., Garrabou, J., Díaz, D., & Zabala, M. (2008). Size
distribution, density and disturbance in two Mediterranean gorgonians:
Paramuricea clavata and Eunicella singularis. Journal of Applied
Ecology, 45, 688-699.
Sokal, R., & Rohlf, F.J. (1995) Biometry. The Principles and Practice of
Statistics in Biological Research, 3rd edn. Freeman, New York, New
York.
Wright, D., & Herrington, J. A. (2011). Problematic standard errors and
confidence intervals for skewness and kurtosis. Behavior Research
Methods, 43, 8-17.

Cite As

Gardner-O'Kearny, William (2021). skseboot (https://www.mathworks.com/matlabcentral/fileexchange/<...>), MATLAB Central File Exchange. Retrieved June 11, 2021.

MATLAB Release Compatibility
Created with R2021a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!