
i
i
“K23166” — 2015/1/28 — 9:35 — page 96 — #122
i
i
i
i
i
i
96 CHAPTER 7. REGRESSION GENERALIZATIONS AND MODELING
7.4.1 Linear models with correlated outcomes
Example: 7.10.10
library(nlme)
glsres = gls(y ~ x1 + ... + xk,
correlation=corSymm(form = ~ ordervar | id),
weights=varIdent(form = ~1 | ordervar), ds)
Note: The gls() function supports estimation of generalized least squares regression models
with arbitrary specification of the variance covariance matrix. In addition to a formula
interface for the mean model, the analyst specifies a within-group correlation structure as
well as a description of the within-group heteroscedasticity structure (using the weights ...