This function calculates reduced dimensional rotated random effects.
The rotation reduces the influence of the residuals from other levels
of the model so that distributional assessment of the resulting
random effects is possible.
Usage
## Default S3 method:
rotate_ranef(.mod, ...)
## S3 method for class 'mer'
rotate_ranef(.mod, .L, s = NULL, .varimax = FALSE, ...)
## S3 method for class 'lmerMod'
rotate_ranef(.mod, .L, s = NULL, .varimax = FALSE, ...)
## S3 method for class 'lme'
rotate_ranef(.mod, .L, s = NULL, .varimax = FALSE, ...)
Arguments
.mod
an object of class mer or lmerMod.
...
do not use
.L
a matrix defining which combination of random effects are of interest.
s
the dimension of the subspace of interest.
.varimax
if .varimax = TRUE than the raw varimax rotation
will be applied to the resulting rotation.
Loy, A. & Hofmann, H. (in press). Are you Normal?
The Problem of Confounded Residual Structures in Hierarchical Linear Models.
Journal of Computational and Graphical Statistics.
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(HLMdiag)
Attaching package: 'HLMdiag'
The following object is masked from 'package:stats':
covratio
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/HLMdiag/rotate_ranef.mer.Rd_%03d_medium.png", width=480, height=480)
> ### Name: rotate_ranef.default
> ### Title: Calculate s-dimensional rotated random effects
> ### Aliases: rotate_ranef rotate_ranef.default rotate_ranef.lme
> ### rotate_ranef.lmerMod rotate_ranef.mer
>
> ### ** Examples
>
> library(lme4)
Loading required package: Matrix
> fm <- lmer(log.radon ~ basement + uranium + (basement | county), data = radon)
>
> ngrps <- summary(fm)$ngrps
> L.b0 <- kronecker(Diagonal(ngrps), c(1, 0))
> L.b1 <- kronecker(Diagonal(ngrps), c(0, 1))
>
> b0.rot <- rotate_ranef(.mod = fm, .L = L.b0, s = 65, .varimax = TRUE)
Note: method with signature 'diagonalMatrix#Matrix' chosen for function 'kronecker',
target signature 'ddiMatrix#dgCMatrix'.
"ANY#sparseMatrix" would also be valid
Note: method with signature 'dsparseMatrix#dsparseMatrix' chosen for function 'kronecker',
target signature 'dtTMatrix#dgCMatrix'.
"TsparseMatrix#sparseMatrix" would also be valid
> qqnorm(b0.rot)
>
> b1.rot <- rotate_ranef(.mod = fm, .L = L.b1, s = 65, .varimax = TRUE)
> qqnorm(b1.rot)
>
>
>
>
>
> dev.off()
null device
1
>