# Moments coefficient of skewness using R with examples

In this tutorial, you will learn about what is moment coefficient of skewness and how to calculate moment coefficient of skewness in R.

## Moment Coefficient of Skewness

Skewness is a measure of symmetry. The meaning of skewness is "lack of symmetry". Skewness gives us an idea about the concentration of higher or lower data values around the central value of the data.

Karl Pearson's defined the coefficient of skewness based on moments as

$$\beta_1=\dfrac{m_3^2}{m_2^3}$$

or

$$\gamma_1 = \pm \sqrt{\beta_1}$$.

where

• $m_2=\dfrac{1}{n}\sum_{i=1}^n (x_i-\overline{x})^2$, second sample central moment,
• $m_3=\dfrac{1}{n}\sum_{i=1}^n (x_i-\overline{x})^3$, third sample central moment.

The coefficients $\beta_1$ and $\gamma_1$ are also called moment coefficients of skewness.

To know more about moments, check the tutorial on how to compute raw and central moments using R with examples.

The limitation of $\beta_1$ coefficient of skewness is that, it is always positive.

### Symmetric Distribution

The distribution is symmetric if the third central moment of the distribution is zero, (i.e., $m_3 = 0$).

### Positively Skewed Distrbiution

The distribution is positively skewed if the third central moment of the distribution is positive, (i.e., $m_3 > 0$).

### Negatively Skewed Distrbiution

The distribution is negatively skewed if the third central moment of the distribution is negative, (i.e., $m_3 < 0$).

## Moment Coefficient of Skewness Interpretation

• If $\gamma_1 < 0$, i.e., $m_3 < 0$ then the distribution is negatively skewed.
• If $\gamma_1 = 0$, i.e., $m_3 = 0$ then the distribution is Symmetric or not skewed.
• If $\gamma_1 > 0$, i.e., $m_3 > 0$ then the distribution is positively skewed.

## Moment coefficient of skewness using R

To calculate the moment coefficient of skewness, we need to install the package moments. The function skewness() gives the $\gamma_1$ coefficient for skewness. This function compute the estimators of Pearson's measure of skewness based on moments.

The syntax of the skewness() function is

skewness(x,na,rm=FALSE)

where,

• x : a numeric vector, matrix or data frame
• na.rm : logical value (default FALSE). Should missing values be removed?

## Numerical Problem Moment coefficient of Skewness Using R

### Example 1 : Moment Coefficient of Skewness using R

The following data are the heights, correct to the nearest centimeters, for a group of children:
126, 129, 129, 132, 132, 133, 133, 135, 136, 137,
137, 138, 141, 143, 144, 146, 147, 152, 154, 161
Find Bowley's coefficient of skewness and interprete the result.

# create a data vector
x <- c(126, 129, 129, 132, 132, 133, 133, 135, 136, 137,
137, 138, 141, 143, 144, 146, 147, 152, 154, 161)
hist(x)

From the histogram it is clear that the distribution of height (in cm) is positively skewed.

# load the package
library(moments)
## Compute skewness
skewness(x)
[1] 0.7383226

The $\gamma_1$ coefficient of skewness is 0.7383226. As $\gamma_1 > 0$, the data about height (in cm) is $\text{positively skewed}$.

### Example 2: Moment Coefficient of Skewness using R

Diastolic blood pressure (in mmHg) of a sample of 18 patients admitted to the hospitals are as follows:
65,76,64,73,74,80,71,68,66,
81,79,75,70,62,83,63,77,78.
Find Bowley's coefficient of skewness and interprete the result.

DBP <-c(65,76,64,73,74,80,71,68,66,81,79,75,70,62,83,63,77,78)
hist(DBP)

From the histogram it is clear that the distribution of Diastolic Blood Pressure is positively skewed.

# load the package
library(moments)
## Compute skewness
skewness(DBP)
[1] -0.1331838

The $\gamma_1$ coefficient of skewness is -0.1331838. As $\gamma_1 < 0$, the data about Diastolic Blood Pressure is $\text{negatively skewed}$.

## Endnote

In this tutorial you learned about what is Karl Pearson's coefficient of Skewness and how to calculate Karl Pearson's coefficient using R.