wzmli / phyloglmm

GNU General Public License v3.0
4 stars 2 forks source link

object 'sparseX' not found & Error in phyloZ[levels(frloc[, phylonm[1]]), ] #7

Closed nicolaycunha closed 4 years ago

nicolaycunha commented 4 years ago

Hi guys,

I have been succeeding on using phyloglmm and used it for several analyses. However, I noticed that since the last R update (MacOS), I can't run the glmmTMBphylo anymore.

When trying to run the examples that came with the package, I get the following message:

glmmTMB_fit <- glmmTMBphylo(phen~cofactor+(1|sp)
    , data=datG
    , phyloZ=phyloZ
    , phylonm = "sp"
    , doFit=TRUE
    , dispformula = ~1
    , REML = FALSE
  )

**_Error in namedList(nobs = nrow(data.tmb$X), respCol, grpVar, family, contrasts, : object 'sparseX' not found_**

And when running with my own data set, the below error:

glmmTMBphylo( y ~  x +   (1|species) +  (1|random_effect)  
                     , data = data
                     , phyloZ = phyloZ
                     , phylonm = "species"
                     , doFit = TRUE
                     , dispformula = ~1
                     , REML = FALSE
                     , family = binomial
) 
Error in phyloZ[levels(frloc[, phylonm[1]]), ] : 
  invalid or not-yet-implemented 'Matrix' subsetting

The interesting aspect is that I can run any model with phylo_lmm using exactly the same data set and phylogenetic tree, hence, I assume it may have something to do with the glmmTMB package vs new R version vs MacOS. Does it make sense?

My sessionInfo() is:

R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.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/4.0/Resources/lib/libRlapack.dylib

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 

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] spatial_7.3-12      SparseM_1.78        randomcoloR_1.1.0.1 lmodel2_1.7-3       glmmTMB_1.0.2.1     tidyverse_1.3.0     stargazer_5.2.2    
 [8] ecoflux_0.3.1       arm_1.11-2          Rmisc_1.5           plyr_1.8.6          broom_0.7.0         coda_0.19-3         lme4_1.1-23        
[15] Matrix_1.2-18       phangorn_2.5.5      caper_1.0.1         mvtnorm_1.1-1       MASS_7.3-52         dendextend_1.14.0   scales_1.1.1       
[22] picante_1.8.2       nlme_3.1-149        vegan_2.5-6         lattice_0.20-41     permute_0.9-5       phytools_0.7-47     maps_3.3.0         
[29] PDcalc_0.3.2.9000   geiger_2.0.7        ape_5.4-1           car_3.0-9           carData_3.0-4       forcats_0.5.0       stringr_1.4.0      
[36] purrr_0.3.4         readr_1.3.1         tibble_3.0.3        ggplot2_3.3.2       tidyr_1.1.2         dplyr_1.0.2         reshape2_1.4.4     

loaded via a namespace (and not attached):
  [1] readxl_1.3.1            backports_1.1.9         Hmisc_4.4-1             fastmatch_1.1-0         igraph_1.2.5           
  [6] TMB_1.7.18              splines_4.0.2           TH.data_1.0-10          digest_0.6.25           htmltools_0.5.0        
 [11] rsconnect_0.8.16        viridis_0.5.1           fansi_0.4.1             magrittr_1.5            checkmate_2.0.0        
 [16] cluster_2.1.0           remotes_2.2.0           openxlsx_4.1.5          modelr_0.1.8            sandwich_2.5-1         
 [21] prettyunits_1.1.1       jpeg_0.1-8.1            colorspace_1.4-1        blob_1.2.1              rvest_0.3.6            
 [26] haven_2.3.1             xfun_0.16               callr_3.4.4             crayon_1.3.4            jsonlite_1.7.1         
 [31] survival_3.2-3          zoo_1.8-8               glue_1.4.2              gtable_0.3.0            emmeans_1.5.0          
 [36] V8_3.2.0                pkgbuild_1.1.0          abind_1.4-5             DBI_1.1.0               Rcpp_1.0.5             
 [41] plotrix_3.7-8           viridisLite_0.3.0       xtable_1.8-4            htmlTable_2.0.1         tmvnsim_1.0-2          
 [46] foreign_0.8-80          subplex_1.6             deSolve_1.28            Formula_1.2-3           animation_2.6          
 [51] htmlwidgets_1.5.1       httr_1.4.2              RColorBrewer_1.1-2      ellipsis_0.3.1          pkgconfig_2.0.3        
 [56] nnet_7.3-14             dbplyr_1.4.4            tidyselect_1.1.0        rlang_0.4.7             munsell_0.5.0          
 [61] cellranger_1.1.0        tools_4.0.2             cli_2.0.2               generics_0.0.2          evaluate_0.14          
 [66] yaml_2.2.1              processx_3.4.4          knitr_1.29              fs_1.5.0                zip_2.1.1              
 [71] xml2_1.3.2              compiler_4.0.2          rstudioapi_0.11         curl_4.3                png_0.1-7              
 [76] testthat_2.3.2          reprex_0.3.0            clusterGeneration_1.3.4 statmod_1.4.34          stringi_1.4.6          
 [81] ps_1.3.4                desc_1.2.0              nloptr_1.2.2.2          vctrs_0.3.4             pillar_1.4.6           
 [86] lifecycle_0.2.0         combinat_0.0-8          estimability_1.3        data.table_1.13.0       R6_2.4.1               
 [91] latticeExtra_0.6-29     gridExtra_2.3           rio_0.5.16              codetools_0.2-16        pkgload_1.1.0          
 [96] boot_1.3-25             gtools_3.8.2            assertthat_0.2.1        rprojroot_1.3-2         withr_2.2.0            
[101] mnormt_2.0.2            multcomp_1.4-13         mgcv_1.8-33             expm_0.999-5            parallel_4.0.2         
[106] hms_0.5.3               quadprog_1.5-8          grid_4.0.2              rpart_4.1-15            minqa_1.2.4            
[111] rmarkdown_2.3           Rtsne_0.15              numDeriv_2016.8-1.1     scatterplot3d_0.3-41    lubridate_1.7.9        
[116] base64enc_0.1-3    

I am sorry, but I can't provide a reproducible example for this error.

Many thanks, Nicolay

nicolaycunha commented 4 years ago

I am sorry, I had an internet error and did not see that this issue was submitted. I will close it.