R: Influence on precision of fixed effects in HLMs
covratio.default
R Documentation
Influence on precision of fixed effects in HLMs
Description
These functions calculate measures of the change in the covariance
matrices for the fixed effects based on the deletetion of an
observation, or group of observations, for a hierarchical
linear model fit using lmer.
Usage
## Default S3 method:
covratio(object, ...)
## Default S3 method:
covtrace(object, ...)
## S3 method for class 'mer'
covratio(object, group = NULL, delete = NULL, ...)
## S3 method for class 'lmerMod'
covratio(object, group = NULL, delete = NULL, ...)
## S3 method for class 'lme'
covratio(object, group = NULL, delete = NULL, ...)
## S3 method for class 'mer'
covtrace(object, group = NULL, delete = NULL, ...)
## S3 method for class 'lmerMod'
covtrace(object, group = NULL, delete = NULL, ...)
## S3 method for class 'lme'
covtrace(object, group = NULL, delete = NULL, ...)
Arguments
object
fitted object of class mer or lmerMod
...
do not use
group
variable used to define the group for which cases will be
deleted. If group = NULL, then individual cases will be deleted.
delete
index of individual cases to be deleted. To delete specific
observations the row number must be specified. To delete higher level
units the group ID and group parameter must be specified.
If delete = NULL then all cases are iteratively deleted.
Details
Both the covariance ratio (covratio) and the covariance trace
(covtrace) measure the change in the covariance matrix
of the fixed effects based on the deletion of a subset of observations.
The key difference is how the variance covariance matrices are compared:
covratio compares the ratio of the determinants while covtrace
compares the trace of the ratio.
Value
If delete = NULL then a vector corresponding to each deleted
observation/group is returned.
If delete is specified then a single value is returned corresponding
to the deleted subset specified.
Christensen, R., Pearson, L., & Johnson, W. (1992)
Case-deletion diagnostics for mixed models. Technometrics, 34(1),
38–45.
Schabenberger, O. (2004) Mixed Model Influence Diagnostics,
in Proceedings of the Twenty-Ninth SAS Users Group International Conference,
SAS Users Group International.
library(lme4)
ss <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
# covratio for individual observations
ss.cr1 <- covratio(ss)
# covratio for subject-level deletion
ss.cr2 <- covratio(ss, group = "Subject")
## Not run:
## A larger example
data(Exam, package = 'mlmRev')
fm <- lmer(normexam ~ standLRT * schavg + (standLRT | school), Exam)
# covratio for individual observations
cr1 <- covratio(fm)
# covratio for school-level deletion
cr2 <- covratio(fm, group = "school")
## End(Not run)
# covtrace for individual observations
ss.ct1 <- covtrace(ss)
# covtrace for subject-level deletion
ss.ct2 <- covtrace(ss, group = "Subject")
## Not run:
## Returning to the larger example
# covtrace for individual observations
ct1 <- covtrace(fm)
# covtrace for school-level deletion
ct2 <- covtrace(fm, group = "school")
## End(Not run)
Results
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/covratio.Rd_%03d_medium.png", width=480, height=480)
> ### Name: covratio.default
> ### Title: Influence on precision of fixed effects in HLMs
> ### Aliases: covratio covratio.default covratio.lme covratio.lmerMod
> ### covratio.mer covtrace covtrace.default covtrace.lme covtrace.lmerMod
> ### covtrace.mer
> ### Keywords: models regression
>
> ### ** Examples
>
> library(lme4)
Loading required package: Matrix
> ss <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
>
> # covratio for individual observations
> ss.cr1 <- covratio(ss)
>
> # covratio for subject-level deletion
> ss.cr2 <- covratio(ss, group = "Subject")
>
> ## Not run:
> ##D ## A larger example
> ##D data(Exam, package = 'mlmRev')
> ##D fm <- lmer(normexam ~ standLRT * schavg + (standLRT | school), Exam)
> ##D
> ##D # covratio for individual observations
> ##D cr1 <- covratio(fm)
> ##D
> ##D # covratio for school-level deletion
> ##D cr2 <- covratio(fm, group = "school")
> ## End(Not run)
> # covtrace for individual observations
> ss.ct1 <- covtrace(ss)
>
> # covtrace for subject-level deletion
> ss.ct2 <- covtrace(ss, group = "Subject")
>
> ## Not run:
> ##D ## Returning to the larger example
> ##D # covtrace for individual observations
> ##D ct1 <- covtrace(fm)
> ##D
> ##D # covtrace for school-level deletion
> ##D ct2 <- covtrace(fm, group = "school")
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>