vcovFPC: 'vcovFPC' Obtain finite-population-adjusted standard errors...

View source: R/vcovFPC.R

vcovFPCR Documentation

vcovFPC Obtain finite-population-adjusted standard errors for fixed effects estimates for a fitted multilevel model

Description

vcovFPC Obtain finite-population-adjusted standard errors for fixed effects estimates for a fitted multilevel model

Usage

vcovFPC(object, ...)

## S3 method for class 'merMod'
vcovFPC(object, popsize2 = NULL, popsize1 = NULL, KR = FALSE)

## S3 method for class 'lme'
vcovFPC(object, popsize2 = NULL, popsize1 = NULL, KR = FALSE)

Arguments

object

an R object of class merMod as resulting from lmer() or an object of class lme resulting from lme().

popsize2

population size at Level-2; if NULL, an infinite Level-2 population is assumed.

popsize1

population size at Level-1; if NULL, an infinite Level-1 population is assumed.

KR

Whether Kenward-Roger approximation of standard errors should be used, which is recommended for small number of clusters and average cluster size. Default to FALSE. Not available for lme objects.

Value

The variance-covariance matrix of the fixed effect estimates, as returned by vcov()

Author(s)

Mark H. C. Lai mark.lai@uc.edu, Oi-man Kwok, Yu-Yu Hsiao, and Quina Cao. Updated by Stephen Tueller Stueller@rti.org for compatibility with nlme for inclusion in PersonAlytics.

References

https://psycnet.apa.org/doiLanding?doi=10.1037

Examples


library(nlme)
library(lme4)

# illustrate equivalence in lme and merMod results with a simple ICT model
mod.lme <- lme(follicles ~ Time*Phase, data = OvaryICT, random = ~ Time | Mare,
               method = 'ML')
mod.merMod <- lmer(follicles ~ Time*Phase + (Time | Mare), data = OvaryICT,
                   REML = FALSE)

tTable.lme <- data.frame( summary(mod.lme)$tTable[,1:2] )
tTable.merMod <- data.frame( coef(summary(mod.merMod))[,1:2] )

fpc.lme <- vcovFPC(mod.lme, popsize2 = 100)
fpc.merMod <- vcovFPC(mod.merMod, popsize2 = 100)

tTable.lme$FPC.Std.Error <- sqrt(diag(fpc.lme))
tTable.merMod$FPC.Std.Error <- sqrt(diag(fpc.merMod))

tTable.lme
tTable.merMod

# now show how the standard errors change whith an autocorrelation structure
mod.lmema2 <- lme(follicles ~ Time*Phase, data = OvaryICT, random = ~ Time | Mare,
               method = 'ML', correlation = corARMA(q=2))
tTable.lmema2 <- data.frame( summary(mod.lmema2)$tTable[,1:2])
fpc.lmema2 <- vcovFPC(mod.lmema2, popsize2 = 100)
tTable.lmema2$FPC.Std.Error <- sqrt(diag(fpc.lmema2))

# including a good fitting autocorrelation structure reduces the standard
# errors relative to an unstructured correlation, and the FPC further
# reduces the standard errors (thought the correlation structure has a
# much bigger impact than the FPC)
tTable.lmema2


ICTatRTI/PersonAlytics documentation built on Dec. 13, 2024, 11:06 p.m.