Description Usage Arguments References Examples
Bayesian prediction of the model Z_{ij} = Y_{t_{ij}} + ε_{ij}, dY_t = b(φ_j,t,Y_t)dt + γ \widetilde{s}(t,Y_t)dW_t, φ_j~N(μ, Ω).
1 2 3 4 5 6 | ## S4 method for signature 'est.hiddenmixedDiffusion'
predict(object, t, burnIn, thinning,
b.fun.mat, which.series = c("new", "current"), ind.pred, M2pred = 10,
cand.length = 1000, pred.alg = c("Distribution", "Trajectory",
"simpleTrajectory", "simpleBayesTrajectory"), sample.length, grid,
plot.prediction = TRUE)
|
object |
class object of MCMC samples: "est.hiddenmixedDiffusion", created with method |
t |
vector of time points to make predictions for |
burnIn |
burn-in period |
thinning |
thinning rate |
b.fun.mat |
matrix-wise definition of drift function (makes it faster) |
which.series |
which series to be predicted, new one ("new") or further development of current one ("current") |
ind.pred |
index of series to be predicted, optional, if which.series = "current" and ind.pred missing, the last series is taken |
M2pred |
optional, if current series to be predicted and t missing, |
cand.length |
length of candidate samples (if method = "vector") |
pred.alg |
prediction algorithm, "Distribution", "Trajectory", "simpleTrajectory" or "simpleBayesTrajectory" |
sample.length |
number of samples to be drawn, default is the number of posterior samples |
grid |
fineness degree of sampling approximation |
plot.prediction |
if TRUE, prediction intervals are plotted |
Hermann, S. (2016a). BaPreStoPro: an R Package for Bayesian Prediction of Stochastic Processes. SFB 823 discussion paper 28/16.
Hermann, S. (2016b). Bayesian Prediction for Stochastic Processes based on the Euler Approximation Scheme. SFB 823 discussion paper 27/16.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | mu <- c(5, 1); Omega <- c(0.9, 0.04)
phi <- cbind(rnorm(21, mu[1], sqrt(Omega[1])), rnorm(21, mu[2], sqrt(Omega[2])))
y0.fun <- function(phi, t) phi[2]
model <- set.to.class("hiddenmixedDiffusion", y0.fun = y0.fun,
b.fun = function(phi, t, y) phi[1],
parameter = list(phi = phi, mu = mu, Omega = Omega, gamma2 = 1, sigma2 = 0.01))
t <- seq(0, 1, by = 0.01)
data <- simulate(model, t = t)
## Not run:
est_hidmixdiff <- estimate(model, t, data$Z[1:20,], 200)
plot(est_hidmixdiff)
pred1 <- predict(est_hidmixdiff, b.fun.mat = function(phi, t, y) phi[,1])
pred2 <- predict(est_hidmixdiff, pred.alg = "Trajectory", b.fun.mat = function(phi, t, y) phi[,1])
pred3 <- predict(est_hidmixdiff, pred.alg = "simpleTrajectory", sample.length = nrow(pred1$Y))
lines(t, apply(pred1$Z, 2, quantile, 0.025), col = 3)
lines(t, apply(pred1$Z, 2, quantile, 0.975), col = 3)
lines(t, apply(pred2$Z, 2, quantile, 0.025), col = 4)
lines(t, apply(pred2$Z, 2, quantile, 0.975), col = 4)
pred4 <- predict(est_hidmixdiff, pred.alg = "simpleBayesTrajectory")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.