For me something weird happens, which I haven’t been able to figure out why. If I use library(rstan)
I get a similar error to @rcpedroso. However, I do not get the error, and everything works fine, if I use rstan::
statements without first loading the library. For example:
stan_code <- structure("data {\n int<lower=0> J; // number of schools\n real y[J]; // estimated treatment effect (school j)\n real<lower=0> sigma[J]; // std err of effect estimate (school j)\n}\nparameters {\n real mu;\n real theta[J];\n real<lower=0> tau;\n}\nmodel {\n theta ~ normal(mu, tau); \n y ~ normal(theta,sigma);\n}",
model_name2 = "eight_schools")
sm <- rstan::stan_model(model_code = stan_code)
Works fine. However,
library(rstan)
stan_code <- structure("data {\n int<lower=0> J; // number of schools\n real y[J]; // estimated treatment effect (school j)\n real<lower=0> sigma[J]; // std err of effect estimate (school j)\n}\nparameters {\n real mu;\n real theta[J];\n real<lower=0> tau;\n}\nmodel {\n theta ~ normal(mu, tau); \n y ~ normal(theta,sigma);\n}",
model_name2 = "eight_schools")
sm <- rstan::stan_model(model_code = stan_code)
gives the following error:
Error in file(con, "r") : cannot open the connection
In addition: Warning messages:
1: In system(cmd, intern = !verbose) :
running command 'C:/PROGRA~1/R/R-40~1.0/bin/x64/R CMD SHLIB file323c106d3c60.cpp 2> file323c106d3c60.cpp.err.txt' had status 1
2: In file(con, "r") :
cannot open file 'file323c106d3c60.cpp.err.txt': No such file or directory
Error in sink(type = "output") : invalid connection
The problem seems to be with the rstan
package. For instance, brms
does not give me any errors. The example:
library(brms)
bprior1 <- prior(student_t(5,0,10), class = b) +
prior(cauchy(0,2), class = sd)
fit1 <- brm(count ~ zAge + zBase * Trt + (1|patient),
data = epilepsy, family = poisson(), prior = bprior1)
Works fine. But loading rstan
first gives me an error.
Session Info:
> devtools::session_info()
- Session info ---------------------------------------------------------------------------------------------------------------
setting value
version R version 4.0.0 (2020-04-24)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_Netherlands.1252
ctype English_Netherlands.1252
tz Europe/Berlin
date 2020-06-12
- Packages -------------------------------------------------------------------------------------------------------------------
! package * version date lib source
abind 1.4-5 2016-07-21 [1] CRAN (R 4.0.0)
assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.0)
backports 1.1.7 2020-05-13 [1] CRAN (R 4.0.0)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.0.0)
bayesplot 1.7.2 2020-05-28 [1] CRAN (R 4.0.0)
bridgesampling 1.0-0 2020-02-26 [1] CRAN (R 4.0.0)
brms * 2.13.0 2020-05-27 [1] CRAN (R 4.0.0)
Brobdingnag 1.2-6 2018-08-13 [1] CRAN (R 4.0.0)
callr 3.4.3 2020-03-28 [1] CRAN (R 4.0.0)
cli 2.0.2 2020-02-28 [1] CRAN (R 4.0.0)
coda 0.19-3 2019-07-05 [1] CRAN (R 4.0.0)
colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.0)
colourpicker 1.0 2017-09-27 [1] CRAN (R 4.0.0)
crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.0)
crosstalk 1.1.0.1 2020-03-13 [1] CRAN (R 4.0.0)
desc 1.2.0 2018-05-01 [1] CRAN (R 4.0.0)
devtools 2.3.0 2020-04-10 [1] CRAN (R 4.0.0)
digest 0.6.25 2020-02-23 [1] CRAN (R 4.0.0)
dplyr 1.0.0 2020-05-29 [1] CRAN (R 4.0.0)
DT 0.13 2020-03-23 [1] CRAN (R 4.0.0)
dygraphs 1.1.1.6 2018-07-11 [1] CRAN (R 4.0.0)
ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.0)
fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.0)
fastmap 1.0.1 2019-10-08 [1] CRAN (R 4.0.0)
fs 1.4.1 2020-04-04 [1] CRAN (R 4.0.0)
generics 0.0.2 2018-11-29 [1] CRAN (R 4.0.0)
ggplot2 * 3.3.1 2020-05-28 [1] CRAN (R 4.0.0)
ggridges 0.5.2 2020-01-12 [1] CRAN (R 4.0.0)
glue 1.4.1 2020-05-13 [1] CRAN (R 4.0.0)
gridExtra 2.3 2017-09-09 [1] CRAN (R 4.0.0)
gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.0)
gtools 3.8.2 2020-03-31 [1] CRAN (R 4.0.0)
htmltools 0.4.0 2019-10-04 [1] CRAN (R 4.0.0)
htmlwidgets 1.5.1 2019-10-08 [1] CRAN (R 4.0.0)
httpuv 1.5.3.1 2020-05-26 [1] CRAN (R 4.0.0)
igraph 1.2.5 2020-03-19 [1] CRAN (R 4.0.0)
inline 0.3.15 2018-05-18 [1] CRAN (R 4.0.0)
later 1.1.0.1 2020-06-05 [1] CRAN (R 4.0.0)
D lattice 0.20-41 2020-04-02 [1] CRAN (R 4.0.0)
lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.0)
loo 2.2.0 2019-12-19 [1] CRAN (R 4.0.0)
magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.0)
markdown 1.1 2019-08-07 [1] CRAN (R 4.0.0)
D Matrix 1.2-18 2019-11-27 [1] CRAN (R 4.0.0)
matrixStats 0.56.0 2020-03-13 [1] CRAN (R 4.0.0)
memoise 1.1.0 2017-04-21 [1] CRAN (R 4.0.0)
mime 0.9 2020-02-04 [1] CRAN (R 4.0.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.0.0)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.0)
mvtnorm 1.1-0 2020-02-24 [1] CRAN (R 4.0.0)
D nlme 3.1-147 2020-04-13 [1] CRAN (R 4.0.0)
pillar 1.4.4 2020-05-05 [1] CRAN (R 4.0.0)
pkgbuild 1.0.8 2020-05-07 [1] CRAN (R 4.0.0)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.0)
pkgload 1.1.0 2020-05-29 [1] CRAN (R 4.0.0)
plyr 1.8.6 2020-03-03 [1] CRAN (R 4.0.0)
prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.0.0)
processx 3.4.2 2020-02-09 [1] CRAN (R 4.0.0)
promises 1.1.0 2019-10-04 [1] CRAN (R 4.0.0)
ps 1.3.3 2020-05-08 [1] CRAN (R 4.0.0)
purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.0)
R6 2.4.1 2019-11-12 [1] CRAN (R 4.0.0)
Rcpp * 1.0.4.6 2020-04-09 [1] CRAN (R 4.0.0)
remotes 2.1.1 2020-02-15 [1] CRAN (R 4.0.0)
reshape2 1.4.4 2020-04-09 [1] CRAN (R 4.0.0)
rlang 0.4.6 2020-05-02 [1] CRAN (R 4.0.0)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 4.0.0)
rsconnect 0.8.16 2019-12-13 [1] CRAN (R 4.0.0)
rstan * 2.19.3 2020-02-11 [1] CRAN (R 4.0.0)
rstantools 2.1.0 2020-06-01 [1] CRAN (R 4.0.0)
rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.0)
scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.0)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.0)
shiny 1.4.0.2 2020-03-13 [1] CRAN (R 4.0.0)
shinyjs 1.1 2020-01-13 [1] CRAN (R 4.0.0)
shinystan 3.0.0 2020-06-08 [1] local
shinythemes 1.1.2 2018-11-06 [1] CRAN (R 4.0.0)
StanHeaders * 2.21.0-3 2020-05-28 [1] CRAN (R 4.0.0)
stringi 1.4.6 2020-02-17 [1] CRAN (R 4.0.0)
stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.0)
testthat 2.3.2 2020-03-02 [1] CRAN (R 4.0.0)
threejs 0.3.3 2020-01-21 [1] CRAN (R 4.0.0)
tibble 3.0.1 2020-04-20 [1] CRAN (R 4.0.0)
tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.0)
usethis 1.6.1 2020-04-29 [1] CRAN (R 4.0.0)
vctrs 0.3.0 2020-05-11 [1] CRAN (R 4.0.0)
withr 2.2.0 2020-04-20 [1] CRAN (R 4.0.0)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.0.0)
xts 0.12-0 2020-01-19 [1] CRAN (R 4.0.0)
zoo 1.8-8 2020-05-02 [1] CRAN (R 4.0.0)
[1] C:/Program Files/R/R-4.0.0/library
D -- DLL MD5 mismatch, broken installation.