piecewiseSEM
piecewiseSEM copied to clipboard
Error running developmental version from github
Hello,
Thanks first for developing such a helpful package and for taking the time to write such detailed vignettes.
I am running a piecewise SEM in R v 4.2.1 that includes glmer models with family = binomial. The standardised estimates for the glmer models were not estimated, but an earlier thread suggested that the fix for this was to work with the version of piecewiseSEM in development in github.
So: library(devtools) install_github("jslefche/piecewiseSEM@devel") library(piecewiseSEM)
I ran my model:
glmsem1<- psem( glmer(Crithidia~Weight+site+collected_doy+Temperature+Precipitation+(1|Year), family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), lmer(Weight~site+collected_doy+Temperature+Precipitation+(1|Year),data=PathData2), glmer(Mites~Weight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), glmer(reproduction~Weight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), glmer(survival~Weight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))) summary(glmsem1, .progressBar = T)
And this generated the error message:
Error in as.matrix(X.[, rownames(i), drop = FALSE]) : object 'X.' not found
I have tried running smaller dummy models (e.g. just using the lmer models) and the error message persists. I am having no luck working out how to fix this and any advice about the causes of this error / potential fixes would be greatly appreciated!
Thanks and apologies in advance if this is a naïve question / I have overlooked something obvious. Ruth
Ruth, would you provide the R session info? It may be other package dependencies need to be updated
On Wed, Aug 31, 2022 at 8:10 AM Arch1985 @.***> wrote:
Hello,
Thanks first for developing such a helpful package and for taking the time to write such detailed vignettes.
I am running a piecewise SEM in R v 4.2.1 that includes glmer models with family = binomial. The standardised estimates for the glmer models were not estimated, but an earlier thread suggested that the fix for this was to work with the version of piecewiseSEM in development in github.
So: library(devtools) @.***") library(piecewiseSEM)
I ran my model:
glmsemDEV<- psem( glmer(Crithidia Weight+site+collected_doy+Temperature+Precipitation+(1|Year), family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), lmer(Weight site+collected_doy+Temperature+Precipitation+(1|Year),data=PathData2), glmer(MitesWeight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), glmer(reproductionWeight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000))), glmer(survival~Weight+site+collected_doy+Temperature+Precipitation+ (1|Year),family=binomial,data=PathData2,control=glmerControl(optimizer="bobyqa", optCtrl=list(maxfun=100000)))) summary(glmsemDEV, .progressBar = T)
And this generated the error message:
Error in as.matrix(X.[, rownames(i), drop = FALSE]) : object 'X.' not found
I have tried running smaller dummy models (e.g. just using the lmer models) and the error message persists. I am having no luck working out how to fix this and any advice about the causes of this error / potential fixes would be greatly appreciated!
Thanks and apologies in advance if this is a naïve question / I have overlooked something obvious. Ruth
— Reply to this email directly, view it on GitHub https://github.com/jslefche/piecewiseSEM/issues/260, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB34ZGZOXN3AX73XZCMRMD3V35DTTANCNFSM6AAAAAAQBKBBIQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thank you for replying so quickly and of course!
`> sI <- sessionInfo()
sI R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] piecewiseSEM_2.2.1 devtools_2.4.4 usethis_2.1.6 survival_3.3-1 ggplot2_3.3.6 gridExtra_2.3 car_3.1-0 carData_3.0-5
[9] lme4_1.1-30 Matrix_1.4-1 dplyr_1.0.9 tidyr_1.2.0
loaded via a namespace (and not attached):
[1] pkgload_1.3.0 jsonlite_1.8.0 splines_4.2.1 shiny_1.7.2 stats4_4.2.1 remotes_2.4.2 sessioninfo_1.2.2 backports_1.4.1
[9] pillar_1.8.1 lattice_0.20-45 glue_1.6.2 digest_0.6.29 RColorBrewer_1.1-3 promises_1.2.0.1 minqa_1.2.4 colorspace_2.0-3
[17] sandwich_3.0-2 MuMIn_1.46.0 htmltools_0.5.3 httpuv_1.6.5 pkgconfig_2.0.3 broom_1.0.1 DiagrammeR_1.0.9 purrr_0.3.4
[25] xtable_1.8-4 mvtnorm_1.1-3 scales_1.2.1 processx_3.7.0 later_1.3.0 emmeans_1.8.0 tibble_3.1.8 generics_0.1.3
[33] ellipsis_0.3.2 TH.data_1.1-1 cachem_1.0.6 withr_2.5.0 pbkrtest_0.5.1 cli_3.3.0 magrittr_2.0.3 crayon_1.5.1
[41] mime_0.12 memoise_2.0.1 estimability_1.4.1 ps_1.7.1 fs_1.5.2 fansi_1.0.3 nlme_3.1-157 MASS_7.3-57
[49] pkgbuild_1.3.1 profvis_0.3.7 tools_4.2.1 prettyunits_1.1.1 lifecycle_1.0.1 multcomp_1.4-20 stringr_1.4.1 munsell_0.5.0
[57] callr_3.7.2 compiler_4.2.1 multcompView_0.1-8 rlang_1.0.4 grid_4.2.1 nloptr_2.0.3 rstudioapi_0.14 htmlwidgets_1.5.4
[65] visNetwork_2.1.0 igraph_1.3.4 miniUI_0.1.1.1 boot_1.3-28 codetools_0.2-18 gtable_0.3.0 abind_1.4-5 curl_4.3.2
[73] R6_2.5.1 zoo_1.8-10 fastmap_1.1.0 utf8_1.2.2 stringi_1.7.8 parallel_4.2.1 Rcpp_1.0.9 vctrs_0.4.1
[81] tidyselect_1.1.2 urlchecker_1.0.1 `
A couple suggestions that might lead toward a solve if it hasn’t been yet. 1. Update matrix and lme4 packages. 2. Test run a simpler PSEM Maybe you’ve already tried and figured this out. I had an issue with package dependencies needing updated a month or so ago.
This seems to be an issue with glmer right now. Try reverting to an older version of the package (ie, one on CRAN). Not sure when I will have time to chase it down ☹
Jonathan S. Lefcheck, Ph.D. Tennenbaum Coordinating Scientist MarineGEO: https://marinegeo.si.edu/ Smithsonian Institution Phone: +1 (443) 482-2443 www.jonlefcheck.nethttp://www.jonlefcheck.net
From: @.> Sent: Monday, September 26, 2022 2:11 PM To: @.> Cc: @.***> Subject: Re: [jslefche/piecewiseSEM] Error running developmental version from github (Issue #260)
External Email - Exercise Caution
A couple suggestions that might lead toward a solve if it hasn’t been yet. 1. Update matrix and lme4 packages. 2. Test run a simpler PSEM Maybe you’ve already tried and figured this out. I had an issue with package dependencies needing updated a month or so ago.
— Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjslefche%2FpiecewiseSEM%2Fissues%2F260%23issuecomment-1258423367&data=05%7C01%7Clefcheckj%40si.edu%7C45d30d6443734363c39b08da9fea81df%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637998126794907664%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CMQYuy7%2FpzJcXPZe9P%2Bdjpstgjj7TMV9Im7OY2JbFYM%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAR4AVYWJQ2C3WM7NE2RQEDWAHRMLANCNFSM6AAAAAAQBKBBIQ&data=05%7C01%7Clefcheckj%40si.edu%7C45d30d6443734363c39b08da9fea81df%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637998126794907664%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VCstt%2B0KgK%2F9utwk14BjNSGEs1Tlz%2FPZrHFC%2FJ7yVvc%3D&reserved=0. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Just wanted to say thank you for giving me your time on this - appreciate it.
Ruth
On Mon, Sep 26, 2022 at 8:15 PM Jon Lefcheck @.***> wrote:
This seems to be an issue with glmer right now. Try reverting to an older version of the package (ie, one on CRAN). Not sure when I will have time to chase it down ☹
Jonathan S. Lefcheck, Ph.D. Tennenbaum Coordinating Scientist MarineGEO: https://marinegeo.si.edu/ Smithsonian Institution Phone: +1 (443) 482-2443 www.jonlefcheck.nethttp://www.jonlefcheck.net
From: @.> Sent: Monday, September 26, 2022 2:11 PM To: @.> Cc: @.***> Subject: Re: [jslefche/piecewiseSEM] Error running developmental version from github (Issue #260)
External Email - Exercise Caution
A couple suggestions that might lead toward a solve if it hasn’t been yet.
- Update matrix and lme4 packages. 2. Test run a simpler PSEM Maybe you’ve already tried and figured this out. I had an issue with package dependencies needing updated a month or so ago.
— Reply to this email directly, view it on GitHub< https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fjslefche%2FpiecewiseSEM%2Fissues%2F260%23issuecomment-1258423367&data=05%7C01%7Clefcheckj%40si.edu%7C45d30d6443734363c39b08da9fea81df%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637998126794907664%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CMQYuy7%2FpzJcXPZe9P%2Bdjpstgjj7TMV9Im7OY2JbFYM%3D&reserved=0>, or unsubscribe< https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAR4AVYWJQ2C3WM7NE2RQEDWAHRMLANCNFSM6AAAAAAQBKBBIQ&data=05%7C01%7Clefcheckj%40si.edu%7C45d30d6443734363c39b08da9fea81df%7C989b5e2a14e44efe93b78cdd5fc5d11c%7C0%7C0%7C637998126794907664%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=VCstt%2B0KgK%2F9utwk14BjNSGEs1Tlz%2FPZrHFC%2FJ7yVvc%3D&reserved=0>.
You are receiving this because you are subscribed to this thread.Message ID: @.***>
— Reply to this email directly, view it on GitHub https://github.com/jslefche/piecewiseSEM/issues/260#issuecomment-1258427703, or unsubscribe https://github.com/notifications/unsubscribe-auth/A22XIQKACUGPSSWOQ35IE23WAHR43ANCNFSM6AAAAAAQBKBBIQ . You are receiving this because you authored the thread.Message ID: @.***>
Hi everyone,
I am facing the same problem as Arch1985 using an glmm with binomial family. It appears that a few months ago (about 4 months?) it was working fine. Maybe there was an addition in the meantime that caused this bug? (In the meantime I had to reinstall the package from GitHub)
The problem with using the version on CRAN is that it does not allow to obtain the standardised coefficients for glmm (probably an addition that has been made on the version under development). Maybe it is possible to get the development version from 4 months ago somewhere?
Thank you and sorry in advance if my comment does not help to find a solution. Benjamin
This was an issue with rsquared where random slopes without corresponding fixed effects failed to recover the correct random effects matrix from the model. Should be fixed now in the changes just pushed!