covratio: Influence on precision of fixed effects in HLMs

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/influence_functions.R

Description

These functions calculate measures of the change in the covariance matrices for the fixed effects based on the deletion of an observation, or group of observations, for a hierarchical linear model fit using lmer.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Default S3 method:
covratio(object, ...)

## Default S3 method:
covtrace(object, ...)

## S3 method for class 'mer'
covratio(object, level = 1, delete = NULL, ...)

## S3 method for class 'lmerMod'
covratio(object, level = 1, delete = NULL, ...)

## S3 method for class 'lme'
covratio(object, level = 1, delete = NULL, ...)

## S3 method for class 'mer'
covtrace(object, level = 1, delete = NULL, ...)

## S3 method for class 'lmerMod'
covtrace(object, level = 1, delete = NULL, ...)

## S3 method for class 'lme'
covtrace(object, level = 1, delete = NULL, ...)

Arguments

object

fitted object of class mer or lmerMod

...

do not use

level

variable used to define the group for which cases will be deleted. If level = 1 (default), 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.

Author(s)

Adam Loy loyad01@gmail.com

References

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.

See Also

leverage.mer, cooks.distance.mer mdffits.mer, rvc.mer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
data(sleepstudy, package = 'lme4')
ss <- lme4::lmer(Reaction ~ Days + (Days | Subject), data = sleepstudy)

# covratio for individual observations
ss.cr1 <- covratio(ss)

# covratio for subject-level deletion
ss.cr2 <- covratio(ss, level = "Subject")

## Not run: 
## A larger example
data(Exam, package = 'mlmRev')
fm <- lme4::lmer(normexam ~ standLRT * schavg + (standLRT | school), data = Exam)

# covratio for individual observations
cr1 <- covratio(fm)

# covratio for school-level deletion
cr2 <- covratio(fm, level = "school")

## End(Not run)

# covtrace for individual observations
ss.ct1 <- covtrace(ss)

# covtrace for subject-level deletion
ss.ct2 <- covtrace(ss, level = "Subject")

## Not run: 
## Returning to the larger example
# covtrace for individual observations
ct1 <- covtrace(fm)

# covtrace for school-level deletion
ct2 <- covtrace(fm, level = "school")

## End(Not run)

HLMdiag documentation built on May 2, 2021, 9:06 a.m.