Description Usage Arguments References Examples
Bayesian prediction of the regression model y_{ij} = f(φ_j, t_{ij}) + ε_{ij}, φ_j\sim N(μ, Ω), ε_{ij}\sim N(0,γ^2\widetilde{s}(t_{ij})).
1 2 3 4 5 6 | ## S4 method for signature 'est.mixedRegression'
predict(object, t, only.interval = TRUE,
level = 0.05, burnIn, thinning, fun.mat, which.series = c("new",
"current"), ind.pred, M2pred = 10, cand.length = 1000,
method = c("vector", "free"), sampling.alg = c("InvMethod", "RejSamp"),
sample.length, grid, plot.prediction = TRUE)
|
object |
class object of MCMC samples: "est.mixedRegression", created with method |
t |
vector of time points to make predictions for |
only.interval |
if TRUE: only calculation of prediction intervals |
level |
level of the prediction intervals |
burnIn |
burn-in period |
thinning |
thinning rate |
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") |
method |
vectorial ("vector") or not ("free") |
sampling.alg |
sampling algorithm, inversion method ("InvMethod") or rejection sampling ("RejSamp") |
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 | mu <- c(10, 5); Omega <- c(0.9, 0.01)
phi <- cbind(rnorm(21, mu[1], sqrt(Omega[1])), rnorm(21, mu[2], sqrt(Omega[2])))
model <- set.to.class("mixedRegression",
parameter = list(phi = phi, mu = mu, Omega = Omega, gamma2 = 0.1),
fun = function(phi, t) phi[1]*t + phi[2], sT.fun = function(t) 1)
t <- seq(0, 1, by = 0.01)
data <- simulate(model, t = t)
est <- estimate(model, t, data[1:20,], 2000)
plot(est)
pred <- predict(est, fun.mat = function(phi, t) phi[,1]*t + phi[,2])
points(t, data[21,], pch = 20)
t.list <- list()
for(i in 1:20) t.list[[i]] <- t
t.list[[21]] <- t[1:50]
data.list <- list()
for(i in 1:20) data.list[[i]] <- data[i,]
data.list[[21]] <- data[21, 1:50]
est <- estimate(model, t.list, data.list, 100)
pred <- predict(est, t = t[50:101], which.series = "current", ind.pred = 21,
fun.mat = function(phi, t) phi[,1]*t + phi[,2])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.