Calculate skewness using one of three formulas: (1) the traditional Fisher-Pearson coefficient of skewness; (2) the adjusted Fisher-Pearson standardized moment coefficient; (3) the Pearson 2 skewness coefficient. Formulas were taken from Doane & Seward (2011), tools:::Rd_expr_doi("10.1080/10691898.2011.11889611")
skewness(vector =NULL, type ="adjusted")
Arguments
vector: a numeric vector
type: a character string indicating the type of skewness to calculate. If type = "adjusted", the adjusted Fisher-Pearson standardized moment coefficient will be calculated. If type = "traditional", the traditional Fisher-Pearson coefficient of skewness will be calculated. If type = "pearson_2", the Pearson 2 skewness coefficient will be calculated. By default, type = "adjusted".
Returns
a numeric value, i.e., skewness of the given vector
Examples
# calculate the adjusted Fisher-Pearson standardized moment coefficientkim::skewness(c(1,2,3,4,5,10))# calculate the traditional Fisher-Pearson coefficient of skewnesskim::skewness(c(1,2,3,4,5,10), type ="traditional")# compare with skewness from 'moments' packagemoments::skewness(c(1,2,3,4,5,10))# calculate the Pearson 2 skewness coefficientkim::skewness(c(1,2,3,4,5,10), type ="pearson_2")