DenisRustand / INLAjoint

Joint modeling multivariate longitudinal and time-to-event outcomes with INLA
16 stars 0 forks source link

joint() not working with release 2023.04.04 #14

Closed NewUser36 closed 1 year ago

NewUser36 commented 1 year ago

Hello,

I'd like to report a bug I've encountered the release 2023.04.04 that is not present when I use the release 2023.03.28.

When I try to use the release 2023.04.04 to run a model with the function joint(), I get an error. For the code below, I downloaded the .zip file and unzipped it, and then I install it using install.packages, but I get the same error using devtools::install_github('DenisRustand/INLAjoint', build_vignettes = FALSE).

install.packages("~/Documents/INLA/INLAjoint-23.04.04",
                 repos = NULL, type = "source")

library(INLAjoint)

data(pbc2, package="JMbayes2") # dataset
# extract some variable of interest without missing values
Longi <- na.omit(pbc2[, c("id", "years", "status","drug","age",
"sex","year","serBilir","SGOT", "albumin", "edema",
"platelets", "alkaline","spiders", "ascites")])

M1 <- joint(formLong = serBilir ~ year + drug + (1|id),
dataLong = Longi, id = "id", timeVar = "year",
family = "lognormal")

The error I get is

Error in inla.check.control(control.compute, data) : 
  Name `internal.opt' in control-argument `control.compute', is void.

  Valid ones are:
    config
    control.gcpo
    cpo
    dic
    graph
    hyperpar
    likelihood.info
    mlik
    openmp.strategy
    po
    q
    residuals
    return.marginals
    return.marginals.predictor
    smtp
    waic

 *** inla.core.safe:  inla.program has crashed: rerun to get better initial values. try=1/2 
Error in inla.check.control(control.compute, data) : 
  Name `internal.opt' in control-argument `control.compute', is void.

  Valid ones are:
    config
    control.gcpo
    cpo
    dic
    graph
    hyperpar
    likelihood.info
    mlik
    openmp.strategy
    po
    q
    residuals
    return.marginals
    return.marginals.predictor
    smtp
    waic

 *** inla.core.safe:  inla.program has crashed: rerun to get better initial values. try=2/2 
Error in inla.check.control(control.compute, data) : 
  Name `internal.opt' in control-argument `control.compute', is void.

  Valid ones are:
    config
    control.gcpo
    cpo
    dic
    graph
    hyperpar
    likelihood.info
    mlik
    openmp.strategy
    po
    q
    residuals
    return.marginals
    return.marginals.predictor
    smtp
    waic
Error in inla.core.safe(formula = formula, family = family, contrasts = contrasts,  : 
  *** Fail to get good enough initial values. Maybe it is due to something else.

which seems to be an error caused by the release 2023.04.04 ("option to deactivate internal.opt"). Indeed, when I use the same code seen above, but with the release 2023.03.28 installed, I do not get this error.

Here is the output from sessionInfo(), if that can help :

> sessionInfo()
R version 4.2.3 (2023-03-15)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora Linux 37 (Workstation Edition)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libflexiblas.so.3.3

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C               LC_TIME=en_CA.UTF-8       
 [4] LC_COLLATE=en_CA.UTF-8     LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  splines   stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] INLAjoint_23.04.04  ggplot2_3.4.2       numDeriv_2016.8-1.1 lme4_1.1-32         INLA_22.12.16      
 [6] sp_1.6-0            foreach_1.5.2       Matrix_1.5-3        JMbayes2_0.4-0      GLMMadaptive_0.8-8 
[11] nlme_3.1-162        survival_3.5-3     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10        lattice_0.20-45    prettyunits_1.1.1  ps_1.7.5           digest_0.6.31     
 [6] utf8_1.2.3         mime_0.12          R6_2.5.1           coda_0.19-4        pillar_1.9.0      
[11] rlang_1.1.0        minqa_1.2.5        rstudioapi_0.14    miniUI_0.1.1.1     nloptr_2.0.3      
[16] callr_3.7.3        urlchecker_1.0.1   devtools_2.4.5     stringr_1.5.0      htmlwidgets_1.6.1 
[21] munsell_0.5.0      shiny_1.7.4        compiler_4.2.3     httpuv_1.6.9       pkgconfig_2.0.3   
[26] pkgbuild_1.4.0     htmltools_0.5.4    tidyselect_1.2.0   tibble_3.2.1       gridExtra_2.3     
[31] codetools_0.2-19   matrixStats_0.63.0 fansi_1.0.4        withr_2.5.0        crayon_1.5.2      
[36] dplyr_1.1.0        later_1.3.0        MASS_7.3-58.2      grid_4.2.3         xtable_1.8-4      
[41] gtable_0.3.3       lifecycle_1.0.3    magrittr_2.0.3     scales_1.2.1       cli_3.6.1         
[46] stringi_1.7.8      cachem_1.0.6       fs_1.6.1           promises_1.2.0.1   remotes_2.4.2     
[51] ellipsis_0.3.2     vctrs_0.6.2        generics_0.1.3     boot_1.3-28.1      iterators_1.0.14  
[56] tools_4.2.3        glue_1.6.2         purrr_1.0.1        processx_3.8.1     pkgload_1.3.2     
[61] fastmap_1.1.0      colorspace_2.1-0   sessioninfo_1.2.2  memoise_2.0.1      profvis_0.3.7     
[66] usethis_2.1.6  
DenisRustand commented 1 year ago

Hello,

Indeed we added this internal.opt option both in INLAjoint and INLA testing version but it is not yet in INLA's stable version, therefore to avoid the error you have to update INLA to the latest testing version. To do so, you can simply load INLA library in R and run 'inla.update(testing=T)'.

Best, Denis

NewUser36 commented 1 year ago

Well, that was easy to fix! Thank you for your quick answer.