My understanding is that you need to use the developer version of rstanarm from github.
The code below should work but I’m having problems with the install in windows
Thanks for the reply. While i have a GitHub account, I’m quite a newbie in its use. Do i clone this as a download zip file? How do I build a package with RStudio. if you have the time to supply some more details that would be great.
Thanks again.
Yes you could download the code as a .zip file by clicking on the green ‘code’ button on github. Then in the downloaded folder you can open rstanarm.Rproj, which will open in R studio. Since the repository is an R package, you should see the ‘build’ pane somewhere in your Rstudio window. From the ‘build’ pane you can click the ‘Install and Restart’ button, which will install the package as though you had run install.packages().
For me this made the stan_surv() function available where installing from github had failed.
Downloading the .zip will work, but learning how to properly clone a github repository may be useful to you as well. I recommend this beginner’s resource for learning how to use github with R.
Thanks, that worked! Reading HappyGit is on my to do list.
Need to build the documentation files for this package.
While waiting for that finish, do you know if the argument family = “cox” works?
Hmm not sure about family = “cox” in rstanarm, I didn’t spend much time in the package. I ended up switching over to brms after playing around a little bit.
Hi all,
I am a new member in this forum. I want to use function ‘Stan_surv’ in ‘rstanarm’ package.
I really need to use function ‘Stan-surv’ for running Cox PH model using Bayesian method. But I got error "could not find function ‘Stan_surv’ after installing package “rstanarm” in different ways. Then I found this instruction for installing the package from alex.b.r
"make: *** [stan_files/bernoulli.o] Error 1
rm stan_files/bernoulli.cc
ERROR: compilation failed for package ‘rstanarm’
According to the message and instructions you are referring to, “Stan_surv” should actually be with a lower case “s”: “stan_surv”. If that’s not the cause, someone else needs to step in and advise :)
I am a researcher currently working with R version 4.3.2 and I’ve encountered an issue while trying to install the feature/survival branch of rstanarm. I am attempting a direct installation from GitHub using the command:
However, I am running into an error during the installation process. The error message is as follows:
C:/PROGRA~1/R/R-43~1.2/bin/x64/Rscript" -e "source(file.path('..', 'tools', 'make_cc.R')); make_cc(commandArgs(TRUE))" stan_files/surv.stan
Error in rstan::stanc(file, allow_undefined = TRUE, obfuscate_model_name = FALSE) :
0
Semantic error in 'string', line 404, column 2 to line 411, column 3:
-------------------------------------------------
402: }
403:
404: vector quadrature_log_cdf(vector qwts, vector log_hazard, int qnodes, int N) {
^
405: int M = rows(log_hazard);
406: vector[M] hazard = exp(log_hazard);
-------------------------------------------------
Real return type required for probability functions ending in _log, _lpdf, _lupdf, _lpmf, _lupmf, _cdf, _lcdf, or _lccdf.
From what I understand, the error seems to be related to the function quadrature_log_cdf returning a vector instead of a real type, which could potentially be a bug.
I would greatly appreciate any insights or solutions anyone might have regarding this issue. Has anyone else encountered this problem or have any advice on how to resolve it?