performance
performance copied to clipboard
`check_predictions` not working for `nlme::lme()`
library(nlme)
fm2 <- lme(Reaction ~ Days,
random = ~ Days | Subject,
data = lme4::sleepstudy)
performance::check_model(fm2)
#> Could not compute standard errors from random effects for diagnostic
#> plot.
#> Homogeneity of variance could not be computed. Cannot extract residual
#> variance from objects of class 'lme'.
#> Converting missing values (`NA`) into regular values currently not
#> possible for variables of class `NULL`.
#> Error in d[, !(names(data) %in% all.varying), drop = FALSE]: incorrect number of dimensions
Created on 2022-10-23 by the reprex package (v2.0.1)
That's because simulate()
works, but produces odd results for check_predictions()
:
library(nlme)
library(performance)
fm2 <- lme(Reaction ~ Days,
random = ~ Days | Subject,
data = lme4::sleepstudy
)
check_predictions(fm2)
#> Error in min(replicated): invalid 'type' (list) of argument
simulate(fm2, nsim = 10)
#> $null
#> $null$ML
#> info logLik
#> 1 0 -887.5477
#> 2 0 -877.6983
#> 3 0 -886.0273
#> 4 0 -876.2553
#> 5 0 -871.8994
#> 6 0 -873.3890
#> 7 0 -864.8214
#> 8 0 -879.5240
#> 9 0 -880.4150
#> 10 0 -890.2539
#>
#> $null$REML
#> info logLik
#> 1 0 -883.1471
#> 2 0 -874.0700
#> 3 0 -881.6479
#> 4 0 -872.4690
#> 5 0 -867.8706
#> 6 0 -869.5454
#> 7 0 -861.0608
#> 8 0 -875.2973
#> 9 0 -876.3774
#> 10 0 -885.8936
#>
#>
#> attr(,"class")
#> [1] "simulate.lme"
Should we just skip the pp-check for lme?
Solution: https://stats.stackexchange.com/a/28627