Hi guys, I’m trying to run a map2stan but I keep getting this error:
running command ‘C:/PROGRA~1/R/R-36~1.1/bin/x64/R CMD SHLIB file3764100376c.cpp 2> file3764100376c.cpp.err.txt’ had status 1Error in sink(type = “output”) : invalid connection.
Error in map2stan(alist(log_gdp ~ dnorm(mu, sigma), mu ← a + bR * rugged + : Something went wrong, when calling Stan. Check any debug messages for clues, detective. invalid connection
Here’s the code I’m trying to run:
map2stan(
alist(
log_gdp ~ dnorm( mu , sigma ) ,
mu <- a + bR*rugged + bA*cont_africa + bAR*rugged*cont_africa ,
a ~ dnorm(0, 100),
bR ~ dnorm(0, 10),
bA ~ dnorm(0, 10),
bAR ~ dnorm(0, 10),
sigma ~ dunif(0, 10)
), data=dd.trim )
What does this error mean and what do I do?
I am using the data(rugged) dataset from the rethinking package. The code that preceded the error code is:
library(rethinking)
data(rugged)
d <- rugged
d$log_gdp <- log(d$rgdppc_2000)
dd <- d[ complete.cases(d$rgdppc_2000) , ]
dd.trim = dd[ , c("log_gdp","rugged","cont_africa") ]
str(dd.trim)