Samples were drawn using NUTS(diag_e) at Fri Nov 06 10:01:28 2020.
For each parameter, n_eff is a crude measure of effective sample size,
and Rhat is the potential scale reduction factor on split chains (at
convergence, Rhat=1).
Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
Hmm, I’ve never seen this before (RStan working but brms crashing). Sorry for the trouble!
The next test is to get the model and data that brms creates and try running that through rstan.
Can you try the following:
library(brms)
library(rstan)
stancode = make_stancode(formula = time | cens(censored) ~ age * sex + disease
+ (1 + age|patient), cores = 4,
data = kidney, family = lognormal(),
prior = c(set_prior("normal(0,5)", class = "b"),
set_prior("cauchy(0,2)", class = "sd"),
set_prior("lkj(2)", class = "cor")))
standata = make_standata(formula = time | cens(censored) ~ age * sex + disease
+ (1 + age|patient), cores = 4,
data = kidney, family = lognormal(),
prior = c(set_prior("normal(0,5)", class = "b"),
set_prior("cauchy(0,2)", class = "sd"),
set_prior("lkj(2)", class = "cor")))
mod = stan(model_code=stancode,data=standata)
I wanna install rstan in windows, the only problem is that I don´t have my Rtools in the default location I have to put it somewhere else, so I put in makevar.win the new location and follow the instalion steps but when I call the library or run stan I got the following error:
Error in cleanup_makevar(old) :
argument "RMU" is missing, with no default
In addition: Warning messages:
1: In readLines(file, warn = TRUE) :
incomplete final line found on '\\home.org.aalto.fi\alonzoi1\data\Documents\school.stan'
2: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'Z:/rtools40/usr/mingw_/bin/g++' not found
3: In readLines(file.path(makevar_files)) :
incomplete final line found on '//home.org.aalto.fi/alonzoi1/data/Documents/.R/Makevars.win'
4: In readLines(old_path) :
incomplete final line found on '//home.org.aalto.fi/alonzoi1/data/Documents/.R/Makevars.win'
RStan on windows currently doesn’t like a Makevars.win file and throws that error. You have a couple of options here. First, you can use the .Renviron and/or .Rprofile files to configure where R looks for compilers and remove your Makevars file.
Instead (or in addition to), you can downgrade your withr package to 2.20, which should work:
devtools::install_version("withr",version="2.20")
Then restart R and try again.
Also, add a blank line to the end of your Makevars.win file and stan code to remove the incomplete final line errors
So the first parts of the stan code run just fine. Then when I try to run the mod code it crashed on me twice. Then when I got it to not crash it gave me this again:
Error in unserialize(socklist[[n]]) : error reading from connection
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
Error in serialize(data, node$con, xdr = FALSE) :
error writing to connection
Sys.getenv(“PATH”)
[1] “C:\rtools40\usr\bin;C:\Program Files\R\R-4.0.3\bin\x64;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;D:\JRE\bin;C:\Users\JoJo\AppData\Local\Microsoft\WindowsApps”
Sys.getenv(“BINPREF”)
[1] “”
readLines(“~/.R/Makevars.win”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/JoJo/Documents/.R/Makevars.win’: No such file or directory
readLines(“~/.Rprofile”)
Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
cannot open file ‘C:/Users/JoJo/Documents/.Rprofile’: No such file or directory
readLines(“~/.Renviron”)
[1] “PATH="{RTOOLS40_HOME}\\usr\\bin;{PATH}"”
devtools::session_info(“rstan”)
Session info ---------------------------------------------------------------------------------------------------------------------------
setting value
version R version 4.0.3 (2020-10-10)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/New_York
date 2020-11-09
Hi @andrjohns I am trying to install rstan in windows, and after following all the procedures in the stan repository, but I still have some problems. When I ran
Error in compileCode(f, code, language = language, verbose = verbose) :
cc1plus.exe: fatal error: \home.org.aalto.fi/alonzoi1/data/Documents/R/win-library/4.0/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directorycompilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.3/etc/x64/Makeconf:229: file20869442cca.o] Error 1
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
Thank you in advance.
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
While the R and RStudio programs themselves are installed on the C:/ drive, your R packages (rstan, etc.) are installed in your ‘Home’ directory, which the error message above indicates is on an external network drive (\home.org.aalto.fi/alonzoi1/data/Documents). You need to move your R packages to a folder on your local C:/ Drive.
I posted some instructions on how to do this over in this post. Those instructions were putting the R packages in the C:/Users/R folder, so just change that path to wherever you want to move your R packages to