predSDE: Bayesian prediction in mixed SDE models

Description Usage Arguments Value Examples

Description

Bayesian prediction in the mixed SDE dY_j(t)= b(φ_j, t, Y_j(t))dt + γ s(t, Y_j(t)) dW_j(t), , φ_j~N(μ, Ω).

Usage

1
predSDE(tau, samples, last, bSDE, sVar, cand, mod = "Gompertz", modVar = "")

Arguments

tau

vector of times which are predicted

samples

list of samples from the posterior

last

last observation - staring point for the prediction of Markov chain

bSDE

drift function

sVar

variance function

cand

vector of candidates for trajection sampling

mod

model out of Gompertz, Richards, logistic, Weibull, only used instead of bSDE

modVar

model for the variance structure

Value

matrix of predictions in t

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mod <- "Gompertz"
bSDE <- getFun("SDE", mod)
mu <- getPar("SDE", mod, "truePar")
n <- 5
parameters <- defaultPar(mu, n)
y <- drawData("SDE", bSDE, parameters)
t <- parameters$t

prior <- getPrior(mu, parameters$gamma2)
start <- getStart(mu, n)
chains <- estSDE(t, y, prior, cut = 50, ipred = 1, start, bSDE, len = 5000)
ind <- seq(1001, 5000, by = 4)
samples <- list(phi = sapply(1:length(mu), function(i) phi = phi_ij(chains$phi, 1, i))[ind, ], gamma2 = chains$gamma2[ind])
prediction <- predSDE(t[50:101], samples, y[1,50], bSDE, cand = seq(-2, 2, length = 1000))
plot(t[51:101], y[1,51:101], ylim = range(y[1,51:101]) + c(0, 1))
lines(t[51:101], apply(prediction, 1, quantile, 0.025), col = 3)
lines(t[51:101], apply(prediction, 1, quantile, 0.975), col = 3)
lines(t[51:101], apply(prediction, 1, mean), col = 2)

SimoneHermann/hierRegSDE documentation built on May 9, 2019, 1:46 p.m.