Get adjusted denominator degrees 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)

get_ddf_Lb(object, Lcoef)

# S3 method for lmerMod
get_ddf_Lb(object, Lcoef)

Lb_ddf(L, V0, Vadj)

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)

Lcoef

Linear contrast matrix

V0, Vadj

The unadjusted and the adjusted covariance matrices for the fixed effects parameters. The unadjusted covariance matrix is obtained with vcov() and adjusted with vcovAdj().

VVa

Adjusted covariance matrix

VV0

Unadjusted covariance matrix

Value

Adjusted degrees of freedom (adjustment 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., https://www.jstatsoft.org/v59/i09/

Author

Søren Højsgaard, sorenh@math.aau.dk

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.741       
#>           Days         5.922   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)
#>         npar    AIC    BIC  logLik deviance  Chisq 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
#> large : Reaction ~ Days + (Days | Subject)
#> small : Reaction ~ 1 + (Days | Subject)
#>         stat    ndf    ddf F.scaling   p.value    
#> Ftest 45.853  1.000 17.000         1 3.264e-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 <- model2restriction_matrix(fmLarge, fmSmall)
L
#>      [,1] [,2]
#> [1,]    0    1