Skip to contents

This function computes the null-model (i.e. (y ~ 1)) of a model. For mixed models, the null-model takes random effects into account.

Usage

null_model(model, verbose = TRUE, ...)

Arguments

model

A (mixed effects) model.

verbose

Toggle off warnings.

...

Arguments passed to or from other methods.

Value

The null-model of x

Examples

data(sleepstudy)
m <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)
summary(m)
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: Reaction ~ Days + (1 + Days | Subject)
#>    Data: sleepstudy
#> 
#> REML criterion at convergence: 1743.6
#> 
#> Scaled residuals: 
#>     Min      1Q  Median      3Q     Max 
#> -3.9536 -0.4634  0.0231  0.4634  5.1793 
#> 
#> Random effects:
#>  Groups   Name        Variance Std.Dev. Corr
#>  Subject  (Intercept) 612.10   24.741       
#>           Days         35.07    5.922   0.07
#>  Residual             654.94   25.592       
#> Number of obs: 180, groups:  Subject, 18
#> 
#> Fixed effects:
#>             Estimate Std. Error t value
#> (Intercept)  251.405      6.825  36.838
#> Days          10.467      1.546   6.771
#> 
#> Correlation of Fixed Effects:
#>      (Intr)
#> Days -0.138
summary(null_model(m))
#> Linear mixed model fit by REML ['lmerMod']
#> Formula: Reaction ~ (1 + Days | Subject)
#>    Data: sleepstudy
#> 
#> REML criterion at convergence: 1769.8
#> 
#> Scaled residuals: 
#>     Min      1Q  Median      3Q     Max 
#> -4.0449 -0.4486  0.0089  0.4819  5.2186 
#> 
#> Random effects:
#>  Groups   Name        Variance Std.Dev. Corr 
#>  Subject  (Intercept) 651.6    25.53         
#>           Days        142.2    11.93    -0.18
#>  Residual             654.9    25.59         
#> Number of obs: 180, groups:  Subject, 18
#> 
#> Fixed effects:
#>             Estimate Std. Error t value
#> (Intercept)   257.76       6.76   38.13