`RLRsim` 中的 exactRLRT()` 函数无法识别 `lmerMod` 对象

exactRLRT()` function in `RLRsim` fails to recognise `lmerMod` object

我无法使用 RLRsim 包中的 exactRLRT() 函数。

library(faraway)
library(RLRsim)
data(eggs)
cmods <- lmer(Fat ~ 1 + (1|Lab:Technician:Sample), data=eggs)
exactRLRT(cmods)

这会产生错误

Error in exactRLRT(cmods) : Invalid <m> specified. 

RLRsim::exactRLRT 的帮助中说

The fitted model under the alternative or, for testing in models with multiple variance components, the reduced model containing only the random effect to be tested (see Details), an lme, lmerMod or spm object

但是 cmods 一个 lmerMod 对象,为什么这不起作用?

它对我有用,我post它在这里所以你可以检查,我们可以看看是什么导致了你的错误:

library(faraway)
library(RLRsim)
library(lme4)
data(eggs)
cmods <- lmer(Fat ~ 1 + (1|Lab:Technician:Sample), data=eggs)
exactRLRT(cmods)


    simulated finite sample distribution of RLRT.

    (p-value based on 10000 simulated values)

data:  
RLRT = 14.382, p-value < 2.2e-16

我的会话信息() :

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] lme4_1.1-21   Matrix_1.2-17 RLRsim_3.1-3  faraway_1.0.7

loaded via a namespace (and not attached):
 [1] minqa_1.2.4     MASS_7.3-51.4   compiler_3.6.1  tools_3.6.1    
 [5] mgcv_1.8-28     Rcpp_1.0.2      splines_3.6.1   nlme_3.1-140   
 [9] grid_3.6.1      nloptr_1.2.1    boot_1.3-23     lattice_0.20-38