嘿,我最近正在学习软件包“ pomp”。而且我不知道为什么我的代码中有这样的错误,来源是https://kingaa.github.io/pomp/vignettes/pompjss.pdf
library(pomp)
# state function
gompertz.proc.sim <- function(x, t, params, delta.t, ...) {
eps <- exp(rnorm(n = 1, mean = 0, sd = params["sigma"]))
S <- exp(-params["r"] * delta.t)
setNames(params["K"]^(1 - S) * x["X"]^S * eps, "X")
}
# obs
gompertz.meas.sim <- function(x, t, params, ...){
setNames(rlnorm(n = 1, meanlog = log(x["X"]), sdlog = params["tau"]), "Y")
}
# density
gompertz.meas.dens <- function(y, x, t, params, log, ...) {
dlnorm(x=y["Y"], meanlog = log(x["X"]), sdlog = params["tau"], log = log )
}
# build our 'pomp' object
gompertz <- pomp(data = data.frame(time = 1:100, Y = NA), times = "time",
rprocess = discrete_time(step.fun = gompertz.proc.sim, delta.t = 1),
rmeasure = gompertz.meas.sim, t0 = 0
)
# assign values to params
theta <- c(r = 0.1, K = 1, sigma = 0.1, tau = 0.1, X.0 = 1)
# simulate values for our obs
gompertz <- simulate(gompertz, params = theta )
```
答案 0 :(得分:0)
您的代码将与旧版本的pomp一起使用。但是,pomp当前具有较新的版本。请检查此链接https://kingaa.github.io/pomp/vignettes/upgrade_guide.html
请注意,JSS中的论文适用于老式盛况。