Exercise

# Matrix of deviation scores

Why do you need a matrix of means? Because you want a matrix of deviation scores! You are interested in the deviation of an observation for that variable to its mean.

As Prof. Conway showed in the video, the formula to calculate a matrix of deviation scores `D`

is:

$$\begin{aligned} D_{np} &= X_{np} - MM_{np}\end{aligned}$$

where \(D_{np}\) is an n-by-p deviation matrix, \(X_{np}\) the n-by-p raw dataframe, and \(MM_{np}\) the n-by-p matrix of means (the one you calculated in the previous exercise).

Instructions

**100 XP**

- Compute the
**matrix of deviation scores**(`D`

) using the formula above.