## The covariance pattern model covariance structure

In the repeated measures example in Section 1.4 the idea of modelling the covariances between observations was introduced. Here, we show how covariance patterns fit into the general mixed models definition using matrix notation. In covariance pattern models the covariance structure of the data is not defined by specifying random effects or coefficients, but by specifying a pattern for the covariance terms directly in the R (or, occasionally, G) matrix. Observations within a chosen blocking variable (e.g. patients) are allowed to be correlated and a pattern for their covariances is specified. This pattern is usually chosen to depend on a variable such as time or the visit number. R will have a block diagonal form and can be written

 ( Ri 0 0 0 0 0 0 0 R2 0 0 0 0 0 0 0 R3 0 0 0 0 0 0 0 R4 0 0 0 0 0 0 0 Rs 0 0 0 0 0 0 0 R6 0 0 0 0 0 0 0 Rz

The submatrices, Ri, are covariance blocks corresponding to the ith blocking effect (the ith patient, say). They have dimension equal to the number of repeated measurements on each patient. The 0 represent matrix blocks of zeros giving zero covariances for observations on different patients. We now give two examples of R matrices using a small hypothetical dataset. We assume that the first three patients in a repeated measures trial attended at the following visits:

 Patient Visit 1 1 1 2 1 3 2 1 2 2 2 3 2 4 3 1 3 2

Then, using patients as the blocking effect, an R matrix where a separate correlation is allowed for each pair of visits (this can be described as a 'general' covariance pattern) is given by

 (-1 \$12 \$13 0 0 0 0 0 0 \$12 \$23 0 0 0 0 0 0 \$13 \$23 -32 0 0 0 0 0 0 0 0 0 -12 \$12 \$13 \$14 0 0 0 0 0 \$12 -2 \$23 \$24 0 0 0 0 0 \$13 \$23 \$34 0 0 0 0 0 \$14 \$24 \$34 -3424 0 0 0 0 0 0 0 0 0 -12 \$12 0 0 0 0 0 0 0 \$12 -22 )

Alternatively, a simpler pattern assuming a constant correlation between each visit pair (known as the 'compound symmetry' pattern) is given by

 -2 p- p- 0 0 0 0 0 0 p- -2 p- 0 0 0 0 0 0 p- p- -2 0 0 0 0 0 0 0 0 0 -2 p- p- p- 0 0 0 0 0 p-2 -2 p- p- 0 0 0 0 0 p-2 p- -2 p- 0 0 0 0 0 p-2 p- p- -2 0 0 0 0 0 0 0 0 0 -2 p-2 0 0 0 0 0 0 0 p- -2

where p = the correlation between observations on the same patient.

Commonly, in the analysis of repeated measures data no random effects are fitted, in which case the variance matrix V = R. Otherwise R is added to ZGZ' to form the full variance matrix for the data, V. Other ways to define covariance patterns in the Rj matrix blocks will be considered in Section 6.2.

### Covariance patterns in the G matrix

It is also possible, although less usual, to fit a covariance pattern in the G matrix so that the random effects are correlated within a blocking effect. For example, consider a repeated measures trial in which each patient is assessed at a number of visits and where several measurements are made at each visit. One may wish to model the correlation between visits, within patients, as well as modelling the correlation between observations at the same visit. To achieve this, it is necessary to specify covariance patterns in the G matrix as well as for the R matrix. We will return to this type of covariance structure in the example given in Section 8.1 (Model 3).