# Calculating Kurtosis for Groups Containing Fewer Than 4 Observations

Based on some preliminary exploration, here are some interesting observations about kurtosis for when you're calculating kurtosis for groups that have fewer than 4 observations. First, here's the relevant R code.

One_Observation_Groups <- list(1, 3, -100, 0, 1000)
sapply(One_Observation_Groups, function (x) {
y <- sum(((x - mean(x)) / sd(x)) ^ 4)
})
# [1] NA NA NA NA NA

Two_Observation_Groups <- list(c(1, 2), c(4, 4), c(10, 100), c(-1, 20), c(-1000, 0))
sapply(Two_Observation_Groups, function (x) {
y <- sum(((x - mean(x)) / sd(x)) ^ 4)
})
# [1] 0.5 NaN 0.5 0.5 0.5

Three_Observation_Groups <- list(c(1, 2, 3), c(4, 4, 9), c(10, 100, 1000), c(-1, 1, 20), c(-1000, 0, 25))
sapply(Three_Observation_Groups, function (x) {
y <- sum(((x - mean(x)) / sd(x)) ^ 4)
})
# [1] 2 2 2 2 2

Four_Observation_Groups <- list(c(1, 2, 3, 4), c(4, 4, 9, 4), c(10, 100, 1000, 10000), c(-1, 1, 20, -1000), c(-1000, 0, 25, 1000))
sapply(Four_Observation_Groups, function (x) {
y <- sum(((x - mean(x)) / sd(x)) ^ 4)
})
# [1] 3.690000 5.250000 5.195882 5.247908 4.498946


It's obvious to me why kurtosis is undefined for one observation - the standard deviation is 0 for groups containing only one observation, and the kurtosis formula requires a division by the standard deviation. This reasoning holds for groups containing more than one observation of the standard deviation is 0 - kurtosis will be undefined or these groups as well.

It's not obvious to me why, as long as the standard deviation is nonzero, kurtosis is always 0.5 for groups consisting of 2 observations and 2 for groups consisting of 3 observations. (For groups containing 4 or more observations, kurtosis is no longer constant.)

Does this pattern appear for other (possibly higher-order) moments as well?

On general principles, fixing an integral order $$k \gt 2,$$ we would expect the central standard moment of order $$k$$ of three or more numbers to vary, because after centering the data and standardizing the moment we have used two of the three algebraic degrees of freedom, so that generally there ought to be an algebraic variety of possible values of dimension at least $$3-2 = 1.$$

This does not happen with kurtosis due to an algebraic identity.

### Background

Standardizing a batch of numbers $$(x_1, x_2, \ldots, x_n)$$ re-expresses them as

$$z_i = \frac{x_i - m}{s}$$

where

$$m = \frac{1}{n}\sum_{i=1}^n x_i$$

and

$$s^2 = \frac{1}{n}\sum_{i=1}^n (x_i-\bar x)^2.$$

(Note that the sd function in R does not compute $$s:$$ it returns $$s\sqrt{n/(n-1)}.$$)

This guarantees that the sum of the $$z_i$$ is zero and the sum of their squares is $$n.$$

The standard central moment of order $$k$$ (for any number $$k$$) is the average of the $$k^\text{th}$$ powers of the standardized values,

$$\mu_k(x_1, x_2, \ldots, x_n) = \frac{1}{n}\sum_{i=1}^n z_i^k.$$

### Analysis

Let's focus on $$n=3$$ numbers. To simplify the notation, let $$(x,y,z)$$ be a group of three numbers that have been standardized so that $$x+y+z=0$$ and $$x^2+y^2+z^2=3.$$ Consequently $$z = -(x+y),$$ whence

$$3 = x^2+y^2+z^2 = x^2+y^2+(-x-y)^2 = 2(x^2 + xy + y^2).$$

$$9 = [2(x^2 + xy + y^2)]^2 = 4(x^4 + y^4 + 2x^3y + 2xy^3 + 3x^2y^2),$$

whence

$$x^4 + y^4 + 2x^3y + 2xy^3 + 3x^2y^2 = \frac{9}{4}.$$

Use this to simplify the fourth central standardized moment:

$$\frac{1}{3}(x^4+y^4+z^4) = \frac{1}{3}(x^4 + y^4 + (-x-y)^4) = \frac{2}{3}(x^4 + y^4 + 2x^3y + 2xy^3 + 3x^2y^2) = \frac{2}{3}\frac{9}{4} = \frac{3}{2}.$$

The sum is three times this, but when you use sd instead of $$s$$ in the formula, you are dividing by a further factor of $$\left(\sqrt{3/2}\right)^4.$$ Therefore in your calculations you obtain constant values of

$$\frac{3}{2}\times 3 \div \frac{9}{4} = 2$$

for the sums of the standardized values.

There's nothing so special about the other moments. With $$n=3$$ the other $$\mu_k$$ for $$k = 3, 5, 6, 7, \ldots$$ are non-constant functions of $$y^3-3y.$$ With larger $$n$$ there are just too many degrees of freedom.