我试图在rstan中使用基本模型,我收到了这个错误:
错误:
TRANSLATING MODEL 'model_code' FROM Stan CODE TO C++ CODE NOW.
Error in .Call("CPP_stanc260", model_code, model_cppname) :
"CPP_stanc260" not resolved from current namespace (rstan)
回溯:
> traceback()
4: .Call("CPP_stanc260", model_code, model_cppname)
3: stanc(file = file, model_code = model_code, model_name = model_name,
verbose, ...)
2: stan_model(file, model_name = model_name, model_code = model_code,
boost_lib = boost_lib, eigen_lib = eigen_lib, save_dso = save_dso,
verbose = verbose, ...)
1: stan(model_code = model_code, data = LC_stan_data, iter = 1000,
chains = 4)
完整代码:
> log_bid_price_sample
[1] 7.025538 6.437752 6.684612 5.857933 5.298317 4.382027 4.605170 4.605170 5.521461 7.090077 5.164786
[12] 6.856462 3.401197 7.090077 5.703782 3.911823 6.214608 6.214608 5.703782 5.703782
LC_stan_data <- list(N = 20,
log_bid_price = log_bid_price[1:20],
lawncare_needs = rnorm(20, mean = log_bid_price, sd = 10))
model_code = "
data {
int <lower=0> N;
real log_bid_price[N];
real lawncare_needs[N];
}
parameters{
real beta[1];
real <lower = 0> sigma;
}
model {
log_bid_price ~ normal(beta*Lawncare_needs, sigma)
}
"
fit <- stan(model_code = model_code, data = LC_stan_data,
iter = 1000, chains = 4)
造成错误的原因是什么?