stan-dev / rstanarm

rstanarm R package for Bayesian applied regression modeling
https://mc-stan.org/rstanarm
GNU General Public License v3.0
382 stars 132 forks source link

I have problem in stan_surv function #472

Open nedamasa opened 3 years ago

nedamasa commented 3 years ago

Hi, I installed rstanarm package. and I activated it. and I also installed Rstan package too. when I tried to use stan_surv function. it keeps telling me that the function is not existed.

==> Error in stan_surv(formula = Surv(time, event) ~ treatment, data = stats, : could not find function "stan_surv"

Can you please help me I need this so bad. Thanks.

jgabry commented 3 years ago

Hi @nedamasa, are you using the version of rstanarm that's currently on CRAN (i.e., that you installed with install.packages("rstanarm")? Right now the stan_surv() function is only available if you install rstanarm from the feature/survival branch on GitHub although we are hoping to release it on CRAN soon.

If you want to try installing the branch with stan_surv() you can do:

Sys.setenv(MAKEFLAGS = "-j4") # change 4 to however many cores you can/want to use to parallelize install 
Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")
remotes::install_github("stan-dev/rstanarm", ref = "feature/survival", INSTALL_opts = "--no-multiarch")

However, unlike installing from CRAN where all the models are already compiled, this will require compiling all the Stan programs rstanarm uses and so it will take some time and you will need a working version of RStan (i.e., that can successfully compile a Stan program). You may already have that and it will work but if you run into trouble with running the installation code above let us know.

nedamasa commented 3 years ago

Hi Jonah,

I tried to install it using GitHub and I tried to run your codes but it gives me this error:

Warning messages:

1: In utils::untar(tarfile, ...) :

‘tar.exe -xf "C:\Users\Nadoosh\AppData\Local\Temp\RtmpeqoVB9\file2834f63628f.tar.gz" -C "C:/Users/Nadoosh/AppData/Local/Temp/RtmpeqoVB9/remotes2834597bea"’ returned error code 1

2: In i.p(...) :

installation of package ‘C:/Users/Nadoosh/AppData/Local/Temp/RtmpeqoVB9/file28347901461e/rstanarm_2.21.2.tar.gz’ had non-zero exit status

thank you so much. I highly appreciate that. I really need this so bad because I’m trying to use it in my dissertation.

Thank you. Kind regards,

Neda Al Rawashdh, PharmD, Research Intern Clinical translational science/ College of medicine Center for Health Outcomes & PharmacoEconomic Research/ College of pharmacy University of Arizona

From: Jonah Gabrymailto:notifications@github.com Sent: Thursday, October 1, 2020 1:03 PM To: stan-dev/rstanarmmailto:rstanarm@noreply.github.com Cc: Al Rawashdh, Neda M - (nalrawashdh)mailto:nalrawashdh@arizona.edu; Mentionmailto:mention@noreply.github.com Subject: [EXT]Re: [stan-dev/rstanarm] I have problem in stan_surv function (#472)

External Email

Hi @nedamasahttps://github.com/nedamasa, are you using the version of rstanarm that's currently on CRAN (i.e., that you installed with install.packages("rstanarm")? Right now the stan_surv() function is only available if you install rstanarm from the feature/survival branch on GitHub although we are hoping to release it on CRAN soon.

If you want to try installing the branch with stan_surv() you can do:

Sys.setenv(MAKEFLAGS = "-j4") # change 4 to however many cores you can/want to use to parallelize install

Sys.setenv("R_REMOTES_NO_ERRORS_FROM_WARNINGS" = "true")

remotes::install_github("stan-dev/rstanarm", ref = "feature/survival", INSTALL_opts = "--no-multiarch")

However, unlike installing from CRAN where all the models are already compiled, this will require compiling all the Stan programs rstanarm uses and so it will take some time and you will need a working version of RStan (i.e., that can successfully compile a Stan program). You may already have that and it will work but if you run into trouble with running the installation code above let us know.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/rstanarm/issues/472#issuecomment-702367121, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQA2VBBQD4272S722SYSMG3SITOBFANCNFSM4R7KHJPQ.

jgabry commented 3 years ago

1: In utils::untar(tarfile, ...) : ‘tar.exe -xf "C:\Users\Nadoosh\AppData\Local\Temp\RtmpeqoVB9\file2834f63628f.tar.gz" -C "C:/Users/Nadoosh/AppData/Local/Temp/RtmpeqoVB9/remotes2834597bea"’ returned error code 1

Hmm, usually the problems that we see are after this step but in this case it looks like it had a problem extracting the files after downloading. Do you know if you have any restrictions on your system that could prevent that?

nedamasa commented 3 years ago

No I do not ( I use windows). I tried to delete the file and to install it again but it keeps posting same error.

Get Outlook for iOShttps://aka.ms/o0ukef


From: Jonah Gabry notifications@github.com Sent: Thursday, October 1, 2020 1:55:51 PM To: stan-dev/rstanarm rstanarm@noreply.github.com Cc: Al Rawashdh, Neda M - (nalrawashdh) nalrawashdh@arizona.edu; Mention mention@noreply.github.com Subject: [EXT]Re: [stan-dev/rstanarm] I have problem in stan_surv function (#472)

External Email

1: In utils::untar(tarfile, ...) : ‘tar.exe -xf "C:\Users\Nadoosh\AppData\Local\Temp\RtmpeqoVB9\file2834f63628f.tar.gz" -C "C:/Users/Nadoosh/AppData/Local/Temp/RtmpeqoVB9/remotes2834597bea"’ returned error code 1

Hmm, usually the problems that we see are after this step but in this case it looks like it had a problem extracting the files after downloading. Do you know if you have any restrictions on your system that could prevent that?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/stan-dev/rstanarm/issues/472#issuecomment-702392597, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AQA2VBGZMP5QNZXVNZLEUFDSITUFPANCNFSM4R7KHJPQ.

jgabry commented 3 years ago

That's annoying, sorry! Unfortunately I don't know much about Windows. @bgoodri or @sambrilleman Do you have any idea what the problem is here?

sambrilleman commented 3 years ago

Sorry guys, I have no idea what that error message is meaning or what caused it.

But I think I still have a Windows binary that I downloaded when @bgoodri last supplied the binary from R-hub builder. @nedamasa If you email me I can send the binary to you, hopefully it will install easily that way (although no promises! 😬). The binary doesn't have any documentation / help files included. But I guess you could find those via Github with a bit of pain.

@jgabry Should we host a binary somewhere? I could even try host it temporarily on my personal site if they allow me to upload zip files (no idea whether I can). And if that doesn't cause some other kind of issue. Would be good to get a binary built on R-hub once the manuals have been added to the repo actually.

jgabry commented 3 years ago

But I think I still have a Windows binary that I downloaded when @bgoodri last supplied the binary from R-hub builder. @jgabry Should we host a binary somewhere?

Yeah that would be good. @rok-cesnovar @serban-nicusor-toptal Can we host the binary for the feature/survival branch over at https://github.com/stan-dev/r-packages?

rok-cesnovar commented 3 years ago

Sure, just let me know which branch. Or if you already have it built, put it somewhere temporary so we can download it and then move to stan-dev/r-packages.

jgabry commented 3 years ago

Great! The branch is https://github.com/stan-dev/rstanarm/tree/feature/survival, but it's not clear to me whether it can currently be built successfully on Windows (I don't have windows to try, but it works for me on mac). But it sounds like @bgoodri already built a Windows binary, so @sambrilleman or @bgoodri can you share that with @rok-cesnovar?

sambrilleman commented 3 years ago

Yeah no probs. Although might be good to get one rebuilt with the manuals included if possible.

I have emailed Rok the link to the download. I'm currently just sharing it with him via a public link on my personal Google Drive account, so wasn't sure if it was legit to share that link on here.

rok-cesnovar commented 3 years ago

Uploaded the binary version to stan-dec/r-packages

install.packages("rstanarm", repos = c("https://mc-stan.org/r-packages/", getOption("repos")))

should now install the binary version of the survival branch on Windows with R4. Will add the source package as well.

@jgabry mind building the mac version when you have the chance?

Thanks @sambrilleman for the binary!

sambrilleman commented 3 years ago

Epic @rok-cesnovar! Cheers!