In this post, we discuss how to calculate the moment coefficient of skewness and also discuss some issues surrounding the notion of skewness.

________________________________________________________________________

**Looking at graphs**

One informal but useful way of checking the skewness of a distribution is to look at the density curve (or a histogram). Consider the following density functions.

The density curve in Figure 1 has a longer tail to the right than to the left. The example in Figure 1 is a distribution that is skewed to the right. It is also said to be positively skewed since its coefficient of skewness is positive. The density curve in Figure 2 has a longer tail to the left than to the right. The example in Figure 2 is a distribution that is skewed to the left. It is also said to be negatively skewed since the skewness coefficient is negative. If a density curve looks the same to the left and to the right (such as the bell curve for the normal distribution), then it is a symmetric distribution and the skewness coefficient is zero.

The distribution in Figure 1 is a right skewed distribution (the longer tail is on the right). It is a gamma distribution with mean 2 and median approximately 1.678347. The mode (the highest peak) is at x = 1. The distribution in Figure 2 is a left skewed distribution (the longer tail is on the left) with mean and median approximately 0.909 and 0.9213562, respectively. The mode is at 0.95.

________________________________________________________________________

**Common conception about skewness**

In the distribution for Figure 1, we can say that “mode < median < mean". In the distribution for Figure 2, we can say that "mean < median < mode". A common conception is that these simple rules characterize all skewed distribution, i.e., the mean is to the right of the median, which in turn is to the right of the mode in a right skewed distribution and that the mean is to the left of the median, which in turn is to the left of the mode in a left skewed distribution. Such rules are certainly easy to remember and are stated in some statistics textbooks. In the above two figures, this rule of thumb is certainly true. It turns out that this rule of thumb does not hold in many instances. The above two graphs are "textbook" demonstrations of skewness. They are gamma distributions and beta distributions and they behave well according to the usual notion of how skewed distributions should look like. In a later section of this post, we will discuss this issue in greater details. First we define the coefficient of skewness.

________________________________________________________________________

**Pearson moment coefficient of skewness**

The measure of skewness defined here is called the Pearson moment coefficient of skewness. This measure provides information about the amount and direction of the departure from symmetry. Its value can be positive or negative, or even undefined. The higher the absolute value of the skewness measure, the more asymmetric the distribution. The skewness measure of symmetric distributions is, or near, zero.

To help put the definition of skewness in context, we first define raw moments and central moments of a random variable . The th raw moment of is , the expected value of the th power of the random variable . The first raw moment is the mean of the random variable and is usually denoted by .

The th central moment of a random variable is , the expected value of the th power of the deviation of the variable from its mean. The moment is usually denoted by . The second central moment is usually called the variance and is denoted by . The square root of , , is the standard deviation.

The ratio of the standard deviation to the mean, , is called the coefficient of variation.

The ratio of the third central moment to the cube of the standard deviation is called Pearson’s moment coefficient of skewness (or the coefficient of skewness) and is denoted by .

The skewness in (1) can be expanded to derive a version that can be calculated more easily:

The last version (3) is in terms of the first raw moment , the second central moment and the third raw moment . Essentially, the coefficient can be obtained via (3) by first computing the first three raw moments.

Even though kurtosis is not the focus of this post, we would like to state it to complete the the brief discussion on moments. The ratio of the fourth central moment to the fourth power of the standard deviation, , is called the kurtosis.

________________________________________________________________________

**Examples**

In this section, we discuss the skewness in two familiar families of continuous distributions – gamma and beta. We also demonstrate how exponentiation can affect skewness.

** Example 1** –

**Gamma Distribution**

The following is the probability density function of the gamma distribution.

where is the gamma function, and and are parameters such that and . The number is the shape parameter and the number here is the rate parameter. Figure 1 shows the gamma distribution with and . When , we obtain the exponential distribution. When and where is a positive integer, we obtain the chi square distribution with degrees of freedom.

Let be a random variable with the above gamma density function. The raw moments , where , are:

Using the first two raw moments to calculate the variance as well as the third moment, the following calculates the moment coefficient of skewness, based on the form in (3):

The above calculation shows that the rate parameter has no effect on skewness. The example in Figure 1 has , giving a coefficient of skewness of = 1.414213562. In general, the gamma distribution is skewed positively. However, the gamma distribution becomes more and more symmetric as the shape parameter . The following graph the gamma densities for and .

In Figure 3, the light blue density with is an exponential distribution. The red one with is the density in Figure 1. With , the gamma density already looks very symmetric (the dark blue).

On the other hand, as the shape parameter , the gamma distribution becomes increasingly positively skewed. When , . When , .

** Example 2** –

**Beta Distribution**

The following is the PDF of a beta distribution:

where is the gamma function, and and are parameters such that and . Both and are shape parameters.

In the beta family of distributions, the skewness can range from positive to negative. If the parameter dominates (i.e. is to a higher power and is to a small power in the density function), then the beta distribution has a negative skew (skewed to the left). This is because the function has left skew and the function has right skew. Then the skewness of the beta distribution follows the one that dominates. If the parameter dominates, the beta distribution is skewed to the right. If both parameters are roughly equal, the beta distribution is close to symmetric. For example when and , the beta distribution is left skewed (its density curve is in Figure 2). As in the gamma case, the skewness of the beta distribution has a close form. The following formula confirms the intuition about the skewness of the beta distribution (found here).

Thus the beta distribution with and has skewness coefficient -1.137431317. The following figure further demonstrates the role of the shape parameters play in changing the skewness of the beta distribution.

In Figure 4, as the parameter goes from 2 to 20, the skewness goes from 1.137431317 to 0.659393193 to 0 to -0.659393193 to -1.137431317.

** Example 3** –

**Exponentiation**

Symmetric distributions have zero coefficient of skewness. Raising a symmetric distribution to a positive power can produce a skewed distribution. For example, let be the standard normal random variable (mean 0 and variance 1). Let . Then has a chi-square distribution with 1 degree of freedom, which means that it is a gamma distribution with and . According to Example 1 above, the skewness coefficient is . Thus squaring a standard normal distribution produces a very strongly positively skewed distribution.

** Example 4** –

**Exponentiation**

When raising a positively skewed distribution to positive power can produce a more strongly positively skewed distribution. For example, let be an exponential random variable. Example 1 shows that exponential distributions have skewness coefficient 2. We show that the coefficient of skewness for is approximately 6.619.

The density function for the exponential random variable is where is the rate parameter. It can be shown that the raw moments of is:

Then the first three moments of are:

With the first two raw moments, calculate the variance of . Then compute via formula (3).

** Example 5** –

**Exponentiation**

Raising a left skewed distribution to a positive power can produce a distribution that is less left skewed. The use of increasing exponents eventually produces a positively skewed distribution. Let be the beta random variable with and . The density function for is where . Using the formula shown in Example 2 above, the coefficient of skewness is

We wish to calculate the coefficient of skewness for . To do that, it will be helpful to have a formula for the raw moments of . It is easy to verify that:

The first three moments of are:

Via formula (3), the following is the coefficient of skewness for .

In this example, squaring the beta distribution with skewness -1.1832 produces a distribution a negatively skewed distribution but with a smaller skew. Let’s raise to higher powers. The following shows the results:

Raising the beta distribution with and to higher powers eventually produces a positively skewed distribution. This is an interesting example, though this observation probably should not be taken as a rule.

________________________________________________________________________

**Counterexamples**

All the examples discussed previously are good “textbook” examples in that they help build intuition on how skewness behaves in familiar distributions. However, it is also easy to take the wrong lessons from these examples. The above examples can serve as good introduction to the topic of skewness. It is also important to attempt to provide a caveat that some of the commonly drawn lessons are not appropriate in all circumstances.

As indicated earlier, one wrong lesson from Figure 1 and Figure 2 is that a density curve such as Figure 1 may suggest that â€œmode < median < mean" for a right skewed distribution and that Figure 2 may suggest that "mean < median < mode" for a left skewed distribution. In both Figure 1 and Figure 2, the mean is further out in the long tail than the median. In certain textbooks, these two observations are even stated as characterizations of right skew and left skew. Such a rule of thumb is easy to state and easy to apply. For some students, such rule provides a lot of clarity about how skewness should work. For such students, checking for skewness is simply a matter of finding the relative position of the mean and median (e.g. in such thinking, if mean is greater than the median, then it is a right skew).

Any discussion of skewness should point out that the simple rule described in the above paragraph, though useful in many situations, is imperfect and may not apply outside of certain familiar distributions. For a good discussion on this issue, see this article.

We highlight one example found in the article mentioned above. This example demonstrates a clear violation of the common misconception indicated above. The following is the density function of the example.

where . To facilitate the discussion, let be the random variable whose PDF is defined above. The above density function is a juxtaposition of a triangular density and an exponential density. This triangular-exponential distribution has positive coefficient of skewness when . Yet within this range for , the mean can be made to be on either side of the median. We consider three cases where , and .

*Example 6*

First the case .

The following is the graph of the density curve . The right tail is long since the exponential distribution is on the right side. However, the left side is heavier (with 70% of the weight on the triangle on the left side).

The following shows the results for the density function .

The calculation confirms the positive skew (0.2845), which is a moderately strong positive skewness. Note that the mean is to the left of the median. Both the mean and median are to the left of the mode (at x = 0). In Figure 5, the right side is infinitely long, thus a positively skewed distribution (and is confirmed by the calculation of ). According to the common notion of how right skew should work, the mean should be further out on the right tail. But this is not the case. The mean is further out on the left side than the median. The violation of the common conception of skewness can occur when one tail is long but the other side is heavier.

*Example 7*

Now the case .

The following is the graph of the density curve . The right tail is long since the exponential distribution is on the right side. The left side is still heavy but a little less heavier than in the previous example (with 60% of the weight on the triangle on the left side).

The following shows the results for the density function .

The density curve has a stronger positive skew than the previous example as there is a little more weight on the exponential side (the right side). Even though the mean in this case is to the right of the median, both the mean and median are not on the right tail but on the left triangular side (the heavier side). In any case, the mean is definitely not further out on the longer tail (the right tail) as the common rule of thumb would suggest.

Both Example 6 and Example 7 are right skewed distributions that do not conform to the common expectation about right skewed distributions. The following example will dispel the notion about the direction of the skew.

*Example 8*

Here we use so that there is a still a long right tail but 90% of the weight is on the other side.

The overall shape of the is similar to Figure 5 and Figure 6. The following shows the results for the density function .

Because there is so little weight on the right tail, the skewness is actually negative (-0.48928). Here we have a right skewed looking distribution that is actually skewed to the left!

________________________________________________________________________

**Remarks**

Examples 5 through 7 demonstrate that when one tail is long but the other side is heavy, the common conception of right skew and left skew do not apply. The common conception, as discussed earlier, is that the both the mean and the median are located in the longer tail and that the mean is further out in the long tail than the median. The article mentioned earlier is easy to read and gives a fuller discussion of the issues when dealing with the notion of skewness. The common conception of skewness can be easily violated in discrete distributions, especially when the weights on both sides of the median are not equal. All the above examples are unimodal distributions. According the quoted article, bimodal or multimodal distributions can be problematic too.

Of course, the caveat presented here is not meant to discourage anyone from discussing the common conception about skewness. The common conception about the locations of mode, mean and median conveys useful intuition and we should continue to focus on it. But the common rule of thumb should definitely be not be presented as gospel truth as some textbooks had done. Instead, it should be pointed out that the common rule of thumb is imperfect and it would be helpful to have a discussion why the rule is imperfect.

________________________________________________________________________

**Practice problems**

Practice problems to reinforce the calculation are found in the companion blog to this blog.

________________________________________________________________________