Closed rpsychologist closed 6 years ago
Hmm. Works fine for me - what is your sessionInfo?
> library(lmerTest)
Loading required package: lme4
Loading required package: Matrix
Attaching package: ‘lmerTest’
The following object is masked from ‘package:lme4’:
lmer
The following object is masked from ‘package:stats’:
step
> data("sleepstudy", package="lme4")
> test <- function() {
+ tmp <- sleepstudy
+ m <- lmerTest::lmer(Reaction ~ Days + (Days | Subject), data = tmp)
+ summary(m)
+ }
> test()
Linear mixed model fit by REML. t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: Reaction ~ Days + (Days | Subject)
Data: tmp
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.09 24.740
Days 35.07 5.922 0.07
Residual 654.94 25.592
Number of obs: 180, groups: Subject, 18
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 251.405 6.825 17.000 36.838 < 2e-16 ***
Days 10.467 1.546 17.000 6.771 3.26e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Correlation of Fixed Effects:
(Intr)
Days -0.138
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/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] lmerTest_2.0-37.90016 lme4_1.1-15 Matrix_1.2-12
[4] fortunes_1.5-4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.14 splines_3.4.4 MASS_7.3-49 munsell_0.4.3
[5] colorspace_1.3-2 lattice_0.20-35 rlang_0.2.0 minqa_1.2.4
[9] car_2.1-5 plyr_1.8.4 tools_3.4.4 nnet_7.3-12
[13] pbkrtest_0.4-7 parallel_3.4.4 grid_3.4.4 gtable_0.2.0
[17] nlme_3.1-131.1 mgcv_1.8-23 quantreg_5.33 MatrixModels_0.4-1
[21] lazyeval_0.2.0 tibble_1.4.2 numDeriv_2016.8-1 nloptr_1.0.4
[25] ggplot2_2.2.1 compiler_3.4.4 pillar_1.2.1 scales_0.4.1
[29] SparseM_1.77
lmerTest is not attached in my example, if it is it works.
The suggested code in new_lmerTest.pdf
gives the same error
rm(tmp)
data("sleepstudy", package="lme4")
test <- function() {
tmp <- sleepstudy
m <- lme4::lmer(Reaction ~ Days + (Days | Subject), data = tmp)
if(requireNamespace("lmerTest", quietly = TRUE)) {
summary(lmerTest::as_lmerModLmerTest(m))
}
}
# error
test()
Here's my sessionInfo:
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.4 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=sv_SE.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=sv_SE.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=sv_SE.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=sv_SE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 lattice_0.20-35 MASS_7.3-49 plyr_1.8.4 grid_3.4.4
[6] nlme_3.1-131.1 gtable_0.2.0 scales_0.5.0.9000 pillar_1.2.1 ggplot2_2.2.1.9000
[11] rlang_0.2.0.9001 lazyeval_0.2.1 minqa_1.2.4 nloptr_1.0.4 Matrix_1.2-11
[16] splines_3.4.4 lme4_1.1-15 tools_3.4.4 munsell_0.4.3 numDeriv_2016.8-1
[21] yaml_2.1.18 compiler_3.4.4 colorspace_1.3-2 lmerTest_2.0-37.90016 tibble_1.4.2
Thanks.
I'll see if I can come up with a way to recover the data within as_lmerModLmerTest.
Also appears to solve issues with powerlmm and ARTool as I no longer get any errors or warnings when I check these packages with the newest lmerTest (2.0-37.90017).
Hi, it seems like the new dev version of lmerTest fails if the data is not available in the global environment? Here's an example:
Is this a bug, or the expected behavior?