When I was running the following code, R told me ’ C++14 standard requested but CXX14 is not defined’.

Sys.setenv(USE_Cxx14 = 1)

require(“rstan”) # observe startup messages

mstring = "data {

int<lower=0> J; // number of schools

real y[J]; // estimated treatment effects

real<lower=0> sigma[J]; // s.e. of effect estimates

}

parameters {

real mu;

real<lower=0> tau;

real eta[J];

}

transformed parameters {

real theta[J];

for (j in 1:J)

theta[j] = mu + tau * eta[j];

}

model {

target += normal_lpdf(eta | 0, 1);

target += normal_lpdf(y | theta, sigma);

}

"

smodel <- stan_model(model_code = mstring)