Issues to reinstall survival - rstanarm

Hi all,

I was unable to reinstall survival branch of rstanarm in my laptop and other devices, so I would like to ask if someone has installed the survival branch and can help me to run my hierarchical model. I ran my model in the past, but after updating the rstanarm, I have struggled to try reinstalling the survival branch using versions of R 4.0.2, 4.0.5, 4.3.1, and rstanarm 2.21.1, 2.21.3. in Windows 10, 11, and different Macs. I would really appreciate in case someone could help me, please.

Hi Sandra,

Here’s a solution that has worked for me and at least one other person.

1 Like

Hi Alex,

Thanks for replying. I downloaded the zip file and tried to install the survival branch, but I am still having an error using R version 4.2.0 in Windows:

==> Rcpp::compileAttributes()

SyntaxError: break must be inside loop or switch
at :2513

==> Rcmd.exe INSTALL --no-multiarch --with-keep.source rstanarm-feature-survival

  • installing to library ‘C:/Users/san_k/AppData/Local/R/win-library/4.2’
  • installing source package ‘rstanarm’ …
    ** using staged installation
    ** libs
    “C:/PROGRA~1/R/R-42~1.0/bin/x64/Rscript” -e “source(file.path(‘…’, ‘tools’, ‘make_cc.R’)); make_cc(commandArgs(TRUE))” stan_files/bernoulli.stan
    SyntaxError: break must be inside loop or switch
    at :2513

Error: .onLoad failed in loadNamespace() for ‘rstan’, details:
call: NULL
error: Evaluating JS code failed, see message above!
Execution halted
make: *** [Makevars.win:23: stan_files/bernoulli.cc] Error 1
ERROR: compilation failed for package ‘rstanarm’

  • removing ‘C:/Users/san_k/AppData/Local/R/win-library/4.2/rstanarm’

Exited with status 1.

I also cloned the branch from github and installed rstanarm in R 4.3.1 version but not the survival branch, which is weird. This message was shown in the Built section:

==> Rcmd.exe INSTALL --no-multiarch --with-keep.source rstanarm_survival

  • installing to library ‘C:/Users/san_k/AppData/Local/R/win-library/4.3’
  • installing source package ‘rstanarm’ …
    ** using staged installation
    ** libs
    using C++ compiler: ‘G__~1.EXE (GCC) 12.2.0’
    using C++17
    make: Nothing to be done for ‘all’.
    installing to C:/Users/san_k/AppData/Local/R/win-library/4.3/00LOCK-rstanarm_survival/00new/rstanarm/libs/x64
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** demo
    ** inst
    ** byte-compile and prepare package for lazy loading
    No man pages found in package ‘rstanarm’
    ** help
    *** installing help indices
    *** copying figures
    ** building package indices
    ** installing vignettes
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (rstanarm)

And when I run my model, it still shows an error:

Error in stan_surv(Surv(time = time, event = status) ~ edge_area.sd + :
could not find function “stan_surv”

I appreciate it a lot if somebody could help me to run my model.