View source: R/exdqlmForecast.R
| exdqlmForecast | R Documentation |
Computes filtered and k-step-ahead forecast quantiles from a fitted
dynamic quantile model and optionally adds them to an existing plot.
exdqlmForecast(
start.t,
k,
m1,
fFF = NULL,
fGG = NULL,
plot = TRUE,
add = FALSE,
cols = c("purple", "magenta"),
cr.percent = 0.95,
return.draws = FALSE,
n.samp = NULL,
seed = NULL
)
start.t |
Integer index at which forecasts start (must be within the span of the fitted model in |
k |
Integer number of steps ahead to forecast. |
m1 |
A fitted exDQLM model object, returned by |
fFF |
Optional state vector(s) for the forecast steps. A numeric matrix with
|
fGG |
Optional evolution matrix/matrices for the forecast steps. Either a numeric
|
plot |
Logical value indicating whether to plot filtered and forecast quantiles with
equal–tailed credible intervals. Default is |
add |
Logical value indicating whether to add the forecasted quantiles to the current plot.
Default is |
cols |
Character vector of length 2 giving the colors for filtered and forecasted
quantiles respectively. Default |
cr.percent |
Numeric in |
return.draws |
Logical; if |
n.samp |
Optional positive integer specifying how many forecast draws to
return when |
seed |
Optional integer random seed used only for forecast-draw
generation when |
An object of class "exdqlmForecast" containing the following:
start.t Integer index at which forecasts start (within the span of the fitted model in m1).
k Integer number of steps ahead forecasted.
m1 The fitted exDQLM model object used to initialize the forecast.
cr.percent The probability mass for the credible
intervals (e.g., 0.95).
fa Forecast state mean vectors (q \times k matrix).
fR Forecast state covariance matrices (q \times q \times k array).
ff Forecast quantile means (length-k numeric).
fQ Forecast quantile variances (length-k numeric).
samp.fore Optional posterior predictive forecast draws
(k x n.samp) returned when return.draws = TRUE.
# Toy example
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 20L)
y = scIVTmag[1:100]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15, n.samp = 30,
verbose = FALSE)
exdqlmForecast(start.t = 90, k = 10, m1 = M0)
M0.forecast = exdqlmForecast(start.t = 90, k = 10, m1 = M0,
return.draws = TRUE, n.samp = 50, seed = 123)
dim(M0.forecast$samp.fore)
options(old)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.