Skip to content

Results differ btw R 3.4.4 and 3.3.2 #1

@runehaubo

Description

@runehaubo

Hi,

When updating the R version requirements for lmerTest, I stumbled upon this issue (for which we happen to have a test in lmerTest). It appears that KRmodcomp gives different ddf estimates using R 3.3.2 - I think the 3.4.4 results are correct:

> library(pbkrtest)
Loading required package: lme4
Loading required package: Matrix
> m <- lme4::lmer(Reaction ~ Days + I(Days^2) + (Days | Subject), sleepstudy)
> KRmodcomp(m, matrix(c(0, 1, 0), nrow=1))
Note: method with signature ‘sparseMatrix#ANY’ chosen for function ‘kronecker’,
 target signature ‘dgCMatrix#ngCMatrix’.
 "ANY#sparseMatrix" would also be valid
F-test with Kenward-Roger approximation; computing time: 0.23 sec.
large : Reaction ~ Days + I(Days^2) + (Days | Subject)
small : L beta = L betaH 
L=
1 x 3 sparse Matrix of class "dgCMatrix"
          
[1,] . 1 .
betaH=
[1] 0
          stat      ndf      ddf F.scaling  p.value   
Ftest   6.9551   1.0000 150.3885         1 0.009236 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> sessionInfo()
R version 3.3.2 RC (2016-10-26 r71594)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.6

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] pbkrtest_0.4-6 lme4_1.1-13    Matrix_1.2-7.1 fortunes_1.5-3

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.6        splines_3.3.2      MASS_7.3-45        munsell_0.4.3     
 [5] colorspace_1.3-2   lattice_0.20-34    minqa_1.2.4        car_2.1-4         
 [9] plyr_1.8.4         tools_3.3.2        nnet_7.3-12        parallel_3.3.2    
[13] grid_3.3.2         gtable_0.2.0       nlme_3.1-128       mgcv_1.8-15       
[17] quantreg_5.29      MatrixModels_0.4-1 lazyeval_0.2.0     assertthat_0.1    
[21] tibble_1.2         numDeriv_2016.8-1  nloptr_1.0.4       ggplot2_2.2.1     
[25] scales_0.4.1       lmerTest_3.0-0     SparseM_1.74      

Restarting R session...

> library(pbkrtest)
Loading required package: lme4
Loading required package: Matrix
> m <- lme4::lmer(Reaction ~ Days + I(Days^2) + (Days | Subject), sleepstudy)
> KRmodcomp(m, matrix(c(0, 1, 0), nrow=1))
F-test with Kenward-Roger approximation; computing time: 0.24 sec.
large : Reaction ~ Days + I(Days^2) + (Days | Subject)
small : L beta = L betaH 
L=
1 x 3 sparse Matrix of class "dgCMatrix"
          
[1,] . 1 .
betaH=
[1] 0
          stat      ndf      ddf F.scaling p.value   
Ftest   6.9551   1.0000 114.4314         1 0.00952 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> 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] pbkrtest_0.4-7 lme4_1.1-17    Matrix_1.2-12  fortunes_1.5-4

loaded via a namespace (and not attached):
 [1] minqa_1.2.4     MASS_7.3-49     compiler_3.4.4  parallel_3.4.4  tools_3.4.4    
 [6] Rcpp_0.12.16    splines_3.4.4   nlme_3.1-131.1  grid_3.4.4      nloptr_1.0.4   
[11] lattice_0.20-35

Cheers,
Rune

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions