[R] Extracting labels for residuals from lme
Jonathan Williams
jonathan.williams at pharmacology.oxford.ac.uk
Tue Apr 27 19:06:03 CEST 2004
Dear R-helpers,
I want to try to extract residuals from a multi-level
linear mixed effects model, to correlate with another
variable. I need to know which residuals relate to
which experimental units in the lme. I can show the
labels that relate to the experimental units via the
command
ranef(fit0)$resid
which gives:
604/1/0 -1.276971e-05
604/1/1 -1.078644e-03
606/1/0 -7.391706e-03
606/1/1 8.371521e-03
610/1/0 -6.361077e-03
610/1/1 -1.090040e-03
646/1/0 -1.696881e-03
646/1/1 -6.396153e-03
But, I cannot figure out how to access the labels for
each row in this table. names(unlist(ranef(fit0)[3]))
and labels(unlist(ranef(fit0)[3])) both give the result
"side.(Intercept)xxx" where xxx is simply the row number
of the data frame in the lme. I want to be able to access
the unit identities (604, 606, 610 and 646 in the above
table). Could someone tell me how to get them?
Many thanks, in advance,
Jonathan Williams
OPTIMA
Radcliffe Infirmary
Woodstock Road
OXFORD OX2 6HE
Tel +1865 (2)24356
PS, I am using R 1.9.0 on a Windows NT platform
(though I don't suppose it makes any difference).
More information about the R-help
mailing list