Why the Subject Matters
Methylation measurements from the same person are usually related. A person’s methylation level at a CpG site may be higher or lower than another person’s for stable biological reasons, and measurements taken repeatedly from one person share that background. The analysis must therefore reflect the study design: one row per independent subject is not equivalent to one row per specimen when subjects contribute multiple specimens.
At a particular CpG site, beta values lie on a zero-to-one scale and describe methylation on that scale. A difference of 0.04 is a difference of 0.04 on the zero-to-one scale, equivalent to four percentage points. The interpretation is descriptive of the measured methylation contrast; by itself, it does not establish a causal effect.
Pairing is a design feature, not a special property of a statistical test. When the scientific question is the average change between two measurements, the paired analysis reduces each subject’s observations to one contrast and analyzes those contrasts across subjects. When there are several time points or covariates, a longitudinal model can represent the repeated observations while accounting for subject-level dependence.
Paired Contrasts: Assumptions and Calculation
For a single CpG, let \(d_i\) be the second measurement minus the first for each of \(n\) independent subjects. The paired t procedure estimates the population mean change from the sample mean of the subject-level differences. Its assumptions are that subjects are independent of one another, that the differences are measured comparably across subjects, and that the distribution of differences is approximately normal when \(n\) is small. With larger samples, the t procedure is generally more robust to moderate nonnormality, but extreme outliers in the differences can still dominate the result. The procedure does not require the two measurements within a subject to be independent; their dependence is precisely why the contrast is formed.
The procedure can be understood as a one-sample t analysis of the \(d_i\). The standard error estimates variation in changes across subjects, not variation across the two sets of measurements considered separately.
Worked Example: A Paired Before-and-After Contrast
Suppose, hypothetically, that five subjects have beta values measured before and after an intervention at one CpG. Their after-minus-before differences are \(0.02,\ 0.04,\ 0.01,\ 0.05,\ 0.03\). Assume subjects were sampled independently and the differences are not dominated by an outlier. The paired analysis uses five differences, not ten independent observations.
The sample mean difference is \(\bar{d}=(0.02+0.04+0.01+0.05+0.03)/5=0.030\). Deviations from the mean are \(-0.01,\ 0.01,\ -0.02,\ 0.02,\ 0\), so their squared deviations sum to \(0.001\). Thus \(s_d^2=0.001/(5-1)=0.00025\), \(s_d=0.01581\), and \(SE=0.01581/\sqrt{5}=0.007071\).
The test statistic is \(t=0.030/0.007071=4.243\), with \(df=4\). The two-sided p-value is approximately \(0.01324\). At the 5% significance level, this is evidence that the population mean paired change differs from zero; it is not the probability that the null hypothesis is true.
For a 95% interval, \(t^*_{4}\approx2.776\), giving \(0.030\pm2.776(0.007071)=0.030\pm0.01963\), or approximately \((0.01037,\ 0.04963)\). Under the model, this interval procedure has 95% coverage for the population mean change. In context, the estimated mean increase is 0.030 beta units, or three percentage points, and the interval ranges from about 1.04 to 4.96 percentage points.
Several Time Points and Subject Effects
With more than two time points, a useful starting model at one CpG is \(Y_{ij}=\alpha_i+\beta t_{ij}+\epsilon_{ij}\), where \(Y_{ij}\) is the beta value for subject \(i\) at measurement \(j\), \(t_{ij}\) is time in a specified unit, and \(\alpha_i\) is a subject-specific intercept. The fixed subject effects \(\alpha_i\) allow subjects to have different baseline levels. The coefficient \(\beta\) describes the common mean change per unit time under this linear model.
This model assumes that the time trend is adequately represented by a straight line over the observed period, that residual variation around the subject-specific trajectories is appropriately modeled, and that the subjects are independent. If ordinary least squares inference is used, residuals must also satisfy the corresponding variance and distribution conditions for its standard errors and tests to be reliable. Repeated residuals from one subject may remain correlated; treating them as independent residuals can invalidate standard errors. A model with a specified within-subject covariance structure or an appropriate subject-level analysis is needed when that dependence remains.
A simple alternative, when each subject has enough measurements to estimate a trajectory, is to fit a slope for each subject and test the mean of those slopes. This avoids treating time points as independent units, but it answers a particular question: the average of the subject-specific linear slopes. It can be imprecise when subjects have few measurements or when individual slopes are noisy.
Worked Example: Testing the Mean Subject-Specific Slope
Suppose five hypothetical subjects each have a fitted methylation slope at one CpG, measured in beta units per year: \(0.02,\ 0.04,\ 0.01,\ 0.05,\ 0.03\). Assume subjects are independent, the slopes are approximately normally distributed, and each subject has enough observations for a meaningful slope estimate.
Their mean slope is \(\bar{x}=(0.02+0.04+0.01+0.05+0.03)/5=0.030\) beta units per year. The squared deviations from this mean sum to \(0.001\), so \(s^2=0.001/4=0.00025\) and \(SE=\sqrt{0.00025/5}=0.007071\) beta units per year.
Testing a zero population mean slope gives \(t=0.030/0.007071=4.243\), with \(df=4\) and two-sided \(p\approx0.01324\). The 95% interval is \(0.030\pm2.776(0.007071)\), or approximately \((0.01037,\ 0.04963)\) beta units per year. Under these assumptions, the data support a positive average linear slope. This does not imply that every subject has a positive slope, nor that time itself caused the change.
For a two-time-point design, the fixed-subject model \(Y_{ij}=\alpha_i+\beta I(t_{ij}=2)+\epsilon_{ij}\) expresses the same basic within-subject comparison: \(\beta\) is the common second-minus-first change, while each \(\alpha_i\) absorbs the subject’s stable level. In a more complex longitudinal setting, subject effects and a within-subject covariance model can be combined. The choice should follow the measurement schedule and scientific estimand rather than the number of rows in a file.
Diagnosing Dependence and Choosing an Analysis
A central warning is that the number of specimens is not necessarily the number of independent units. If repeated observations are correlated within a subject, a calculation that counts each observation as independent can make the standard error too small. For illustration, suppose each of \(n\) independent subjects contributes \(m\) observations, each with variance \(\sigma^2\), and any two observations from the same subject have correlation \(\rho\). The variance of the overall mean of the \(nm\) observations is
To see this, the variance of a sum contains \(nm\) individual variance terms and \(n m(m-1)\) within-subject covariance terms. Dividing that sum by \((nm)^2\) gives \(\sigma^2[nm+nm(m-1)\rho]/(nm)^2\), which is the displayed expression. Treating all observations as independent omits the covariance terms and uses only \(\sigma^2/(nm)\). For positive \(\rho\), that understates the variance.
Worked Example: Repeated Visits and Understated Uncertainty
Consider a hypothetical comparison of two groups, with eight independent subjects per group and three methylation visits per subject. Suppose the standard deviation at a visit is \(0.02\) beta units and the within-subject correlation across visits is \(0.80\). For a group mean averaged over subjects and visits, the variance is \(\sigma^2\{1+(m-1)\rho\}/(nm)\). The variance of the difference between the two independent group means is twice this quantity.
If the 24 observations in each group are incorrectly treated as independent, the estimated standard error for the group difference is \(\sqrt{2(0.02^2)/(8\cdot3)}=\sqrt{0.00003333}\approx0.005774\) beta units.
Accounting for the repeated measurements gives \(1+(3-1)(0.80)=2.60\), so the standard error is \(\sqrt{2(0.02^2)(2.60)/(8\cdot3)}=\sqrt{0.00008667}\approx0.009309\) beta units. The independence calculation is smaller by a factor of \(\sqrt{2.60}\approx1.612\). In an actual analysis, the correlation and variance would be estimated or modeled rather than assumed known; the example shows why counting visits as independent replicates can produce overconfident inference.
There are two different mistakes worth separating. Treating repeated visits as independent replicates can understate uncertainty when within-subject correlation is positive. By contrast, analyzing two paired conditions as if they were independent groups ignores the pairing and is not guaranteed to understate uncertainty: with positive within-subject correlation, the paired contrast often has a smaller standard error than the unpaired calculation. The paired method is appropriate because it matches the design and targets the within-subject change, not because every independent-sample calculation necessarily gives a smaller standard error.
Useful diagnostics include checking that subject identifiers correctly link repeated specimens, plotting each subject’s measurements over time, inspecting the distribution of paired differences or fitted residuals, and looking for influential subjects. A plot of subject trajectories can reveal nonlinearity, unequal follow-up, or a small number of subjects driving the apparent trend. If residual spread changes substantially over time, a constant-variance model may be inadequate. If subjects have markedly different trajectories, a single common slope may be a poor summary. These are reasons to reconsider the model, not reasons to discard subjects without a design-based justification.
| Analysis | What it represents | Main caution |
|---|---|---|
| Paired contrast | Mean within-subject change between two measurements | Requires one valid contrast per subject and independent subjects |
| Subject-specific slopes | Mean of individual linear time trends | Can be unstable when each subject has few observations |
| Longitudinal model with subject effects | Time or condition association while accounting for subject baselines | Trend and within-subject covariance assumptions must be checked |
| Independent-sample analysis of all observations | Assumes every observation is an independent unit | Can understate uncertainty when subjects contribute correlated measurements |
The methylation scale also matters. Beta-value differences are easy to interpret in percentage points, but beta values are bounded between zero and one and their variability can depend on their mean. M values, introduced in the earlier material on beta values and M values, can be useful for modeling when values near the boundaries make beta-scale residual assumptions implausible; effects should still be reported in a scale that answers the biological question. Neither scale removes dependence among repeated samples.
At each CpG, a paired or longitudinal model addresses dependence within subjects, not every other source of bias or uncertainty. The design must support the intended interpretation; for example, a pre/post contrast can also reflect changes over time unrelated to an intervention. Covariate adjustment should follow the study design and the earlier material on confounding and covariate choice. Genome-wide analyses also require appropriate handling of many simultaneous tests; a correct repeated-measures model does not by itself address that issue.
Common Mistakes and Practical Limits
- Counting specimens as independent subjects. More rows do not necessarily mean more independent information. Identify the subject-level units and account for within-subject correlation.
- Discarding pairing. Subtracting matched measurements preserves the design and removes stable subject-level differences from the contrast.
- Assuming a paired test is suitable for every repeated design. A paired t test handles two measurements per subject. Several time points, irregular visit schedules, or incomplete follow-up may call for a longitudinal model.
- Interpreting a p-value as the probability of no change. The p-value is calculated under the null model; it is not the probability that the null is true.
- Turning an association into a causal claim. A within-subject change controls stable subject differences, but does not automatically control time-varying confounding, secular trends, or measurement changes.
Every approach has limits. A paired analysis cannot use a subject who lacks one of the two required measurements without additional modeling. Slope analyses may discard useful information and can be sensitive to the number and timing of visits. Longitudinal models use more of the data but require defensible specifications for the time trend and covariance. In all cases, the inferential sample size is driven primarily by the number of independent subjects, not the total number of assay measurements.
Check Your Understanding
Answer each question, then compare with the solutions below.
- Six subjects have two methylation measurements each. What is the sample size for a paired t analysis, and what data values enter that analysis?
- A paired analysis estimates a mean change of \(0.025\) beta units. Express this change in percentage points.
- Each of 10 subjects has four visits, with within-subject correlation \(\rho=0.5\). What is the variance inflation factor relative to treating all visits as independent?
- Why does a subject-specific intercept help in a repeated methylation model, and what does it not establish about causation?
Solutions. (1) The sample size is six independent subjects; the analysis uses six within-subject differences, each second measurement minus first. (2) \(0.025\times100=2.5\) percentage points. (3) The factor is \(1+(4-1)(0.5)=2.5\), so the variance is 2.5 times the independence-based variance (and the standard error is larger by \(\sqrt{2.5}\)). (4) The intercept allows each subject to have a different stable baseline, so the time or condition coefficient is informed by within-subject changes. It does not rule out time-varying confounding or prove that a treatment caused the observed change.