Unit 11, lesson 74

Repeated Measures, Clusters and Independence

Why readings that share a device, a person or a classroom are often not independent, and how the intraclass correlation, the design effect, the cluster bootstrap and a random-intercept mixed model account for clustering.

  • Video 74
  • Clustered and Repeated Measurements

Four measurement devices are sampled and each is read three times, which gives twelve numbers. A standard error that treats the twelve readings as twelve independently chosen devices comes out at about 0.720.72 units, and one built from the four device averages comes out at about 1.291.29 units. Both calculations are done correctly, but when the devices were sampled independently and readings on the same device are related, only the second matches how the data were collected. This lesson shows how to find the units that were sampled or assigned independently, how the intraclass correlation and the design effect describe the dependence inside clusters, and how the cluster bootstrap and the random-intercept mixed model respect it.

Key terms

Clusters and repeated measures

Definition A cluster is a group of observations linked through a shared unit or setting, such as the readings taken on one device, the pupils in one classroom or the visits made by one patient. Repeated measures are several measurements of the same variable on the same unit, taken at different times, under different conditions or simply repeated under one protocol, and each unit together with its repeated measures forms a cluster. The sampling unit is the unit that the sampling procedure selects, and the experimental unit is the unit to which a treatment is independently assigned. Either one can be larger than the row that stores a single measurement.

In plain words Before computing any standard error, count two things separately, the rows in the data table and the units that were independently sampled or assigned. Observations in one cluster share something, such as a calibration offset, a teacher or a person’s physiology, so they often resemble each other more than observations from different clusters do. Unless the design or a model justifies it, the rows of one cluster should not be treated as independent pieces of information about the population of clusters.

Example Four devices are sampled independently and each is read three times under the same protocol. The readings below are constructed, in arbitrary measurement units.

DeviceReadingsDevice mean
17, 8, 98
29, 10, 1110
311, 12, 1312
413, 14, 1514

The data have 1212 rows but only 44 sampling units. The target is the population mean of the device averages. Because every device has three readings, the mean of the four device means and the mean of all twelve readings are both 1111.

Pseudoreplication

Definition Pseudoreplication is analyzing observations as independent replicates of the unit an inference is about when they are not. Typical cases are treating repeated readings of a few devices as readings of many different devices, and treating pupils as independent replications of a teaching method that was assigned to whole classrooms. When observations within a cluster are positively correlated, the usual consequence is a standard error that is too small, an interval that is too narrow and a p-value that is too small.

In plain words Repeated measurements are not wasted. They pin down each unit’s own value more precisely and can show changes within a unit. The mistake is to count them as answers to a different question, such as how much device averages vary across the population of devices, or how a method works across many classrooms.

Example For the four devices, treating the device means as an independent sample gives

sdev2=9+1+1+94−1=203,SE⁡^=20/34=53≈1.291.\begin{aligned} s_{\text{dev}}^2 &= \frac{9 + 1 + 1 + 9}{4 - 1} \\[0.4em] &= \frac{20}{3}, \\[0.4em] \widehat{\operatorname{SE}} &= \sqrt{\frac{20/3}{4}} = \sqrt{\frac{5}{3}} \\[0.4em] &\approx 1.291 . \end{aligned}

Treating all twelve readings as independent, the squared deviations of the readings from 1111 add to 6868, so

SE⁡^iid=68/1112=68132≈0.718.\begin{aligned} \widehat{\operatorname{SE}}_{\text{iid}} &= \sqrt{\frac{68/11}{12}} = \sqrt{\frac{68}{132}} \\[0.4em] &\approx 0.718 . \end{aligned}

Both use the same estimate 1111. The row calculation describes a study of twelve independent devices that never took place, and its standard error is only a little more than half of the device-level one. With four devices the device-level standard error is itself a rough estimate, and the ratio between the two numbers belongs to these data, not to clustering in general.

Intraclass correlation

Definition Let YijY_{ij} be observation jj in cluster ii, in a model where every observation has the same variance σY2>0\sigma_Y^2 > 0, observations in different clusters are independent, and every two different observations in the same cluster have the same correlation ρ\rho, a structure called exchangeable or compound symmetry. Then ρ\rho is the intraclass correlation, and for j≠kj \ne k

Cov⁡(Yij,Yik)=ρ σY2.\operatorname{Cov}(Y_{ij}, Y_{ik}) = \rho\,\sigma_Y^2 .

In a cluster of m≥2m \ge 2 observations the correlation must satisfy −1/(m−1)≤ρ≤1-1/(m - 1) \le \rho \le 1. When the dependence has another pattern, such as visits whose correlation weakens as the time between them grows, a single intraclass correlation does not describe it.

In plain words The intraclass correlation measures how much observations from the same cluster resemble each other. If all observations also share the same mean, the expected squared difference between two readings from the same cluster is 2σY2(1−ρ)2\sigma_Y^2(1 - \rho), while for two readings from different clusters it is 2σY22\sigma_Y^2. A positive ρ\rho therefore means that readings from one cluster tend to lie closer together, and ρ=1\rho = 1 means they agree with probability 11. It is a property of a model, estimated from data with uncertainty, and four clusters are far too few to estimate it well.

Example Suppose a model for the devices gives every reading the same mean, variance σY2=4\sigma_Y^2 = 4 squared units and intraclass correlation ρ=0.5\rho = 0.5. Two readings from the same device then have covariance 0.5⋅4=20.5 \cdot 4 = 2 squared units, and their expected squared difference is 2⋅4⋅0.5=42 \cdot 4 \cdot 0.5 = 4 squared units, half the value 88 for readings from two different devices. These values are declared for illustration and are not estimated from the four devices.

Design effect for clustered data

Definition The design effect of an estimator is its variance under the actual design or dependence model divided by its variance under a stated reference, usually independent sampling of the same number of observations. Take kk independent clusters of mm observations each, n=kmn = km in all, with common variance σY2\sigma_Y^2 and intraclass correlation ρ\rho. The sum of one cluster has mm variance terms and m(m−1)m(m - 1) covariance terms, so the overall mean Yˉ\bar{Y} of all nn observations has

Var⁡(Yˉ)=σY2n D,D=1+(m−1)ρ.\begin{gathered} \operatorname{Var}(\bar{Y}) = \frac{\sigma_Y^2}{n}\,D, \\[0.4em] D = 1 + (m - 1)\rho . \end{gathered}

When D>0D > 0 the variance-equivalent effective sample size is neff=n/Dn_{\text{eff}} = n/D, the number of independent observations whose mean would have the same variance.

In plain words The design effect is the factor by which clustering multiplies the variance of the mean compared with independent observations, and the standard error is multiplied by D\sqrt{D}. With one observation per cluster, or with ρ=0\rho = 0, the design effect is 11. With ρ=1\rho = 1 it equals mm and the effective sample size equals kk, the number of clusters. The formula belongs to this balanced model and to the overall mean. Unequal cluster sizes, survey weights and other estimators have design effects of their own, and in general an effective sample size is neither the number of clusters nor a number of degrees of freedom.

Example The device design has m=3m = 3. If ρ=0.5\rho = 0.5, then D=1+2⋅0.5=2D = 1 + 2 \cdot 0.5 = 2, the standard error is 2≈1.41\sqrt{2} \approx 1.41 times the independent value, and the twelve readings are worth neff=12/2=6n_{\text{eff}} = 12/2 = 6 independent readings for estimating the mean. With σY2=4\sigma_Y^2 = 4 the standard error is (4/12)⋅2≈0.816\sqrt{(4/12) \cdot 2} \approx 0.816 units instead of 4/12≈0.577\sqrt{4/12} \approx 0.577. The study still contains only four independent devices, and the value ρ=0.5\rho = 0.5 is an assumption made for this illustration, not a quantity estimated from the data.

Cluster bootstrap

Definition Suppose kk clusters were sampled independently. A cluster bootstrap sample draws kk clusters with replacement from the observed clusters, each draw choosing every cluster with probability 1/k1/k, and keeps all observations of each drawn cluster together. The estimator is recomputed on every bootstrap sample exactly as on the original data, and the standard deviation of these bootstrap estimates is the cluster bootstrap standard error.

In plain words Resample what was sampled independently. Keeping each block whole preserves the dependence inside clusters, while the variation from one bootstrap sample to the next imitates the variation among independently sampled clusters. A cluster drawn twice is its observed block counted twice, not a second physical device. With few clusters the observed ones are a poor stand-in for the population of clusters, and large-sample methods for clustered data, this bootstrap and clustered standard errors among them, need enough independent clusters to behave as intended. Stratified, weighted or blocked designs need resampling schemes that respect those features.

Example Drawing devices 1, 1, 3 and 4 gives device means 8, 8, 12 and 14, so this bootstrap sample has mean

8+8+12+144=10.5.\frac{8 + 8 + 12 + 14}{4} = 10.5 .

Listing all 44=2564^4 = 256 equally likely ordered draws gives the exact bootstrap distribution, whose standard deviation is 5/4≈1.118\sqrt{5/4} \approx 1.118 units. That is smaller than 5/3≈1.291\sqrt{5/3} \approx 1.291 by the factor 3/4\sqrt{3/4}, because the bootstrap treats the four observed device means as the whole population and so divides their squared deviations by 44 instead of 33. Resampling the twelve readings one at a time would give about 0.6870.687 units and would imitate a sampling process of twelve independent readings, which is not how the data were collected.

Random-intercept mixed model

Definition A random-intercept model for clustered data writes observation jj in cluster ii as

Yij=μ+bi+eij,Y_{ij} = \mu + b_i + e_{ij},

where μ\mu is a fixed overall mean, the random intercepts bib_i have mean 00 and variance τ2\tau^2, the errors eije_{ij} have mean 00 and variance σ2\sigma^2, and all the bib_i and eije_{ij} are mutually independent. It is a mixed model because it combines fixed effects, here μ\mu and possibly regression terms for covariates, with the random effects bib_i. The model implies, for j≠kj \ne k,

Var⁡(Yij)=τ2+σ2,Cov⁡(Yij,Yik)=τ2,\begin{gathered} \operatorname{Var}(Y_{ij}) = \tau^2 + \sigma^2, \\[0.4em] \operatorname{Cov}(Y_{ij}, Y_{ik}) = \tau^2 , \end{gathered}

so the intraclass correlation is ρ=τ2/(τ2+σ2)\rho = \tau^2/(\tau^2 + \sigma^2) whenever τ2+σ2>0\tau^2 + \sigma^2 > 0, and the mean of mm observations in one cluster has variance Var⁡(Yˉi)=τ2+σ2/m\operatorname{Var}(\bar{Y}_i) = \tau^2 + \sigma^2/m.

In plain words The model splits the variation into a part shared by a whole cluster and a part that differs from reading to reading. More readings per device shrink only the second part, while more devices shrink both. In this model the intraclass correlation is the share of the total variance that lies between clusters, so it is never negative. Fitting such a model, commonly by maximum likelihood or restricted maximum likelihood with normal random effects and errors, and checking its assumptions go beyond this lesson.

Example Take τ2=2\tau^2 = 2 and σ2=2\sigma^2 = 2 squared units, values declared for illustration rather than fitted. Then ρ=2/4=0.5\rho = 2/4 = 0.5, and a device mean of three readings has variance 2+2/3=8/32 + 2/3 = 8/3. The mean of four such device means has variance (8/3)/4=2/3(8/3)/4 = 2/3, the same value the design effect gives with σY2=4\sigma_Y^2 = 4 and D=2D = 2. With the same total of 24 readings, four devices read six times each give a standard error of (2+2/6)/4≈0.764\sqrt{(2 + 2/6)/4} \approx 0.764 units, while eight devices read three times each give (8/3)/8≈0.577\sqrt{(8/3)/8} \approx 0.577 units. However many readings each of four devices gets, the standard error stays above 2/4≈0.707\sqrt{2/4} \approx 0.707 units.

Check yourself

  1. A cluster bootstrap sample of the four devices selects devices 2, 2, 4 and 4. Find the mean of this bootstrap sample and explain why all three readings of a selected device stay together. How do ten extra readings on device 2 differ from readings on ten extra devices?
Show the answer

The device means are 10, 10, 14 and 14, so the bootstrap mean is 48/4=1248/4 = 12. The devices were sampled independently, while the three readings of one device share its calibration and construction. Keeping each device’s readings together carries that dependence into every bootstrap sample. Drawing twelve readings one at a time would ignore which device each reading came from, and for these data it gives a standard error of about 0.6870.687 units instead of about 1.1181.118. Selecting device 2 twice does not add a new device. It counts that device’s observed block twice.

Ten extra readings on device 2 measure that one device more precisely, which reduces only the reading-to-reading part of the variation in its mean. Readings on ten newly sampled devices add independent clusters, which show more of how device averages vary across the population and shrink both the between-device and the within-device part of the variance of the estimated population mean.

  1. Three schools are sampled, and every pupil in each is tested. School A has 10 pupils with mean score 60, school B has 20 pupils with mean 70 and school C has 70 pupils with mean 80. Compute the mean that weights each school equally and the mean that weights each pupil equally, and say what each one describes.
Show the answer

Weighting schools equally gives

60+70+803=70.\frac{60 + 70 + 80}{3} = 70 .

The school totals are 10⋅60=60010 \cdot 60 = 600, 20⋅70=140020 \cdot 70 = 1400 and 70⋅80=560070 \cdot 80 = 5600, so weighting pupils equally gives

600+1400+5600100=76.\frac{600 + 1400 + 5600}{100} = 76 .

The first describes a typical school, the average of the school means. The second describes a typical pupil in these schools. They differ because the largest school also has the highest mean. Neither is the right answer to every question, so the analysis must first say which target it has in mind. For a population target, how the schools were selected also affects which weights are appropriate. With equal cluster sizes the two means coincide.

  1. A study randomly assigns six classrooms, three to each of two teaching methods, and tests 20 pupils in each classroom. An analyst compares the methods with a two-sample t test on 60 versus 60 pupils. What is the experimental unit, and what is wrong with the analysis? In an exchangeable model with intraclass correlation 0.10.1 within classrooms, find the design effect for each method’s mean and the effective sample size per method. Does that effective sample size give the degrees of freedom?
Show the answer

The experimental unit is the classroom, because the method was assigned to whole classrooms. Pupils in one classroom share the method, the teacher and the room, so they are not independent replications of the method. The pupil-level t test is pseudoreplication, and with positive correlation within classrooms it tends to understate the standard error and the p-value.

With m=20m = 20 and ρ=0.1\rho = 0.1, the design effect is D=1+19⋅0.1=2.9D = 1 + 19 \cdot 0.1 = 2.9. The variance of each method’s mean is 2.92.9 times the value for 60 independent pupils, and the effective sample size is 60/2.9≈20.760/2.9 \approx 20.7 per method.

That number is a variance comparison, not a count of independent units, and it does not give degrees of freedom. Only three classrooms per method were randomized. An analysis of the six classroom means respects the design. A pooled two-sample t procedure on them has 3+3−2=43 + 3 - 2 = 4 degrees of freedom and is exact when the classroom means are independent and normal with a common variance. A randomization test that reassigns the methods to classrooms has only (63)=20\binom{6}{3} = 20 possible assignments, so its one-sided p-value cannot be smaller than 1/20=0.051/20 = 0.05. Six classrooms provide little replication, however many pupils they contain.

How this lesson connects