Description Usage Arguments Value Author(s) References See Also Examples
This implementation is based on the pbkrtest
package. See reference.
1 |
xx |
Vector of covariate values. |
Sigma |
Vairance-covariance matrix. |
L |
Linear contrast. Default: |
A list with components:
df |
Adjusted degrees of freedom. |
scaling |
Scaling factor for the F-statistic. Here always equal to 1. |
Yun Zhang, Xing Qiu
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.
For more details, please see also the pbketest
package.
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.