Working through Mcelreath’s Rethinking book–using R. When I come to run ulam(), which passes from R to Stan, I get the following error:
Error in file(con, “r”) : cannot open the connection
In addition: Warning messages:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found
2: In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file21fc65d27950.cpp 2> file21fc65d27950.cpp.err.txt’ had status 1
3: In file(con, “r”) :
cannot open file ‘file21fc65d27950.cpp.err.txt’: No such file or directory
Error in sink(type = “output”) : invalid connection
library(rethinking)
data(rugged)
d <- rugged
d$log_gdp <- log(d$rgdppc_2000)
dd <- d[ complete.cases(d$rgdppc_2000),]
dd$log_gdp_std <- dd$log_gdp/ mean(dd$log_gdp)
dd$rugged_std <- dd$rugged/ max(dd$rugged)
dd$cid <- ifelse( dd$cont_africa==1, 1, 2)
dat_slim <- list(
log_gdp_std = dd$log_gdp_std,
rugged_std = dd$rugged_std,
cid = as.integer( dd$cid)
)
m9.1 <- ulam(
alist(
log_gdp_std ~ dnorm( mu, sigma),
mu <- a[cid] + b[cid]*( rugged_std - 0.215),
a[cid] ~ dnorm( 1, 0.1),
b[cid] ~ dnorm( 0, 0.3),
sigma ~ dexp( 1)
), data=dat_slim, chains=4, cores = 4)
Operating System: Windows
Interface Version: RStan, Rethinking Ulam
Compiler/Toolkit:
Don’t forget to add relevant tags to your topic (top right of this form) especially for application area. Delete this text before posting your topic. Thx!
Looking forward to your topic!