Get adjusted denomintor degress freedom for testing Lb=0 in a linear mixed model where L is a restriction matrix.

get_Lb_ddf(object, L)

# S3 method for lmerMod
get_Lb_ddf(object, L)

Lb_ddf(L, V0, Vadj)

get_ddf_Lb(object, Lcoef)

# S3 method for lmerMod
get_ddf_Lb(object, Lcoef)

ddf_Lb(VVa, Lcoef, VV0 = VVa)

Arguments

object

A linear mixed model object.

L

A vector with the same length as fixef(object) or a matrix with the same number of columns as the length of fixef(object)

V0, Vadj

Unadjusted and adjusted covariance matrix for the fixed effects parameters. Undjusted covariance matrix is obtained with vcov() and adjusted with vcovAdj().

Lcoef

Linear contrast matrix

VVa

Adjusted covariance matrix

VV0

Unadjusted covariance matrix

Value

Adjusted degrees of freedom (adjusment made by a Kenward-Roger approximation).

References

Ulrich Halekoh, Søren Højsgaard (2014)., A Kenward-Roger Approximation and Parametric Bootstrap Methods for Tests in Linear Mixed Models - The R Package pbkrtest., Journal of Statistical Software, 58(10), 1-30., http://www.jstatsoft.org/v59/i09/

See also

Examples

(fmLarge <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
#> Linear mixed model fit by REML ['lmerMod'] #> Formula: Reaction ~ Days + (Days | Subject) #> Data: sleepstudy #> REML criterion at convergence: 1743.628 #> Random effects: #> Groups Name Std.Dev. Corr #> Subject (Intercept) 24.737 #> Days 5.923 0.07 #> Residual 25.592 #> Number of obs: 180, groups: Subject, 18 #> Fixed Effects: #> (Intercept) Days #> 251.41 10.47
## removing Days (fmSmall <- lmer(Reaction ~ 1 + (Days|Subject), sleepstudy))
#> Linear mixed model fit by REML ['lmerMod'] #> Formula: Reaction ~ 1 + (Days | Subject) #> Data: sleepstudy #> REML criterion at convergence: 1769.845 #> Random effects: #> Groups Name Std.Dev. Corr #> Subject (Intercept) 25.53 #> Days 11.93 -0.18 #> Residual 25.59 #> Number of obs: 180, groups: Subject, 18 #> Fixed Effects: #> (Intercept) #> 257.8
anova(fmLarge,fmSmall)
#> refitting model(s) with ML (instead of REML)
#> Data: sleepstudy #> Models: #> fmSmall: Reaction ~ 1 + (Days | Subject) #> fmLarge: Reaction ~ Days + (Days | Subject) #> Df AIC BIC logLik deviance Chisq Chi Df Pr(>Chisq) #> fmSmall 5 1785.5 1801.4 -887.74 1775.5 #> fmLarge 6 1763.9 1783.1 -875.97 1751.9 23.537 1 1.226e-06 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
KRmodcomp(fmLarge, fmSmall) ## 17 denominator df's
#> F-test with Kenward-Roger approximation; time: 0.15 sec #> large : Reaction ~ Days + (Days | Subject) #> small : Reaction ~ 1 + (Days | Subject) #> stat ndf ddf F.scaling p.value #> Ftest 45.843 1.000 17.000 1 3.268e-06 *** #> --- #> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
get_Lb_ddf(fmLarge, c(0,1)) ## 17 denominator df's
#> [1] 17
# Notice: The restriction matrix L corresponding to the test above # can be found with L <- model2restrictionMatrix(fmLarge, fmSmall) L
#> 1 x 2 sparse Matrix of class "dgCMatrix" #> #> [1,] . 1