View source: R/exdqlmFit_methods.R
| predict.exdqlmFit | R Documentation |
exdqlmFit ObjectsComputes filtered and k-step-ahead forecast quantiles from a fitted
dynamic quantile model. The returned exdqlmForecast object can be
printed, summarized, plotted with plot(), or passed to
diagnostics.
## S3 method for class 'exdqlmFit'
predict(
object,
start.t,
k,
fFF = NULL,
fGG = NULL,
plot = FALSE,
add = FALSE,
cols = c("purple", "magenta"),
cr.percent = 0.95,
return.draws = FALSE,
n.samp = NULL,
seed = NULL,
...
)
object |
A fitted dynamic |
start.t |
Integer index at which forecasts start. |
k |
Integer number of steps ahead to forecast. |
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; if |
add |
Logical value indicating whether to add the forecasted quantiles to the current plot.
Default is |
cols |
Optional character vector of length 2 giving the colors for filtered and forecasted
quantiles respectively. Default |
cr.percent |
Optional numeric in |
return.draws |
Optional 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 |
... |
Additional arguments (unused). |
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)
M0.forecast = predict(M0, start.t = 90, k = 10,
return.draws = TRUE, n.samp = 50, seed = 123)
M0.forecast
plot(M0.forecast)
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.