Dear list, I am trying to run bayesian phylogenetic mixed models using MCMCglmm but I keep getting the following error: ?? " Error in MCMCglmm(ltau ~ x * x2 + lbmM + age + lmean_ndvi + : ? no slot of name "i" for this object of class "ddiMatrix" " This is not the first time I use MCMCglmm and it usually works flawlessly. I thought that there may be a conflict with the "tidyverse" package since some functions of "Matrix" are masked, but I tried to run the model without loading the "tidyverse" package and still received the same error. I was not able to find answers online and am thus turning to this list for answers if you can help please. I am running the following model: >>>? prior1 <-list (G = list(G1 = list(V = 1, nu = 0.02) ?????????????????? ?? ??? ? ,G2 = list(V = 1, nu = 0.02) ??????????????????? ??? ??? ,G3 = list(V = 1, nu = 0.02) ??????????????????? ??? ??? ,G4 = list(V = 1, nu = 0.02)), ??????????? ?? ??? ? R = list(V = 1, nu = 0.02) ???????????? ??? ??? ) >>> mod_tau_mc <- MCMCglmm(ltau ~ x * x2+??? # x and x2 are categorical variables ???????????????????????? ??? ??? lbmM +????? # continuous variable ???????????????????????? ??? ??? age + ??? ??? # categorical ??????????????????????? ?? ??? ? lmean_ndvi + ??? ??? # continuous ???????????????????????? ??? ??? lrange_ndvi + ??? ??? # continuous ??????????????????????? ?? ??? ? lnb.loc + ??? ??? # continuous ??????????????????????? ?? ??? ? lduration ??? ??? # continuous ?????????????????????? , random = ~sp_phylo+species2+phylo_pop+phylo_pop_id ?????????????????????? , ginverse = list(sp_phylo = inv.phylo$Ainv) ??? ??? # include a custom matrix for argument sp_phylo ?????????????????????? , family = "gaussian" ?????????????????????? , prior = prior1 ?????????????????????? , data = dt ?????????????????????? , nitt = 22e+03 ??? ??? # number of iteration after burnin ?????????????????????? , burnin = 2000 ??? ??? # number of iteration before beginning sample ?????????????????????? , thin = 100?? ??? ? # nb of iteration between sample ?????????????????????? , pr = TRUE)?? ??? ? #save random posterior distribution I would greatly appreciate your help and happy to provide further information if needed! Thank you in advance! Kamal
Error using MCMCglmm
5 messages · Kamal Atmeh, Jarrod Hadfield, Walid Mawass +1 more
Hi, Is your data frame a tibble? If so, make it a standard data frame and retry. Cheers, Jarrod
On 27/12/2021 18:46, Kamal Atmeh wrote:
This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe. Dear list, I am trying to run bayesian phylogenetic mixed models using MCMCglmm but I keep getting the following error: " Error in MCMCglmm(ltau ~ x * x2 + lbmM + age + lmean_ndvi + : no slot of name "i" for this object of class "ddiMatrix" " This is not the first time I use MCMCglmm and it usually works flawlessly. I thought that there may be a conflict with the "tidyverse" package since some functions of "Matrix" are masked, but I tried to run the model without loading the "tidyverse" package and still received the same error. I was not able to find answers online and am thus turning to this list for answers if you can help please. I am running the following model:
? prior1 <-list (G = list(G1 = list(V = 1, nu = 0.02)
,G2 = list(V = 1, nu = 0.02)
,G3 = list(V = 1, nu = 0.02)
,G4 = list(V = 1, nu = 0.02)),
R = list(V = 1, nu = 0.02)
)
mod_tau_mc <- MCMCglmm(ltau ~ x * x2+ # x and x2 are categorical
variables
lbmM + # continuous variable
age + # categorical
lmean_ndvi + # continuous
lrange_ndvi + # continuous
lnb.loc + # continuous
lduration # continuous
, random =
~sp_phylo+species2+phylo_pop+phylo_pop_id
, ginverse = list(sp_phylo = inv.phylo$Ainv)
# include a custom matrix for argument sp_phylo
, family = "gaussian"
, prior = prior1
, data = dt
, nitt = 22e+03 # number of iteration
after burnin
, burnin = 2000 # number of iteration
before beginning sample
, thin = 100 # nb of iteration between
sample
, pr = TRUE) #save random posterior
distribution
I would greatly appreciate your help and happy to provide further
information if needed!
Thank you in advance!
Kamal
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th? ann an Oilthigh Dh?n ?ideann, cl?raichte an Alba, ?ireamh cl?raidh SC005336.
Hi Jarrod, Thank you for your answer. Yes I transformed the dataset to a classic dataframe but the error remained. If it can help, please find below my sessionInfo(). I eventually loaded the tidyverse. Cheers, Kamal R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043) Matrix products: default locale: [1] LC_COLLATE=French_France.1252? LC_CTYPE=French_France.1252 [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C [5] LC_TIME=French_France.1252 attached base packages: [1] stats???? graphics? grDevices utils???? datasets? methods base other attached packages: ?[1] MCMCglmm_2.29???? ape_5.4-1???????? coda_0.19-4 performance_0.7.0 ?[5] MuMIn_1.43.17???? visreg_2.7.0????? merTools_0.5.2 arm_1.11-2 ?[9] MASS_7.3-53?????? glmmTMB_1.1.2.3?? lmerTest_3.1-3 lme4_1.1-27.1 [13] Matrix_1.4-0????? scales_1.1.1????? forcats_0.5.1 stringr_1.4.0 [17] dplyr_1.0.7?????? purrr_0.3.4?????? readr_1.4.0 tidyr_1.1.3 [21] tibble_3.0.4????? ggplot2_3.3.5???? tidyverse_1.3.1 plyr_1.8.6 loaded via a namespace (and not attached): ? [1] cubature_2.0.4.2??? TH.data_1.0-10????? minqa_1.2.4 colorspace_1.4-1 ? [5] ellipsis_0.3.2????? estimability_1.3??? htmlTable_2.2.1 corpcor_1.6.9 ? [9] base64enc_0.1-3???? fs_1.5.0??????????? rstudioapi_0.13 fansi_0.4.1 ?[13] mvtnorm_1.1-1?????? lubridate_1.7.10??? xml2_1.3.2 codetools_0.2-16 ?[17] splines_4.0.3?????? knitr_1.33????????? Formula_1.2-4 jsonlite_1.7.2 ?[21] nloptr_1.2.2.2????? packrat_0.6.0?????? broom_0.7.8 cluster_2.1.0 ?[25] dbplyr_2.1.1??????? png_0.1-7?????????? broom.mixed_0.2.6 shiny_1.5.0 ?[29] compiler_4.0.3????? httr_1.4.2????????? emmeans_1.6.1 backports_1.2.1 ?[33] fastmap_1.1.0?????? assertthat_0.2.1??? cli_2.5.0 later_1.2.0 ?[37] htmltools_0.5.1.1?? tools_4.0.3???????? gtable_0.3.0 glue_1.4.2 ?[41] reshape2_1.4.4????? Rcpp_1.0.7????????? cellranger_1.1.0 vctrs_0.3.8 ?[45] nlme_3.1-149??????? iterators_1.0.13??? insight_0.14.2 tensorA_0.36.1 ?[49] xfun_0.24?????????? rvest_1.0.0???????? mime_0.9 lifecycle_1.0.0 ?[53] zoo_1.8-8?????????? promises_1.1.1????? hms_1.1.0 parallel_4.0.3 ?[57] sandwich_3.0-0????? TMB_1.7.22????????? RColorBrewer_1.1-2 gridExtra_2.3 ?[61] rpart_4.1-15??????? latticeExtra_0.6-29 stringi_1.5.3 bayestestR_0.10.0 ?[65] foreach_1.5.1?????? blme_1.0-5????????? checkmate_2.0.0 boot_1.3-25 ?[69] rlang_0.4.11??????? pkgconfig_2.0.3???? lattice_0.20-41 htmlwidgets_1.5.3 ?[73] tidyselect_1.1.0??? magrittr_2.0.1????? R6_2.4.1 generics_0.1.0 ?[77] Hmisc_4.5-0???????? multcomp_1.4-14???? DBI_1.1.1 pillar_1.6.4 ?[81] haven_2.4.1???????? foreign_0.8-80????? withr_2.3.0 survival_3.2-7 ?[85] abind_1.4-5???????? nnet_7.3-14???????? modelr_0.1.8 crayon_1.4.1 ?[89] utf8_1.1.4????????? jpeg_0.1-8.1??????? grid_4.0.3 readxl_1.3.1 ?[93] data.table_1.14.0?? reprex_2.0.0??????? digest_0.6.27 xtable_1.8-4 ?[97] httpuv_1.6.1??????? numDeriv_2016.8-1.1 stats4_4.0.3 munsell_0.5.0 Le 27/12/2021 ? 19:49, Jarrod Hadfield a ?crit?:
Hi, Is your data frame a tibble? If so, make it a standard data frame and retry. Cheers, Jarrod On 27/12/2021 18:46, Kamal Atmeh wrote:
This email was sent to you by someone outside the University. You should only click on links or attachments if you are certain that the email is genuine and the content is safe. Dear list, I am trying to run bayesian phylogenetic mixed models using MCMCglmm but I keep getting the following error: ?? " Error in MCMCglmm(ltau ~ x * x2 + lbmM + age + lmean_ndvi + : ? no slot of name "i" for this object of class "ddiMatrix" " This is not the first time I use MCMCglmm and it usually works flawlessly. I thought that there may be a conflict with the "tidyverse" package since some functions of "Matrix" are masked, but I tried to run the model without loading the "tidyverse" package and still received the same error. I was not able to find answers online and am thus turning to this list for answers if you can help please. I am running the following model:
? prior1 <-list (G = list(G1 = list(V = 1, nu = 0.02)
??????????????????????????? ,G2 = list(V = 1, nu = 0.02) ??????????????????????????? ,G3 = list(V = 1, nu = 0.02) ??????????????????????????? ,G4 = list(V = 1, nu = 0.02)), ???????????????????? R = list(V = 1, nu = 0.02) ???????????????????? )
mod_tau_mc <- MCMCglmm(ltau ~ x * x2+??? # x and x2 are categorical
variables ???????????????????????????????? lbmM +????? # continuous variable ???????????????????????????????? age +???????? # categorical ???????????????????????????????? lmean_ndvi +???????? # continuous ???????????????????????????????? lrange_ndvi +???????? # continuous ???????????????????????????????? lnb.loc +???????? # continuous ???????????????????????????????? lduration???????? # continuous ?????????????????????? , random = ~sp_phylo+species2+phylo_pop+phylo_pop_id ?????????????????????? , ginverse = list(sp_phylo = inv.phylo$Ainv) ??? # include a custom matrix for argument sp_phylo ?????????????????????? , family = "gaussian" ?????????????????????? , prior = prior1 ?????????????????????? , data = dt ?????????????????????? , nitt = 22e+03???????? # number of iteration after burnin ?????????????????????? , burnin = 2000???????? # number of iteration before beginning sample ?????????????????????? , thin = 100???????? # nb of iteration between sample ?????????????????????? , pr = TRUE)???????? #save random posterior distribution I would greatly appreciate your help and happy to provide further information if needed! Thank you in advance! Kamal
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. Is e buidheann carthannais a th? ann an Oilthigh Dh?n ?ideann, cl?raichte an Alba, ?ireamh cl?raidh SC005336.
_______________________________________________ R-sig-mixed-models at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Hey Kamal, one possible solution is to run the same code in a new session where you only call the MCMCglmm package and input your data and phylogenetic pedigree as dataframes. That way you can figure out if there were any conflicts in the attached packages in your session. Cheers
Walid Crampton-Mawass On Mon, Dec 27, 2021 at 12:06 PM Kamal Atmeh <kamal.atmeh at hotmail.com> wrote: > Hi Jarrod, > > Thank you for your answer. > > Yes I transformed the dataset to a classic dataframe but the error > remained. > > If it can help, please find below my sessionInfo(). I eventually loaded > the tidyverse. > > Cheers, > > Kamal > > > R version 4.0.3 (2020-10-10) > Platform: x86_64-w64-mingw32/x64 (64-bit) > Running under: Windows 10 x64 (build 19043) > > Matrix products: default > > locale: > [1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 > [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C > [5] LC_TIME=French_France.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] MCMCglmm_2.29 ape_5.4-1 coda_0.19-4 performance_0.7.0 > [5] MuMIn_1.43.17 visreg_2.7.0 merTools_0.5.2 arm_1.11-2 > [9] MASS_7.3-53 glmmTMB_1.1.2.3 lmerTest_3.1-3 lme4_1.1-27.1 > [13] Matrix_1.4-0 scales_1.1.1 forcats_0.5.1 stringr_1.4.0 > [17] dplyr_1.0.7 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3 > [21] tibble_3.0.4 ggplot2_3.3.5 tidyverse_1.3.1 plyr_1.8.6 > > loaded via a namespace (and not attached): > [1] cubature_2.0.4.2 TH.data_1.0-10 minqa_1.2.4 colorspace_1.4-1 > [5] ellipsis_0.3.2 estimability_1.3 htmlTable_2.2.1 > corpcor_1.6.9 > [9] base64enc_0.1-3 fs_1.5.0 rstudioapi_0.13 fansi_0.4.1 > [13] mvtnorm_1.1-1 lubridate_1.7.10 xml2_1.3.2 codetools_0.2-16 > [17] splines_4.0.3 knitr_1.33 Formula_1.2-4 jsonlite_1.7.2 > [21] nloptr_1.2.2.2 packrat_0.6.0 broom_0.7.8 cluster_2.1.0 > [25] dbplyr_2.1.1 png_0.1-7 broom.mixed_0.2.6 > shiny_1.5.0 > [29] compiler_4.0.3 httr_1.4.2 emmeans_1.6.1 > backports_1.2.1 > [33] fastmap_1.1.0 assertthat_0.2.1 cli_2.5.0 later_1.2.0 > [37] htmltools_0.5.1.1 tools_4.0.3 gtable_0.3.0 glue_1.4.2 > [41] reshape2_1.4.4 Rcpp_1.0.7 cellranger_1.1.0 vctrs_0.3.8 > [45] nlme_3.1-149 iterators_1.0.13 insight_0.14.2 > tensorA_0.36.1 > [49] xfun_0.24 rvest_1.0.0 mime_0.9 lifecycle_1.0.0 > [53] zoo_1.8-8 promises_1.1.1 hms_1.1.0 parallel_4.0.3 > [57] sandwich_3.0-0 TMB_1.7.22 RColorBrewer_1.1-2 > gridExtra_2.3 > [61] rpart_4.1-15 latticeExtra_0.6-29 stringi_1.5.3 > bayestestR_0.10.0 > [65] foreach_1.5.1 blme_1.0-5 checkmate_2.0.0 boot_1.3-25 > [69] rlang_0.4.11 pkgconfig_2.0.3 lattice_0.20-41 > htmlwidgets_1.5.3 > [73] tidyselect_1.1.0 magrittr_2.0.1 R6_2.4.1 generics_0.1.0 > [77] Hmisc_4.5-0 multcomp_1.4-14 DBI_1.1.1 pillar_1.6.4 > [81] haven_2.4.1 foreign_0.8-80 withr_2.3.0 survival_3.2-7 > [85] abind_1.4-5 nnet_7.3-14 modelr_0.1.8 crayon_1.4.1 > [89] utf8_1.1.4 jpeg_0.1-8.1 grid_4.0.3 readxl_1.3.1 > [93] data.table_1.14.0 reprex_2.0.0 digest_0.6.27 xtable_1.8-4 > [97] httpuv_1.6.1 numDeriv_2016.8-1.1 stats4_4.0.3 munsell_0.5.0 > > > > Le 27/12/2021 ? 19:49, Jarrod Hadfield a ?crit : > > Hi, > > > > Is your data frame a tibble? If so, make it a standard data frame and > > retry. > > > > Cheers, > > > > Jarrod > > > > On 27/12/2021 18:46, Kamal Atmeh wrote: > >> This email was sent to you by someone outside the University. > >> You should only click on links or attachments if you are certain that > >> the email is genuine and the content is safe. > >> > >> Dear list, > >> > >> I am trying to run bayesian phylogenetic mixed models using MCMCglmm but > >> I keep getting the following error: > >> > >> " Error in MCMCglmm(ltau ~ x * x2 + lbmM + age + lmean_ndvi + : > >> no slot of name "i" for this object of class "ddiMatrix" " > >> > >> This is not the first time I use MCMCglmm and it usually works > >> flawlessly. I thought that there may be a conflict with the "tidyverse" > >> package since some functions of "Matrix" are masked, but I tried to run > >> the model without loading the "tidyverse" package and still received the > >> same error. I was not able to find answers online and am thus turning to > >> this list for answers if you can help please. > >> > >> I am running the following model: > >> > >> >>> prior1 <-list (G = list(G1 = list(V = 1, nu = 0.02) > >> ,G2 = list(V = 1, nu = 0.02) > >> ,G3 = list(V = 1, nu = 0.02) > >> ,G4 = list(V = 1, nu = 0.02)), > >> R = list(V = 1, nu = 0.02) > >> ) > >> > >> >>> mod_tau_mc <- MCMCglmm(ltau ~ x * x2+ # x and x2 are categorical > >> variables > >> lbmM + # continuous variable > >> age + # categorical > >> lmean_ndvi + # continuous > >> lrange_ndvi + # continuous > >> lnb.loc + # continuous > >> lduration # continuous > >> , random = > >> ~sp_phylo+species2+phylo_pop+phylo_pop_id > >> , ginverse = list(sp_phylo = inv.phylo$Ainv) > >> # include a custom matrix for argument sp_phylo > >> , family = "gaussian" > >> , prior = prior1 > >> , data = dt > >> , nitt = 22e+03 # number of iteration > >> after burnin > >> , burnin = 2000 # number of iteration > >> before beginning sample > >> , thin = 100 # nb of iteration between > >> sample > >> , pr = TRUE) #save random posterior > >> distribution > >> > >> I would greatly appreciate your help and happy to provide further > >> information if needed! > >> > >> Thank you in advance! > >> > >> Kamal > >> > >> _______________________________________________ > >> R-sig-mixed-models at r-project.org mailing list > >> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models > > The University of Edinburgh is a charitable body, registered in > > Scotland, with registration number SC005336. Is e buidheann > > carthannais a th? ann an Oilthigh Dh?n ?ideann, cl?raichte an Alba, > > ?ireamh cl?raidh SC005336. > > > > _______________________________________________ > > R-sig-mixed-models at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models > > _______________________________________________ > R-sig-mixed-models at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models > [[alternative HTML version deleted]]
Good point. If that doesn't work, though, we're going to hit the rapidly-diminishing-returns part of the remote-debugging cycle. Can you post a reproducible example (possibly with data posted elsewhere as the list doesn't support large messages or attachments, possibly fuzzed/anonymized if you're worried about data confidentiality)? Ben Bolker
On 12/27/21 2:13 PM, Walid Crampton-Mawass wrote:
Hey Kamal, one possible solution is to run the same code in a new session where you only call the MCMCglmm package and input your data and phylogenetic pedigree as dataframes. That way you can figure out if there were any conflicts in the attached packages in your session. Cheers