pbkrtest (version 0.1.0)

KenwardRoger: Ftest and degrees of freedom based on Kenward-Roger approximation

Description

An approximate F-test based on the Kenward-Roger approach.

Usage

KRmodcomp(largeModel, smallModel, beta0=0)
## S3 method for class 'mer':
KRmodcomp(largeModel, smallModel, beta0=0)

Arguments

largeModel
A lmer model
smallModel
A lmer model or a restriction matrix
beta0
A number or a vector of the beta of the hypothesis, e.g. L beta=beta0. beta0=0 if modelSmall is a model not a restriction matrix.
...
Additonal arguments to print function

Details

An F test is calculated according to the approach of Kenward and Roger (1997). The function works for linear mixed models fitted with the lmer function of the lme4 package. Only models where the covariance structure is a sum of known matrices can be compared. The largeModel may be a model fitted with lmer either using REML=TRUE or REML=FALSE. The smallModel can be a model fitted with lmer. It must have the same coavarianc structure as largeModel. Furthermore, its linear space of expectation must be a subspace of the space for largeModel. The model smallModel can also be a restriction matrix L specifying the hypothesis L beta =beta0, where L is a $k \times p$ matrix and $\beta$ is a $p$ column vector the same length as fixef(largeModel). $\beta0$ is a $k$ column vector. Notice: It cannot be guaranteed that the results agree with other implementations of the Kenward-Roger approach!

References

Kenward, M. G. and Roger, J. H. (1997), Small Sample Inference for Fixed Effects from Restricted Maximum Likelihood, Biometrics 53: 983-997.

See Also

lmer.

Examples

Run this code
(fmLarge <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
## removing Day
(fmSmall <- lmer(Reaction ~ 1 + (Days|Subject), sleepstudy))
(KRmodcomp(fmLarge,fmSmall))

## The same test using a restriction matrix
L<-cbind(0,1)
(KRmodcomp(fmLarge,L))

Run the code above in your browser using DataCamp Workspace