Lecture 4 (Chapter 4)
Linear Models for Correlated Data We aim to develop a general linear model framework for longitudinal data, in which the inference we make about the parameters of interest recognize the likely correlation structure of the data. There are two ways of achieving this: 1. To build explicit parametric models of the covariance structure 2. To use methods of inference which are robust to misspecification of the covariance structure
General Linear Models for Correlated Data: Examples Uniform Correlation Model –One-sample repeated measures ANOVA Growth Model Exponential Correlation Model Autoregressive Model of Order 1
A simple example Covariance matrix Correlation matrix
Notation: Balanced Data
Notation: Unbalanced Data Outcome measures on subject “i” repeated ni times 12y white 1 3y white 1 10y white Ex: Values of the covariates for subject “i” in long format Covariance matrix for subject i Regression model for longitudinal data
Notation Vector of responses in the super-population Design matrix Vector of regression coefficients
Notation We assume (i.e. everyone has the same covariance matrix) Covariance matrix of subject i Covariance matrix between subject “j” and subject “k”
Covariates may be:
Covariates may be… (cont’d)
General Linear Model with Correlated Errors Balanced Data Nx1 (Nxp)x(px1)(NxN)
Uniform Correlation Model: Parametric form of the covariance matrix When measurements are equally-spaced and the data are balanced, one assumption is that the correlation between any pair of measurements is always the same (or, “exchangeable”)
Example: Weight of Pigs
Example: Weight of Pigs (cont’d) What do we see? 1.All pigs gain weight over time. 2.The pigs which are the largest at the beginning are the largest at the end. 3.Variance across pigs increases over time. (Increasing variation in the growth rates of the individual pigs.) Figure 3.1. Data on the weights of 48 pigs over a 9- week period.
1.Between: There is heterogeneity between pigs, due for example to natural biological (genetic?) variation (random intercept) 2.Within: There is random variation in the measurement process for a particular unit at any given time. For example, on any given day a particular guinea pig may yield different weight measurements due to differences in scale (equipment) and/or small fluctuations in weight during a day (slope on time) Example: Weight of Pigs For this type of repeated measures study, we recognize two sources of random variation:
A) Linear model with random intercept Variance between units (clusters) Variance within units (measurement error variance) Proportion of total variance due to between units variance Random effect Total variance
Simulated Data: Non-Clustered Cluster Number (units) Repeated measures within a cluster Total variance = 9.8 Variance within = 9.8 Variance between =0 Within cluster correlation = 0
Simulated Data: Clustered Cluster Number (units) Repeated measures within a cluster Total variance = 9.8 Variance within = 3.2 Variance between =6.6 Within cluster correlation = 6.6/9.8=0.67
Model for the mean Model for the covariance matrix B) Marginal Model with a Uniform Correlation Structure nxn (nx1)(1xn)nxn
Models A and B are equivalent Variance between Variance within
Pigs – Independent fit. xtreg weight time, pa i(Id) corr(ind) GEE population-averaged model Number of obs = 432 Group variable: Id Number of groups = 48 Link: identity Obs per group: min = 9 Family: Gaussian avg = 9.0 Correlation: independent max = 9 Wald chi2(1) = Scale parameter: Prob > chi2 = Pearson chi2(432): Deviance = Dispersion (Pearson): Dispersion = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | Independence correlation model results
xtreg weight time, pa i(Id) corr(exch) Iteration 1: tolerance = 5.585e-15 GEE population-averaged model Number of obs = 432 Group variable: Id Number of groups = 48 Link: identity Obs per group: min = 9 Family: Gaussian avg = 9.0 Correlation: exchangeable max = 9 Wald chi2(1) = Scale parameter: Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | “Population Average”, Marginal Model with Exchangeable Correlation structure results Pigs – Marginal Model
Marginal Model E[ Y i ] = β 0 + β 1 time
Pigs – RE model xtreg weight time, re i(Id) mle Random-effects ML regression Number of obs = 432 Group variable (i): Id Number of groups = 48 Random effects u_i ~ Gaussian Obs per group: min = 9 avg = 9.0 max = 9 LR chi2(1) = Log likelihood = Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | /sigma_u | /sigma_e | rho | Linear model with a random intercept - “conditional model” std between std within
Random Effects Model E[ Y i | U i ] = β 0 + β 1 time + U i E[ Y i ] = β 0 + β 1 time
Pigs – GEE Fit. xtgee weight time, i(Id) corr(exch) Iteration 1: tolerance = 5.585e-15 GEE population-averaged model Number of obs = 432 Group variable: Id Number of groups = 48 Link: identity Obs per group: min = 9 Family: Gaussian avg = 9.0 Correlation: exchangeable max = 9 Wald chi2(1) = Scale parameter: Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | GEE fit – Marginal Model with Exchangeable Correlation structure results
Pigs – GEE Fit. xtgee weight time, i(Id) corr(exch). xtcorr Estimated within-Id correlation matrix R: c1 c2 c3 c4 c5 c6 c7 c8 c9 r r r r r r r r r GEE fit – Marginal Model with Exchangeable Correlation structure results
One sample repeated measures ANOVA
One sample repeated measures ANOVA (cont’d)
One group polynomial growth curve model
Cov(Y i ) can be uniform or exponential
Pigs – RE model, quadratic trend. gen timesq = time*time. xtreg weight time timesq, re i(Id) mle Random-effects ML regression Number of obs = 432 Group variable (i): Id Number of groups = 48 Random effects u_i ~ Gaussian Obs per group: min = 9 avg = 9.0 max = 9 LR chi2(2) = Log likelihood = Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | timesq | _cons | /sigma_u | /sigma_e | rho | Exchangeable Correlation structure results
Pigs – Marginal model, quadratic trend. xtgee weight time timesq, i(Id) corr(exch) GEE population-averaged model Number of obs = 432 Group variable: Id Number of groups = 48 Link: identity Obs per group: min = 9 Family: Gaussian avg = 9.0 Correlation: exchangeable max = 9 Wald chi2(2) = Scale parameter: Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | timesq | _cons | Exchangeable Correlation structure results
Exponential Correlation / Autoregressive Model STATA: xtgee corr(ar1) “Auto-correlated Errors”
Autoregressive
Pigs – Marginal model: AR(1) xtgee weight time, i(Id) corr(AR1) t(time) GEE population-averaged model Number of obs = 432 Group and time vars: Id time Number of groups = 48 Link: identity Obs per group: min = 9 Family: Gaussian avg = 9.0 Correlation: AR(1) max = 9 Wald chi2(1) = Scale parameter: Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | GEE-fit Marginal Model with AR1 Correlation structure
Pigs – RE model: AR(1) xtregar weight time RE GLS regression with AR(1) disturbances Number of obs = 432 Group variable (i): Id Number of groups = 48 R-sq: within = Obs per group: min = 9 between = avg = 9.0 overall = max = 9 Wald chi2(2) = corr(u_i, Xb) = 0 (assumed) Prob > chi2 = weight | Coef. Std. Err. z P>|z| [95% Conf. Interval] time | _cons | rho_ar | (estimated autocorrelation coefficient) sigma_u | sigma_e | rho_fov | (fraction of variance due to u_i) theta | Random Effects Model with AR1 Correlation structure
Marginal Model
Important Points Modelling the correlation in longitudinal data is important to be able to obtain correct inferences on regression coefficients β There are correspondences between random effect and marginal models in the linear case because the interpretation of the regression coefficients is the same as that in cross-sectional data Correlation can be formulated in terms of subject-specific models and/or transition models Exchangeable correlation model: subject-specific formulation Exponential correlation model: transition model formulation
(Still More) Important Points Three basic elements of correlation structure: Random effects Autocorrelation or serial dependence Noise, measurement error Incorporating correlation into estimation of regression models is achieved via weighted least squares
(Still More) Important Points There are many ways of estimating correlation parameters. We will study some of these. Correlation models can be approximate We will call these working correlation models (“our best shot”) Regression coefficients estimates will still be correct We will see how to “fix up” standard errors to account for inaccuracies in correlation models