[R] Extracting elements from an reStruct

Andrew Perrin clists at perrin.socsci.unc.edu
Tue May 20 19:55:19 CEST 2003


Sorry if this is obvious, but my S skills aren't great and I haven't been
able to find it documented anywhere.

I want to write a new function for use with lme objects; the function will
simply calculate an ICC (aka "rho") for each level of a mixed-effects
model.  What I need for this is pretty simple:

(c(var1..varn, residual)) / sum(c(var1..varn, residual))

where var1..varn are the variances of the intercepts of each level's
equation, and residual is the residual variance.  The problem is getting
access to var1..varn (or, as R generally reports it, sd1..sdn)
programmatically.  I can get the residual standard deviation with:

print(model$sigma)

and I can view the standard deviations with:

summary(model$modelStruct$lmeStruct)

But I can't figure out how to get at the standard deviations without the
human-readable print format.

Thanks-
Andy Perrin

----------------------------------------------------------------------
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
clists at perrin.socsci.unc.edu * andrew_perrin (at) unc.edu




More information about the R-help mailing list