# How is kurtosis of a distribution calculated in R

While skew measures if the distribution is left skewed or right skewed, kurtosis measures if the tail is thin or thick.

A tail is thick if the standard distribution is large. For example,

```
> p_kurtosis = data.frame(v=rnorm(1000,mean=100,sd=50))
```

Similarly, if the sd is small ( more tightly packed around the center ), the tail is thin.

```
> n_kurtosis = data.frame(v=rnorm(1000,mean=100,sd=10))
```

Let’s visualize this.

```
ggplot() +
geom_density(data = p_kurtosis,aes(p_kurtosis,fill="red",alpha=0.1)) +
geom_density(data = n_kurtosis, aes(n_kurtosis,fill="green",alpha=0.1))
```

The distribution in green has a thick tail , hence a positive kurtosis. The distribution in red has a relatively think tail and hence a negative kurtosis.

```
> kurtosis(p_kurtosis$v)
[1] 0.1529404
> kurtosis(n_kurtosis$v)
[1] -0.01435051
```

skewness and kurtosis are a bit related. Learn more about how to measure skewness of a distribution in R here.