KRapprox: Kenward-Roger approximation to the degrees of freedom

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

View source: R/KRapprox.R

Description

This implementation is based on the pbkrtest package. See reference.

Usage

1
KRapprox(xx, Sigma, L=c(0,1))

Arguments

xx

Vector of covariate values.

Sigma

Vairance-covariance matrix.

L

Linear contrast. Default: L=c(0,1).

Value

A list with components:

df

Adjusted degrees of freedom.

scaling

Scaling factor for the F-statistic. Here always equal to 1.

Author(s)

Yun Zhang, Xing Qiu

References

Halekoh, U., & Højsgaard, S. (2014). A kenward-roger approximation and parametric bootstrap methods for tests in linear mixed models–the R package pbkrtest. Journal of Statistical Software, 59(9), 1-30.

Kenward, M. G., & Roger, J. H. (1997). Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, 983-997.

See Also

For more details, please see also the pbketest package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Consider two groups: A and B
n <- 20
xx <- rep(c("A","B"),n)

## e.g. degrees of freedom for two-sample t-test, i.e. covariance is the identity matrix
KRapprox(xx, diag(2*n)) #df = 2n-2

## e.g. degrees of freedom for paired t-test, i.e. block-diagnal covariance matrix
library(Matrix)
rho <- 0.5 #this may be any non-zero correlation coefficient
mat <- matrix(rho,2,2)
diag(mat) <- 1
Sigma <- as.matrix(bdiag(replicate(n,mat,simplify=FALSE)))
KRapprox(xx, Sigma) #df = n-1

yunzhang813/PBtest-R-Package documentation built on March 18, 2020, 5:29 p.m.