This function calculates the estimated variances,
standard deviations, and correlations between the
randomeffects terms in a mixedeffects model, of class
merMod
(linear, generalized or
nonlinear). The withingroup error variance and standard
deviation are also calculated.
1 2 3 4 5 6 7 8 9 10  ## S3 method for class 'merMod'
VarCorr(x, sigma=1, ...)
## S3 method for class 'VarCorr.merMod'
as.data.frame(x, row.names = NULL,
optional = FALSE, order = c("cov.last", "lower.tri"), ...)
## S3 method for class 'VarCorr.merMod'
print(x, digits = max(3, getOption("digits")  2),
comp = "Std.Dev.", formatter = format, ...)

x 
for 
sigma 
an optional numeric value used as a multiplier for the standard deviations. 
digits 
an optional integer value specifying the number of digits 
order 
arrange data frame with variances/standard deviations
first and covariances/correlations last for each random effects
term ( 
row.names, optional 
Ignored: necessary for the

... 
Ignored for the 
comp 
a 
formatter 
a 
The print
method for VarCorr.merMod
objects
has optional arguments digits
(specify digits of
precision for printing) and comp
: the latter is
a character vector with any combination of "Variance"
and "Std.Dev."
, to specify whether variances,
standard deviations, or both should be printed.
An object of class VarCorr.merMod
. The internal
structure of the object is
a list of matrices, one for each random effects grouping
term. For each grouping term, the standard deviations and
correlation matrices for each grouping term are stored as
attributes "stddev"
and "correlation"
,
respectively, of the variancecovariance matrix, and the
residual standard deviation is stored as attribute
"sc"
(for glmer
fits, this attribute stores
the scale parameter of the model).
The as.data.frame
method produces a combined data frame with one
row for each variance or covariance parameter (and a row for the
residual error term where applicable) and the following columns:
grouping factor
first variable
second variable (NA
for variance parameters)
variances or covariances
standard deviations or correlations
This is modeled after VarCorr
from
package nlme, by Jose Pinheiro and Douglas Bates.
lmer
, nlmer
1 2 3 4 5 6 7 8 9  data(Orthodont, package="nlme")
fm1 < lmer(distance ~ age + (ageSubject), data = Orthodont)
(vc < VarCorr(fm1)) ## default print method: standard dev and corr
## both variance and std.dev.
print(vc,comp=c("Variance","Std.Dev."),digits=2)
## variance only
print(vc,comp=c("Variance"))
as.data.frame(vc)
as.data.frame(vc,order="lower.tri")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.