r语言 - "RLRsim" 中的 exactRLRT()' 函数无法识别 'lmerMod' 对象



我在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的对象,那么为什么这不起作用呢?

它对我有用,我将其发布在这里,以便您可以检查,我们可以看到导致错误的原因:

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

相关内容

  • 没有找到相关文章

最新更新