我正在尝试遵循包 fanplot 中的示例,但找不到 ew.txt 文件。我会很感激你的帮助。
data(ew)
plot(ew)
## Not run:
plot(ew.mcmc)
##
##Create your own (longer) MCMC sample
##
# data
r <- diff(log(ew))
r <- ts(exp(r) - 1, start(ew))
library("R2OpenBUGS")
# write model file:
ew.bug <- dget(system.file("model", "ew.txt", package = "fanplot"))
write.model(ew.bug, "ew.txt")
# take a look:
file.show("ew.txt")
# run openbugs
ew.mcmc <- bugs(data = list(N = length(r), H = 25, r = c(r), p = c(ew)),
inits = list(list(a = exp(12), psi = 0.5, itau2 = 0.5)),
param = c("alpha", "psi", "tau", "r.new", "p.new", "y.sim"),
model = "ew.txt",
n.iter = 11000, n.burnin = 1000, n.chains = 1, n.thin = 1)
## End(Not run)