# Simple shape modelling using the multivariate normal distribution

In this article, we will show how we can build a very simple model of hand shapes by modelling the variation in the length and the span of the hand using a bivariate normal distribution. This article serves two purposes: first it illustrates the concepts we introduced in the previous video using a concrete example. Second, it also introduces many key ideas behind statistical shape models. We conclude this article with a note on degenerate normal distributions, which often occur in shape modelling.

## A simple shape model

In this first, very simplistic example of a shape model, we assume that the shape of a hand can be characterised by only two measurements: the length and the span of the hand (see Figure 1).

^{Figure 1: measurements for the length and the span of a hand shape.}

Our task is to model how these two measurements vary in the family of hand shapes. In this course we always assume that shape variations can be modelled using a normal distribution. Hence, we assume that the random variables and are distributed according to the bivariate normal distribution

In this particular example, this assumption implies that

- it is sensible to think of a mean hand (with average length and average span), around which all plausible hand shapes ‘cluster’;
- it is equally likely for hands to be smaller or larger than this mean;
- we are unlikely to ever observe shapes that are much larger or smaller than the mean.

Thinking about it for a while, we see that these are reasonable assumptions for the length and span of the hand (and indeed for many other anatomical measurements). Our intuition is confirmed by looking at some data. We have compiled a set of measurements of the hand length and span of 72 students. A scatterplot of these measurements is shown in Figure 2. We see that most measurements concentrate around a size of 19 cm for the length and 20 cm for the span.

^{Figure 2: scatterplot showing measurements of the hand span and length of 72 students. }

## Estimating the parameters from data

Once we have chosen the form of the model, we need to define the parameters. While we are in principle free to specify the model parameters based on prior knowledge about the anatomy, a more principled approach is to estimate the parameters from the given data. We use again the measurements shown in Figure 2. Let

denote the set of measurements.

We can estimate the mean and covariance matrix from using the following standard formulas for the sample mean

and the sample covariance

Using the data shown in Figure 2 to estimate these parameters, we obtain the *statistical shape model* defined by the following bivariate normal distribution:

## Using the model to reason about shapes

We can now use this model for exploring the shape family and reasoning about individual shapes.
First, we can directly read off from the distribution that the corresponding *marginal distribution* for the length alone is and for the span we have . Not surprisingly, the variation of the span is larger than the variation in length (this is due to the fact that people spread the fingers differently when taking the measurement). From the joint distribution we also see that the span and the length are correlated, with a correlation of . Assume that we are only given the measurement of the span. The correlation in the distribution allows us to predict from this measurement the likely values for the length, by computing the *conditional distribution* . Assume that we observe a span of 24. The conditional distribution is . Thus the most likely length is 20.7. By looking at the variance, we also see that we still have a relatively large uncertainty for this prediction.

Finally, we can use the density function to compute how likely a given observation is by evaluating its density function . This allows us for example to conclude that observing a hand of length 20 and span 18 is less likely () than observing a hand with length 19 and span 21 (). Being able to quantify the likelihood of every shape also gives us the possibility to identify which shapes are unlikely to belong to the modelled shape family.

## Degenerate normal distributions

When we define more complex shape models, we usually have many more random variables than we have measurements from which we can estimate the parameters of the mean and covariance matrix. Using the above formula to estimate the covariance matrix results in this case in a covariance matrix which is only *positive semi-definite*. While it is still possible to define a valid multivariate normal distribution using a positive semi-definite covariance matrix, the density cannot be defined. The distribution is referred to as a degenerate multivariate normal distribution. We will see later in the course that we can still define a valid density, if we restrict ourselves to a relevant subspace where the distribution is supported.

© University of Basel