| Title: | Extended Dynamic Quantile Linear Models |
| Version: | 0.4.0 |
| Author: | Raquel Barata [aut, cre], Raquel Prado [ths], Bruno Sanso [ths], Antonio Aguirre [aut] |
| Maintainer: | Raquel Barata <raquel.a.barata@gmail.com> |
| Description: | Bayesian quantile-regression routines for dynamic state-space models and static regression under the extended asymmetric Laplace (exAL) error distribution. The dynamic state-space models are extended dynamic quantile linear models (exDQLMs). The package combines dynamic exDQLM inference via LDVB, MCMC, and legacy ISVB with static exAL regression via LDVB and MCMC, reduced AL/DQLM paths through fixed skewness, component builders for trend/seasonality/regression blocks, static shrinkage priors including ridge, regularized horseshoe, and 'rhs_ns', evidence lower bound diagnostics, optional C++ accelerators, and posterior predictive synthesis across separately fitted quantiles through 'quantileSynthesis()'. Dynamic exDQLM methods are described in Barata et al. (2020) <doi:10.1214/21-AOAS1497>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 3.5) |
| Imports: | stats, methods, graphics, coda, tictoc, magic, crch, truncnorm, FNN, LaplacesDemon, grDevices, Rcpp, matrixStats, nimble, numDeriv |
| Suggests: | rmarkdown, testthat (≥ 3.0.0), ggplot2, pkgload, MASS |
| Config/testthat/edition: | 3 |
| LinkingTo: | BH, Rcpp, RcppArmadillo, RcppEigen |
| SystemRequirements: | C++17; OpenMP (optional) |
| URL: | https://github.com/AntonioAPDL/exdqlm |
| BugReports: | https://github.com/AntonioAPDL/exdqlm/issues |
| NeedsCompilation: | yes |
| Packaged: | 2026-05-03 16:26:17 UTC; raquel |
| Repository: | CRAN |
| Date/Publication: | 2026-05-04 07:00:22 UTC |
exdqlm: Extended Dynamic Quantile Linear Models
Description
Bayesian quantile-regression tools for dynamic state-space models and static regression under the extended asymmetric Laplace error distribution (exAL).
Details
The package centers on native dynamic quantile state-space modeling for
univariate time series, while version 0.4.0 also provides a static exAL
regression workflow. Across these settings, exdqlm combines model
construction helpers, multiple Bayesian inference engines, shrinkage priors
for static coefficients, and post hoc synthesis of several fitted quantiles.
Main workflows
Dynamic/state-space quantile modeling via
exdqlmLDVB()andexdqlmMCMC(), with legacyexdqlmISVB()retained for backward compatibility and transfer-function extensions throughexdqlmTransferLDVB(),exdqlmTransferMCMC(), and legacyexdqlmTransferISVB().Static Bayesian exAL regression via
exalStaticLDVB()andexalStaticMCMC().Modular state-space construction via
polytrendMod(),seasMod(), andregMod().Multi-quantile post-processing via
quantileSynthesis()for post hoc posterior-predictive synthesis from separately fitted quantiles into a unified predictive distribution.
Distinctive features in 0.4.0
Dynamic Bayesian quantile state-space inference with LDVB as the main VB engine, MCMC for posterior simulation, and legacy ISVB retained for compatibility and historical comparisons.
A unified package covering both dynamic exDQLM models and static exAL regression.
Static shrinkage priors including ridge, regularized horseshoe (
"rhs"), andrhs_ns.Reduced AL/DQLM paths through
dqlm.ind = TRUEin both dynamic and static APIs.Standardized VB diagnostics traces via
fit$diagnostics$vb_tracefor ELBO,sigma,gamma, and convergence deltas across VB engines.Conservative automatic warmup defaults for the most failure-prone shared blocks: RHS-family
tauscheduling plus exAL(sigma, gamma)warmup in VB and MCMC entry points, with explicit controls available only when users need to override the defaults.Optional C++ acceleration for selected state-space computations.
Runtime options
-
options(exdqlm.use_cpp_kf = TRUE|FALSE)– C++ Kalman bridge (optional; default TRUE). -
options(exdqlm.compute_elbo = TRUE|FALSE)– Compute ELBO (optional; default TRUE). -
options(exdqlm.tol_elbo = numeric)– Positive ELBO convergence tolerance used whenexdqlm.compute_elbo = TRUE; smaller values enforce stricter ELBO stabilization checks (default1e-6). -
options(exdqlm.use_cpp_builders = TRUE|FALSE)– C++ model builders (optional; default FALSE). -
options(exdqlm.use_cpp_samplers = TRUE|FALSE)– C++ samplers (optional; default FALSE). -
options(exdqlm.use_cpp_postpred = TRUE|FALSE)– C++ posterior predictive sampler (optional; default FALSE). -
options(exdqlm.use_cpp_mcmc = TRUE|FALSE)– MCMC backend routing (optional; default TRUE). -
options(exdqlm.cpp_mcmc_mode = "strict"|"fast")– strict keeps legacy R-kernel parity; fast enables C++ FFBS in MCMC (default "fast"). -
options(exdqlm.cpp_threads = numeric)– Positive integer thread cap for eligible OpenMP-enabled C++ paths (1Lforces single-thread; default1L).
Author(s)
Maintainer: Raquel Barata raquel.a.barata@gmail.com
Authors:
Antonio Aguirre
Other contributors:
Raquel Prado [thesis advisor]
Bruno Sanso [thesis advisor]
See Also
Useful links:
Addition for exdqlm objects
Description
Combines two state space blocks into a single state space model for an exDQLM.
Usage
## S3 method for class 'exdqlm'
m1 + m2
Arguments
m1 |
object of class " |
m2 |
object of class " |
Value
An object of class "exdqlm" containing the new combined state space model components:
FF - Observational vector.
GG - Evolution matrix.
m0 - Prior mean of the state vector.
C0 - Prior covariance of the state vector.
Examples
trend.comp = polytrendMod(2, rep(0, 2), 10*diag(2))
seas.comp = seasMod(365, c(1,2,4), C0 = 10*diag(6))
model = trend.comp + seas.comp
Monthly streamflow at the Big Trees gauge
Description
Observed monthly mean streamflow, in cubic feet per second, at the Big Trees gauge on the San Lorenzo River in Santa Cruz County, California. The monthly values were obtained by averaging the daily USGS streamflow observations within each calendar month.
Usage
BTflow
Format
A monthly time series (ts) of length 471, spanning January 1987
through March 2026.
Source
U.S. Geological Survey, National Water Information System (USGS Water Data for the Nation), https://waterdata.usgs.gov/.
References
U.S. Geological Survey (2016). National Water Information System data available on the World Wide Web (USGS Water Data for the Nation). https://waterdata.usgs.gov/.
Daily time-series of ELI anomalies.
Description
ELI anomalies on the daily time-scale from January 1, 1979 to December 31, 2019 with all February 29ths omitted.
Usage
ELIanoms
Format
A time series of length 14965.
Source
https://portal.nersc.gov/archive/home/projects/cascade/www/ELI
References
Patricola, C.M., O’Brien, J.P., Risser, M.D. et al. Maximizing ENSO as a source of western US hydroclimate predictability. Clim Dyn 54, 351–372 (2020). doi:10.1007/s00382-019-05004-8
exdqlm objects
Description
as.exdqlm attempts to turn a list into an exdqlm object. Works for time-invariant dlm objects created using the dlm package.
Usage
as.exdqlm(m)
Arguments
m |
a list containing named elements m0, C0, FF and GG. |
Value
An object of class "exdqlm" containing the state space model components:
FF - Observational vector.
GG - Evolution matrix.
m0 - Prior mean of the state vector.
C0 - Prior covariance of the state vector.
Monthly climate indices for streamflow examples
Description
Monthly atmospheric and oceanic climate indices used as external predictors in the Big Trees streamflow examples. Values are stored on their original scales; examples that combine indices standardize the relevant columns within the analysis code.
Usage
climateIndices
Format
A data frame with 516 rows and 3 variables:
- date
First day of the calendar month.
- noi
Northern Oscillation Index.
- amo
Atlantic Multidecadal Oscillation index.
The data frame spans January 1980 through December 2022.
Source
Compiled from the NOAA Physical Sciences Laboratory monthly climate indices collection, https://psl.noaa.gov/data/climateindices/.
Plot a component of an exDQLM
Description
The function plots the dynamic MAP estimates and 95% credible intervals (CrIs) of a specified component of an exDQLM. Alternatively, if just.theta=TRUE the MAP estimates and 95% credible intervals (CrIs) of a single element of the dynamic state vector are plotted.
Usage
compPlot(
m1,
index,
add = FALSE,
col = "purple",
just.theta = FALSE,
cr.percent = 0.95
)
Arguments
m1 |
An object of class " |
index |
Vector of consecutive integers in |
add |
Logical value indicating whether the dynamic component will be added to existing plot. Default is |
col |
Character vector of length 1 giving color of the dynamic component to be plotted. Default is |
just.theta |
Logical; if |
cr.percent |
Numeric in |
Value
A list of the following is returned:
-
map.comp- MAP estimate of the dynamic component (or element of the state vector). -
lb.comp- Lower bound of the 95% CrIs of the dynamic component (or element of the state vector). -
ub.comp- Upper bound of the 95% CrIs of the dynamic component (or element of the state vector).
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:80]
trend.comp = polytrendMod(2, rep(0, 2), 10*diag(2))
seas.comp = seasMod(365, c(1, 2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.98, 1), dim.df = c(2, 4),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
# plot first harmonic component
compPlot(M0, index = c(3, 4), col = "blue")
options(old)
Density Function for the Extended Asymmetric Laplace (exAL) Distribution
Description
Computes the PDF of the Extended Asymmetric Laplace (exAL) distribution.
Vectorized over x.
Usage
dexal(x, p0 = 0.5, mu = 0, sigma = 1, gamma = 0, log = FALSE)
Arguments
x |
Numeric vector of quantiles. |
p0 |
Probability level used in the quantile parametrization. Scalar in (0, 1). Default |
mu |
Location parameter (scalar). Default |
sigma |
Scale parameter (scalar, strictly positive). Default |
gamma |
Skewness parameter controlling asymmetry (scalar). Must be within valid bounds implied by |
log |
Logical scalar; if |
Value
Numeric vector of densities (same length as x).
Examples
dexal(0)
dexal(1, p0 = 0.75, mu = 0, sigma = 2, gamma = 0.25)
dexal(seq(-3, 3, by = 0.1), p0 = 0.3, mu = 0, sigma = 1, gamma = -0.45)
exAL Diagnostics
Description
Static diagnostics companion for exalStaticLDVB() and
exalStaticMCMC(). The function summarizes fitted quantiles on a
shared design matrix, reports mean check loss against observed responses when
available, and can optionally compare the fitted quantile curve against a
known reference quantile function.
Usage
exalStaticDiagnostics(
m1,
m2 = NULL,
X = NULL,
y = NULL,
ref = NULL,
plot = TRUE,
cols = c("red", "blue"),
cr.percent = 0.95
)
Arguments
m1 |
An object of class |
m2 |
Optional second fitted static model to compare against |
X |
Optional design matrix. If omitted, the function uses |
y |
Optional response vector. If omitted, the function uses |
ref |
Optional reference quantile vector on the same rows as |
plot |
Logical; if |
cols |
Character vector of length 1 or 2 giving colors for plotted diagnostics. |
cr.percent |
Credible-interval mass used when summarizing fitted quantiles. |
Details
Unlike exdqlmDiagnostics, which is built around one-step-ahead
dynamic forecast diagnostics, exalStaticDiagnostics() is designed for the
static regression setting. It reports fitted quantile summaries on a common
design matrix, optional mean check loss against observed responses, optional
truth/reference errors, and compact comparison plots.
Value
An object of class "exalStaticDiagnostic" containing fitted-quantile
summaries, residual summaries (when y is provided), optional
reference-curve error metrics, and run-time metadata for m1 and
m2 (if supplied).
Examples
set.seed(1)
x <- seq(-2, 2, length.out = 60)
X <- cbind(1, x)
y <- 0.5 * x + (1.2 + 0.35 * x) * stats::rnorm(length(x))
q_true <- 0.5 * x + (1.2 + 0.35 * x) * stats::qnorm(0.25)
fit_ldvb <- exalStaticLDVB(
y = y, X = X, p0 = 0.25,
max_iter = 60, tol = 1e-3,
verbose = FALSE
)
fit_mcmc <- exalStaticMCMC(
y = y, X = X, p0 = 0.25,
n.burn = 60, n.mcmc = 60,
mh.proposal = "slice",
verbose = FALSE
)
out <- exalStaticDiagnostics(fit_ldvb, fit_mcmc, ref = q_true, plot = FALSE)
print(out)
Static exAL Regression - LDVB Approximation
Description
The function applies a mean-field variational approximation to static
Extended Asymmetric Laplace (exAL) regression. Closed-form block updates are
combined with a Laplace-Delta approximation for the joint
(\sigma,\gamma) block, yielding the package's static LDVB routine.
Usage
exalStaticLDVB(
y,
X,
p0,
max_iter = 1000,
tol = 1e-04,
b0 = NULL,
V0 = NULL,
beta_prior = c("ridge", "rhs", "rhs_ns"),
beta_prior_controls = NULL,
a_sigma = 1,
b_sigma = 1,
gamma_bounds = c(L.fn(p0), U.fn(p0)),
log_prior_gamma = NULL,
init = NULL,
dqlm.ind = FALSE,
al.ind = NULL,
n.samp = 200,
n_samp_xi = 200,
ld_controls = NULL,
vb_control = NULL,
verbose = TRUE
)
Arguments
y |
Numeric vector (length n). |
X |
Numeric matrix (n x p). |
p0 |
Target quantile in (0,1). |
max_iter |
Integer; maximum LDVB iterations (default 1000). |
tol |
Numeric; convergence tolerance based on relative ELBO changes (default 1e-4). |
b0, V0 |
Prior mean and covariance for |
beta_prior |
Coefficient prior type: |
beta_prior_controls |
Optional list of prior-specific controls. For
RHS-family priors (that is, when |
a_sigma, b_sigma |
Prior for |
gamma_bounds |
Two-vector (L, U) support for |
log_prior_gamma |
Function |
init |
Optional list with starting values: |
dqlm.ind |
Logical; if |
al.ind |
Optional static-model alias for |
n.samp |
Number of samples to draw from the approximated posterior
distribution after convergence. Default is |
n_samp_xi |
Integer; retained for backward compatibility in the Laplace-Delta block. Under the current delta-only implementation this value is ignored. |
ld_controls |
Optional list of controls for the Laplace-Delta block.
Supported keys include |
vb_control |
Optional normalized VB control list, usually from
|
verbose |
Logical; print progress. |
Details
Mean-field factorization:
q(\beta)\ \prod_{i=1}^n q(v_i)\ q(s_i)\ q(\sigma,\gamma).
This factorization induces a blockwise coordinate-ascent variational
inference scheme. The (\sigma,\gamma) block is the only nonconjugate
component, so LDVB approximates it in transformed coordinates
\eta=\mathrm{logit}((\gamma-L)/(U-L)) and \ell=\log\sigma.
The xi expectations needed by the remaining block updates are then
computed with a second-order Delta approximation. The xi expectations
used in the updates can be computed either from a
deterministic second-order Delta approximation in (\eta,\ell) or from a
Gaussian Monte Carlo sample. The Laplace-Delta controls also allow bounded
optimization in the transformed (\eta,\ell) block to better mimic the
stabilized RHS-family readout implementation. For RHS-family priors, the
prior block uses tau warmup/freeze scheduling to avoid the
early-collapse regime where global shrinkage drives all slope coefficients
toward zero before the likelihood-side variational factors stabilize.
Value
An object of class "exalStaticLDVB" containing:
-
qbeta: list withm,V. -
samp.beta: posterior sample fromq(\beta)withn.samprows. -
qv: list withchi(length n),psi(scalar),E_vandE_inv_v(moments). -
qs: list withmu(length n),tau2(length n),E_s,E_s2. -
qsiggam: list witheta_hat,ell_hat,Sigma(2x2), approximate meansgamma_mean,sigma_mean, and thexiexpectations. -
samp.sigma,samp.gamma: posterior samples from the variational approximation for the scale and skewness parameters. In the AL special case (dqlm.ind = TRUE),samp.gammais a vector of zeros. -
converged,iter,run.time, andmisc(includingp0, boundsL,U, dimensions, and ELBO trace). -
beta_prior: prior metadata and, for RHS-family priors, posterior summaries of the shrinkage hyperparameters, including warmup/freeze-awaretausummaries and collapse diagnostics (collapse_flag,tau_near_zero,beta_collapse, andwarningwhen triggered). For"rhs_ns", the state also trackslambda2,nu,tau2,xi, andzeta2with the corresponding inverse moments. -
diagnostics: ELBO and joint-convergence diagnostics including a standardized VB iteration trace atdiagnostics$vb_trace(iteration-wise ELBO / sigma / gamma / convergence deltas), state/sigma/gamma/ELBO deltas, stopping reason, and Laplace-Delta block trace diagnostics, including replicated-xicontrols, automatic stabilization / cycle-detection fields, and final local-mode quality checks. For RHS fits this also includesdiagnostics$rhswith the resolved preflight configuration and collapse diagnostics.
Examples
set.seed(123)
n <- 60
X <- cbind(1, seq(-1, 1, length.out = n))
y <- as.numeric(X %*% c(0.2, -0.1) + rnorm(n, sd = 0.15))
fit <- exalStaticLDVB(y = y, X = X, p0 = 0.5, max_iter = 60, tol = 1e-3, verbose = FALSE)
fit$converged
head(fit$diagnostics$vb_trace)
fit_rhs <- exalStaticLDVB(
y = y, X = X, p0 = 0.5,
beta_prior = "rhs",
beta_prior_controls = list(tau0 = 0.5, nu = 3, s2 = 1, shrink_intercept = FALSE),
max_iter = 50, tol = 5e-3, verbose = FALSE
)
fit_rhs$beta_prior$type
fit_rhs_ns <- exalStaticLDVB(
y = y, X = X, p0 = 0.5,
beta_prior = "rhs_ns",
beta_prior_controls = list(tau0 = 0.5, a_zeta = 1.5, b_zeta = 1, zeta2_fixed = 1),
max_iter = 50, tol = 5e-3, verbose = FALSE
)
fit_rhs_ns$beta_prior$type
fit_al <- exalStaticLDVB(
y = y, X = X, p0 = 0.5,
al.ind = TRUE,
max_iter = 50, tol = 5e-3, verbose = FALSE
)
fit_al$dqlm.ind
exAL (static) - MCMC algorithm
Description
The function applies a Gibbs sampler for static Extended Asymmetric Laplace regression
(exAL). We update \beta, v, s from their full conditionals, then update
(\sigma,\gamma) either jointly on transformed coordinates
(\ell,\eta)=(\log \sigma,\mathrm{logit}((\gamma-L)/(U-L))) (for
"rw" and "laplace_rw") or with univariate gamma kernels
("slice", "slice_eta", "laplace_local").
Optional multi-refresh and global-jump controls are available to improve
exAL mixing in hard cases.
Usage
exalStaticMCMC(
y,
X,
p0,
b0 = NULL,
V0 = NULL,
beta_prior = c("ridge", "rhs", "rhs_ns"),
beta_prior_controls = NULL,
a_sigma = 1,
b_sigma = 1,
gamma_bounds = c(L.fn(p0), U.fn(p0)),
log_prior_gamma = NULL,
init = NULL,
dqlm.ind = FALSE,
al.ind = NULL,
n.burn = 2000,
n.mcmc = 1500,
thin = 1,
init.from.vb = FALSE,
vb_init_controls = NULL,
vb_init_fit = NULL,
mcmc_control = NULL,
sigmagam_controls = NULL,
mh.proposal = c("slice", "laplace_rw", "rw", "slice_eta", "laplace_local"),
mh.adapt = TRUE,
mh.adapt.interval = 50L,
mh.target.accept = c(0.2, 0.45),
mh.scale.bounds = c(0.1, 10),
mh.max_scale.step = 0.35,
mh.min_burn_adapt = 50L,
slice.width = 0.1,
slice.max.steps = Inf,
gamma.substeps = 1L,
p.global.eta.jump = 0,
global.eta.jump.scale = 1,
trace.diagnostics = TRUE,
trace.every = 1L,
verbose = TRUE,
progress_callback = NULL
)
Arguments
y |
Numeric vector of length |
X |
Numeric matrix |
p0 |
Quantile level in |
b0, V0 |
Prior mean and covariance for |
beta_prior |
Coefficient prior type: |
beta_prior_controls |
Optional list of prior-specific controls. For
RHS-family priors (that is, when |
a_sigma, b_sigma |
Hyperparameters for an inverse-gamma prior on
|
gamma_bounds |
Numeric length-2 vector (L, U) for |
log_prior_gamma |
Function |
init |
Optional list with starting values: |
dqlm.ind |
Logical; if |
al.ind |
Optional static-model alias for |
n.burn |
Number of burn-in iterations. Default |
n.mcmc |
Number of kept MCMC iterations (after burn). Default |
thin |
Integer; save every |
init.from.vb |
Logical; if |
vb_init_controls |
Optional list controlling VB warm start. Supported keys:
|
vb_init_fit |
Optional precomputed static VB fit object used as the
warm-start reference when |
mcmc_control |
Optional normalized MCMC control list, usually from
|
sigmagam_controls |
Optional list controlling warmup/freeze behavior
for the nonconjugate |
mh.proposal |
Character string controlling the exAL nonconjugate update
kernel. |
mh.adapt |
Logical; adapt the random-walk proposal scale during burn-in
for |
mh.adapt.interval |
Integer adaptation window for RW-based kernels. |
mh.target.accept |
Numeric length-2 target acceptance band. |
mh.scale.bounds |
Numeric length-2 lower/upper bounds for RW proposal scale multiplier. |
mh.max_scale.step |
Numeric multiplicative adaptation cap in |
mh.min_burn_adapt |
Integer minimum burn-in before adaptation starts. |
slice.width |
Positive numeric width for bounded slice updates when
|
slice.max.steps |
Positive integer or |
gamma.substeps |
Positive integer; number of consecutive gamma-kernel
refreshes per outer MCMC iteration. Default |
p.global.eta.jump |
Numeric in |
global.eta.jump.scale |
Positive numeric scale multiplier applied to the Laplace proposal SD used in global eta jumps. |
trace.diagnostics |
Logical; if |
trace.every |
Positive integer; when |
verbose |
Print progress every |
progress_callback |
Optional callback invoked with a named list at MCMC start, at each progress checkpoint, and on completion. Intended for workflow-level per-case progress logging. |
Value
An object of class "exalStaticMCMC" containing:
-
run.time- total wall time in seconds. -
X,p0,bounds- design, quantile, and (L, U). -
samp.beta- posterior sample ofbetaascoda::mcmc(n.mcmc x p). -
samp.sigma- posterior sample ofsigmaascoda::mcmc. -
samp.gamma- posterior sample ofgammaascoda::mcmc. -
samp.v- latentvdraws ascoda::mcmc(n.mcmc x n). -
samp.s- latentsdraws ascoda::mcmc(n.mcmc x n). -
samp.lambda,samp.tau,samp.c2- RHS latent draws when an RHS-family prior is used; otherwiseNULL. -
beta_prior- prior metadata and, for RHS-family priors, posterior summaries of the shrinkage block. For"rhs_ns", the state trackslambda2,nu,tau2,xi, andzeta2. -
mh.diagnostics- proposal kernel diagnostics for the exAL gamma update, including whether the saved kernel is exact/signoff-ready. -
rhs.diagnostics- RHS latent summaries and optional trace metadata when an RHS-family prior is used, including the resolved preflight configuration used at fit start. -
last- last state of the chain (useful for restarts).
Examples
set.seed(123)
n <- 60; p <- 3
X <- cbind(1, rnorm(n), rnorm(n))
beta0 <- c(0.5, -1, 0.8); sigma0 <- 1.2
y <- as.numeric(X %*% beta0 + rnorm(n, 0, sigma0))
fit <- exalStaticMCMC(
y, X, p0 = 0.5, n.burn = 60, n.mcmc = 60, thin = 1, verbose = FALSE
)
summary(fit$samp.beta)
fit_rhs <- exalStaticMCMC(
y, X, p0 = 0.5,
beta_prior = "rhs",
beta_prior_controls = list(tau0 = 0.5, nu = 3, s2 = 1, shrink_intercept = FALSE),
n.burn = 50, n.mcmc = 50, thin = 1, mh.proposal = "slice", verbose = FALSE
)
fit_rhs$beta_prior$type
fit_rhs_ns <- exalStaticMCMC(
y, X, p0 = 0.5,
beta_prior = "rhs_ns",
beta_prior_controls = list(tau0 = 0.5, a_zeta = 1.5, b_zeta = 1, zeta2_fixed = 1),
n.burn = 40, n.mcmc = 40, thin = 1, mh.proposal = "slice", verbose = FALSE
)
fit_rhs_ns$beta_prior$type
fit_al <- exalStaticMCMC(
y, X, p0 = 0.5,
al.ind = TRUE,
n.burn = 50, n.mcmc = 50, thin = 1, verbose = FALSE
)
fit_al$dqlm.ind
Build advanced MCMC control
Description
Returns a readable mcmc_control list for exalStaticMCMC() and
exdqlmMCMC(). This keeps the warmup surface explicit instead of relying on
ad hoc nested lists.
Usage
exal_make_mcmc_control(
n_burn = 2000L,
n_mcmc = 1500L,
thin = 1L,
verbose = FALSE,
progress_every = NULL,
init_from_vb = TRUE,
vb_warm_start_control = NULL,
sigmagam = NULL,
theta = NULL,
latent_state = NULL,
dqlm_sigma = NULL,
control = NULL
)
Arguments
n_burn, n_mcmc, thin, verbose |
Core MCMC controls. |
progress_every |
Optional progress cadence for callers that support it. |
init_from_vb |
Logical; initialize from a VB warm start. |
vb_warm_start_control |
Optional VB warm-start control list, often from
|
sigmagam |
Optional list, usually from
|
theta |
Optional list, usually from |
latent_state |
Optional list, usually from
|
dqlm_sigma |
Optional list, usually from
|
control |
Optional existing control list to update. |
Value
A normalized list suitable for mcmc_control.
Build DQLM sigma-only MCMC warmup control
Description
Returns a normalized mcmc_control$dqlm_sigma block for exdqlmMCMC() in
the reduced AL / DQLM branch.
Usage
exal_make_mcmc_dqlm_sigma_control(
freeze_burnin_iters = 0L,
freeze_only_during_burn = TRUE,
force_after_warmup = TRUE,
trace = TRUE
)
Arguments
freeze_burnin_iters |
Non-negative integer; number of burn-in iterations to hold the sigma-only block fixed. |
freeze_only_during_burn |
Logical; if |
force_after_warmup |
Logical; force one immediate post-warmup update. |
trace |
Logical; record diagnostics traces. |
Value
A normalized list suitable for mcmc_control$dqlm_sigma.
Build dynamic MCMC latent-state warmup control
Description
Returns a normalized mcmc_control$latent_state block for exdqlmMCMC().
Usage
exal_make_mcmc_latent_state_control(
mode = c("u_only", "u_st_pair"),
freeze_burnin_iters = 0L,
freeze_only_during_burn = TRUE,
force_after_warmup = TRUE,
min_postwarmup_updates = 0L,
trace = TRUE
)
Arguments
mode |
One of |
freeze_burnin_iters |
Non-negative integer; number of burn-in iterations to hold the latent-state block fixed. |
freeze_only_during_burn |
Logical; if |
force_after_warmup |
Logical; force one immediate post-warmup update. |
min_postwarmup_updates |
Non-negative integer; minimum number of post-warmup updates required before chain-health style gates can fire. |
trace |
Logical; record diagnostics traces. |
Value
A normalized list suitable for mcmc_control$latent_state.
Build MCMC sigmagam warmup control
Description
Returns a normalized mcmc_control$sigmagam block for exalStaticMCMC() and
exdqlmMCMC().
Usage
exal_make_mcmc_sigmagam_control(
freeze_burnin_iters = NULL,
freeze_only_during_burn = NULL,
force_after_warmup = NULL,
delay_adapt_until_after_warmup = NULL,
delay_laplace_refresh_until_after_warmup = NULL
)
Arguments
freeze_burnin_iters |
Non-negative integer; number of burn-in iterations
to hold the |
freeze_only_during_burn |
Logical; if |
force_after_warmup |
Logical; force one post-warmup update. |
delay_adapt_until_after_warmup |
Logical; keep proposal adaptation off until warmup ends. |
delay_laplace_refresh_until_after_warmup |
Logical; keep Laplace refresh off until warmup ends. |
Value
A normalized list suitable for mcmc_control$sigmagam.
When called with no arguments, this returns the package's conservative
default exAL (sigma, gamma) MCMC warmup profile.
Build MCMC theta warmup control
Description
Returns a normalized mcmc_control$theta block for exdqlmMCMC().
Usage
exal_make_mcmc_theta_control(
enabled = FALSE,
freeze_burnin_iters = 0L,
freeze_only_during_burn = TRUE,
sparse_update_every = 1L,
sparse_update_until_iter = 0L,
force_first_postwarmup_update = TRUE,
trace = TRUE
)
Arguments
enabled |
Logical; explicit on/off switch. |
freeze_burnin_iters |
Non-negative integer; number of burn-in iterations to hold the theta block fixed. |
freeze_only_during_burn |
Logical; if |
sparse_update_every |
Positive integer; sparse-update period during the warmup window. |
sparse_update_until_iter |
Non-negative integer; last iteration where the sparse schedule is active. |
force_first_postwarmup_update |
Logical; force one update immediately after the hard freeze / sparse schedule ends. |
trace |
Logical; record diagnostics traces. |
Value
A normalized list suitable for mcmc_control$theta.
Build advanced VB control
Description
Returns a readable vb_control list for exalStaticLDVB() and
exdqlmLDVB(). This keeps the warmup surface explicit instead of relying on
ad hoc nested lists.
Usage
exal_make_vb_control(
max_iter = 150L,
tol = 1e-04,
n_samp_xi = 200L,
verbose = FALSE,
sigmagam = NULL,
sts = NULL,
control = NULL
)
Arguments
max_iter, tol, n_samp_xi, verbose |
Core VB controls. |
sigmagam |
Optional list, usually from
|
sts |
Optional list, usually from |
control |
Optional existing control list to update. |
Value
A normalized list suitable for vb_control.
Build VB sigmagam warmup control
Description
Returns a normalized sigmagam block for vb_control lists used by
exalStaticLDVB(), exdqlmLDVB(), and VB warm-start paths in
exalStaticMCMC() and exdqlmMCMC().
Usage
exal_make_vb_sigmagam_control(
freeze_warmup_iters = NULL,
force_after_warmup = NULL,
postwarmup_damping = NULL,
postwarmup_damping_iters = NULL,
min_postwarmup_updates = NULL
)
Arguments
freeze_warmup_iters |
Non-negative integer; number of early VB iterations
during which the |
force_after_warmup |
Logical; force one immediate post-warmup update. |
postwarmup_damping |
Numeric in |
postwarmup_damping_iters |
Non-negative integer; number of damped post-warmup iterations. |
min_postwarmup_updates |
Non-negative integer; minimum number of post-warmup updates required before convergence-style gates can fire. |
Value
A normalized list suitable for vb_control$sigmagam.
When called with no arguments, this returns the package's conservative
default exAL (sigma, gamma) warmup profile.
Build dynamic VB latent-state warmup control
Description
Returns a normalized sts block for vb_control lists used by
exdqlmLDVB().
Usage
exal_make_vb_sts_control(
freeze_warmup_iters = 0L,
force_after_warmup = TRUE,
min_postwarmup_updates = 0L
)
Arguments
freeze_warmup_iters |
Non-negative integer; number of early VB iterations
during which the latent |
force_after_warmup |
Logical; force one immediate post-warmup update. |
min_postwarmup_updates |
Non-negative integer; minimum number of post-warmup updates required before convergence-style gates can fire. |
Value
A normalized list suitable for vb_control$sts.
exDQLM Diagnostics
Description
The function computes the following for the model(s) provided: the posterior predictive loss criterion based off the check loss, the CRPS from posterior predictive draws, the one-step-ahead distribution sequence, and both the forward and reversed KL divergences from normality. The function also plots the following: the qq-plot and ACF plot corresponding to the one-step-ahead distribution sequence, and a time series plot of the MAP standard forecast errors.
Usage
exdqlmDiagnostics(
m1,
m2 = NULL,
plot = TRUE,
cols = c("red", "blue"),
ref = NULL
)
Arguments
m1 |
An object of class " |
m2 |
An optional additional object of class " |
plot |
Logical value indicating whether the following will be plotted for |
cols |
Character vector of length 1 or 2 giving color(s) used to plot diagnostics. Default |
ref |
Optional reference sample of size |
Value
An object of class "exdqlmDiagnostic" containing the following:
-
m1.uts- The one-step-ahead distribution sequence ofm1. -
m1.KL- The KL divergence ofm1.utsand a standard normal. -
m1.KL.flip- The reversed ("flipped") KL divergence ofm1.utsand a standard normal. -
m1.CRPS- The mean CRPS computed from posterior predictive draws. -
m1.pplc- The posterior predictive loss criterion ofm1based off the check loss function. -
m1.qq- The ordered pairs of the qq-plot comparingm1.utswith a standard normal distribution. -
m1.acf- The autocorrelations ofm1.utsby lag. -
m1.rt- Run-time of the original modelm1in seconds. -
m1.msfe- MAP standardized one-step-ahead forecast errors from the original modelm1. -
y- The original time-series used to fitm1.
If m2 is provided, analogous results for m2 are also included in the list.
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.95), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
M0.diags = exdqlmDiagnostics(M0, plot = FALSE)
options(old)
k-step-ahead quantile forecasts
Description
Computes filtered and k-step-ahead forecast quantiles from a fitted
dynamic quantile model and optionally adds them to an existing plot.
Usage
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
)
Arguments
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 |
Value
An object of class "exdqlmForecast" containing the following:
-
start.tInteger index at which forecasts start (within the span of the fitted model inm1). -
kInteger number of steps ahead forecasted. -
m1The fitted exDQLM model object used to initialize the forecast. -
cr.percentThe probability mass for the credible intervals (e.g.,0.95). -
faForecast state mean vectors (q \times kmatrix). -
fRForecast state covariance matrices (q \times q \times karray). -
ffForecast quantile means (length-knumeric). -
fQForecast quantile variances (length-knumeric). -
samp.foreOptional posterior predictive forecast draws (k x n.samp) returned whenreturn.draws = TRUE.
Examples
# 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)
exDQLM - legacy ISVB algorithm
Description
The function applies an Importance Sampling Variational Bayes (ISVB)
algorithm to estimate the posterior of an exDQLM. This legacy VB engine is
retained for backward compatibility and historical comparisons; for standard
exDQLM VB fits, exdqlmLDVB() is the main default technique.
Usage
exdqlmISVB(
y,
p0,
model,
df,
dim.df,
fix.gamma = FALSE,
gam.init = NA,
fix.sigma = FALSE,
sig.init = NA,
dqlm.ind = FALSE,
exps0,
tol = 0.1,
n.IS = 500,
n.samp = 200,
PriorSigma = NULL,
PriorGamma = NULL,
verbose = TRUE,
debug_shapes = FALSE,
debug_every = 5
)
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
fix.gamma |
Logical value indicating whether to fix gamma at |
gam.init |
Initial value for gamma (skewness parameter), or value at which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
exps0 |
Initial value for dynamic quantile. If |
tol |
Tolerance for convergence of dynamic quantile estimates. Default is |
n.IS |
Number of particles for the importance sampling of joint variational distribution of sigma and gamma. Default is |
n.samp |
Number of samples to draw from the approximated posterior distribution. Default is |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape |
PriorGamma |
List of parameters for truncated student-t prior on gamma; center |
verbose |
Logical value indicating whether progress should be displayed. |
debug_shapes |
Logical; if TRUE, print KF input/output shapes every |
debug_every |
Integer; frequency (in iterations) for shape prints when |
Details
Advanced options (set via options()):
-
exdqlm.use_cpp_kf: use the C++ Kalman filter bridge (default TRUE). -
exdqlm.compute_elbo: compute ELBO every iteration (default TRUE). -
exdqlm.tol_elbo: ELBO convergence tolerance (default 1e-6). -
exdqlm.tol_sigma: sigma-delta convergence tolerance (default:tol). -
exdqlm.tol_gamma: gamma-delta convergence tolerance (default:tol). -
exdqlm.vb.min_iter: minimum iterations before convergence can trigger (default 10). -
exdqlm.vb.patience: number of consecutive joint-converged iterations required (default 3). -
exdqlm.use_cpp_samplers: use C++ samplers for s_t, u_t, theta (default FALSE). The GIG-based u_t sampler always uses the package C++ Devroye implementation; when FALSE, the remaining samplers fall back to R implementations. -
exdqlm.use_cpp_postpred: use C++ posterior predictive sampler (default FALSE).
Value
An object of class "exdqlmISVB" containing the following:
-
y- Time-series data used to fit the model. -
run.time- Algorithm run time in seconds. -
iter- Number of iterations until convergence was reached. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block. -
dim.df- Dimension used for each block of discount factors. -
sig.init- Initial value for sigma, or value at which sigma was fixed iffix.sigma=TRUE. -
seq.sigma- Sequence of sigma estimated by the algorithm until convergence. -
samp.theta- Posterior sample of the state vector variational distribution. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma variational distribution. -
samp.vts- Posterior sample of latent parameters, v_t, variational distributions. -
theta.out- List containing the variational distribution of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
vts.out- List containing the variational distributions of latent parameters v_t. -
fix.sigmaLogical value indicating whether sigma was fixed atsig.init. -
diagnostics- List containing ELBO trace, standardized VB iteration tracediagnostics$vb_trace(iteration-wise ELBO / sigma / gamma / convergence deltas), and convergence diagnostics (joint stopping status, deltas for state/sigma/gamma/ELBO, and criteria used).
If dqlm.ind=FALSE, the object also contains:
-
gam.init- Initial value for gamma, or value at which gamma was fixed iffix.gamma=TRUE. -
seq.gamma- Sequence of gamma estimated by the algorithm until convergence. -
samp.gamma- Posterior sample of skewness parameter gamma variational distribution. -
samp.sts- Posterior sample of latent parameters, s_t, variational distributions. -
gammasig.out- List containing the IS estimate of the variational distribution ofsigmaandgamma. -
sts.out- List containing the variational distributions of latent parameters s_t. -
fix.gammaLogical value indicating whether gamma was fixed atgam.init.
Or if dqlm.ind=TRUE, the object also contains:
-
sig.out- As above but for the DQLM case (gamma = 0); list containing the IS estimate of the variational distribution of sigma.
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 20L)
y = scIVTmag[1:120]
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
seas.comp = seasMod(365, c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
# Legacy ISVB fit retained for backward-compatible comparisons
M0 = exdqlmISVB(y, p0 = 0.85, model, df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15, tol = 0.2,
n.IS = 20, n.samp = 20, verbose = FALSE)
head(M0$diagnostics$vb_trace)
M0_al = exdqlmISVB(y, p0 = 0.85, model, df = c(1,1), dim.df = c(1,4),
dqlm.ind = TRUE, sig.init = 15, tol = 0.2,
n.IS = 20, n.samp = 20, verbose = FALSE)
tail(M0_al$diagnostics$vb_trace$elbo, 2)
options(old)
exDQLM - LDVB algorithm (Laplace-Delta)
Description
The function applies a Laplace-Delta Variational Bayes (LDVB) algorithm to estimate the posterior of an exDQLM.
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
fix.gamma |
Logical value indicating whether to fix gamma at |
gam.init |
Initial value for gamma (skewness parameter), or value at which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
exps0 |
Initial value for dynamic quantile. If |
tol |
Tolerance for convergence of dynamic quantile estimates. Default is |
n.samp |
Number of samples to draw from the approximated posterior distribution. Default is |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape |
PriorGamma |
List of parameters for truncated student-t prior on gamma; center |
vb_control |
Optional normalized VB control list, usually from
|
verbose |
Logical value indicating whether progress should be displayed. |
debug_shapes |
Logical; if TRUE, print KF input/output shapes every |
debug_every |
Integer; frequency (in iterations) for shape prints when |
Details
Advanced options (set via options()):
-
exdqlm.use_cpp_kf: use the C++ Kalman filter bridge (default TRUE). -
exdqlm.compute_elbo: compute ELBO every iteration (default TRUE). -
exdqlm.tol_elbo: ELBO convergence tolerance (default 1e-6). -
exdqlm.tol_sigma: sigma-delta convergence tolerance (default:tol). -
exdqlm.tol_gamma: gamma-delta convergence tolerance (default:tol). -
exdqlm.vb.min_iter: minimum iterations before convergence can trigger (default 10). -
exdqlm.vb.patience: number of consecutive joint-converged iterations required (default 3). -
exdqlm.use_cpp_samplers: use C++ samplers for s_t, u_t, theta (default FALSE). The GIG-based u_t sampler always uses the package C++ Devroye implementation; when FALSE, the remaining samplers fall back to R implementations. -
exdqlm.use_cpp_postpred: use C++ posterior predictive sampler (default FALSE). -
exdqlm.dynamic.ldvb.sts: optional warmup/freeze controls for the exDQLM latents_tVB block. Supported fields arefreeze_warmup_iters,force_after_warmup, andmin_postwarmup_updates.
Value
An object of class "exdqlmLDVB" containing the following:
-
y- Time-series data used to fit the model. -
run.time- Algorithm run time in seconds. -
iter- Number of iterations until convergence was reached. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block. -
dim.df- Dimension used for each block of discount factors. -
sig.init- Initial value for sigma, or value at which sigma was fixed iffix.sigma=TRUE. -
seq.sigma- Sequence of sigma estimated by the algorithm until convergence. -
samp.theta- Posterior sample of the state vector variational distribution. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma variational distribution. -
samp.vts- Posterior sample of latent parameters, v_t, variational distributions. -
theta.out- List containing the variational distribution of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
vts.out- List containing the variational distributions of latent parameters v_t. -
fix.sigmaLogical value indicating whether sigma was fixed atsig.init. -
diagnostics- List containing ELBO trace, standardized VB iteration tracediagnostics$vb_trace(iteration-wise ELBO / sigma / gamma / convergence deltas), and convergence diagnostics (joint stopping status, deltas for state/sigma/gamma/ELBO, and criteria used).
If dqlm.ind=FALSE, the list also contains:
-
gam.init- Initial value for gamma, or value at which gamma was fixed iffix.gamma=TRUE. -
seq.gamma- Sequence of gamma estimated by the algorithm until convergence. -
samp.gamma- Posterior sample of skewness parameter gamma variational distribution. -
samp.sts- Posterior sample of latent parameters, s_t, variational distributions. -
gammasig.out- List containing the LD (Laplace-Delta) approximation for the variational distribution ofsigmaandgamma(means, transformed Hessian, and ELBO components). -
sts.out- List containing the variational distributions of latent parameters s_t. -
fix.gammaLogical value indicating whether gamma was fixed atgam.init.
Or if dqlm.ind=TRUE, the list also contains:
-
sig.out- As above but for the DQLM case (gamma = 0), the LD approximation forsigma.
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 20L)
y = scIVTmag[1:80]
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
seas.comp = seasMod(365, c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15, tol = 0.2,
n.samp = 20, verbose = FALSE)
M0_al = exdqlmLDVB(y, p0 = 0.85, model, df = c(1,1), dim.df = c(1,4),
dqlm.ind = TRUE, sig.init = 15, tol = 0.2,
n.samp = 20, verbose = FALSE)
options(old)
exDQLM - MCMC algorithm
Description
The function applies a Markov chain Monte Carlo (MCMC) algorithm to sample the posterior of an exDQLM.
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
fix.gamma |
Logical value indicating whether to fix gamma at
|
gam.init |
Initial value for gamma (skewness parameter), or value at
which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which
sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
Sig.mh |
Covariance matrix used in the random walk MH step to jointly sample sigma and gamma. |
joint.sample |
Logical value indicating whether or not to recompute |
n.burn |
Number of MCMC iterations to burn. Default is |
n.mcmc |
Number of MCMC iterations to sample. Default is |
init.from.isvb |
Logical value indicating whether to use the legacy ISVB
warm start when |
init.from.vb |
Optional logical. If |
vb_init_controls |
Optional list controlling VB warm start. Supported keys:
|
vb_init_fit |
Optional precomputed VB fit object. If supplied, warm start uses this object directly and does not rerun VB internally. |
mcmc_control |
Optional normalized MCMC control list, usually from
|
sigmagam_controls |
Optional list controlling warmup/freeze for the exDQLM sigma/gamma block during MCMC. |
latent_state_controls |
Optional list controlling early latent-state
warmup/freeze in dynamic MCMC. Supported keys include
|
theta_state_controls |
Optional list controlling early theta-state
warmup/freeze in dynamic MCMC. Supported keys include
|
dqlm_sigma_controls |
Optional list controlling sigma-only
warmup/freeze in the DQLM branch. Supported keys mirror
|
mh.proposal |
Character; proposal kernel for the exDQLM scale/skew block.
|
mh.adapt |
Logical; adapt MH proposal scale during burn-in. |
mh.adapt.interval |
Integer; adaptation interval (iterations). |
mh.target.accept |
Numeric length-2 vector with lower/upper target acceptance rates. |
mh.scale.bounds |
Numeric length-2 vector with min/max global scaling for MH covariance. |
mh.max_scale.step |
Numeric in (0,1); maximum fractional scale change per adaptation step. |
mh.min_burn_adapt |
Minimum burn-in iterations required to enable adaptation. |
slice.width |
Positive numeric width for the bounded slice sampler when
|
slice.max.steps |
Positive integer or |
trace.diagnostics |
Logical; if |
trace.every |
Positive integer; when |
verbose.every |
Positive integer controlling how often console progress
is printed when |
progress_callback |
Optional callback invoked with a named list at MCMC start, at each progress checkpoint, and on completion. Intended for workflow-level progress logging. |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape
|
PriorGamma |
List of parameters for truncated Student-t prior on gamma;
center |
verbose |
Logical value indicating whether progress should be displayed. |
Value
An object of class "exdqlmMCMC" containing the following:
-
y- Time-series data used to fit the model. -
run.time- Algorithm run time in seconds. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block. -
dim.df- Dimension used for each block of discount factors. -
samp.theta- Posterior sample of the state vector. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma. -
samp.vts- Posterior sample of latent parameters, v_t. -
theta.out- List containing the distributions of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
n.burnNumber of MCMC iterations that were burned. -
n.mcmcNumber of MCMC iterations that were sampled.
If dqlm.ind=FALSE, the object also contains the following:
-
samp.gamma- Posterior sample of skewness parameter gamma. -
samp.sts- Posterior sample of latent parameters, s_t. -
init.log.sigma- Burned samples of log sigma from the random walk MH joint sampling of sigma and gamma. -
init.logit.gamma- Burned samples of logit gamma from the random walk MH joint sampling of sigma and gamma. -
accept.rate- Acceptance rate of the MH step. -
accept.rate.burn- MH acceptance rate during burn-in. -
accept.rate.keep- MH acceptance rate in kept MCMC samples. -
Sig.mh- Covariance matrix used in MH step to jointly sample sigma and gamma. -
mh.diagnostics- MH tuning diagnostics (proposal mode, scaling path, adaptation summary). -
diagnostics- ESS and chain-ready summaries for sigma/gamma.
Examples
data("scIVTmag", package = "exdqlm")
y = scIVTmag[1:80]
trend.comp = polytrendMod(order = 1, m0 = stats::quantile(y, 0.85), C0 = 10)
seas.comp = seasMod(p = 365, h = c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M2 = exdqlmMCMC(y, p0=0.85, model, df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
n.burn = 40, n.mcmc = 40,
init.from.vb = FALSE, verbose = FALSE)
M2_al = exdqlmMCMC(y, p0=0.85, model, df = c(1,1), dim.df = c(1,4),
dqlm.ind = TRUE, sig.init = 15,
n.burn = 30, n.mcmc = 30,
init.from.vb = FALSE, verbose = FALSE)
Plot exDQLM
Description
The function plots the MAP estimates and 95% credible intervals (CrIs) of the dynamic quantile of an exDQLM.
Usage
exdqlmPlot(m1, add = FALSE, col = "purple", cr.percent = 0.95)
Arguments
m1 |
An object of class " |
add |
Logical value indicating whether the dynamic quantile will be added to existing plot. Default is |
col |
Character vector of length 1 giving color of the dynamic quantile to be plotted. Default is |
cr.percent |
Numeric in |
Value
A list of the following is returned:
-
map.quant- MAP estimate of the dynamic quantile. -
lb.quant- Lower bound of the 95% CrIs of the dynamic quantile. -
ub.quant- Upper bound of the 95% CrIs of the dynamic quantile.
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
exdqlmPlot(M0, col = "blue")
options(old)
Transfer Function exDQLM - legacy ISVB algorithm
Description
The function applies an Importance Sampling Variational Bayes (ISVB)
algorithm to estimate the posterior of an exDQLM with exponential-decay
transfer function component. This transfer wrapper is retained as a legacy
path; exdqlmTransferLDVB() is the main VB transfer entry point.
Usage
exdqlmTransferISVB(
y,
p0,
model,
X,
df,
dim.df,
lam,
tf.df,
fix.gamma = FALSE,
gam.init = NA,
fix.sigma = FALSE,
sig.init = NA,
dqlm.ind = FALSE,
exps0,
tol = 0.1,
n.IS = 500,
n.samp = 200,
PriorSigma = NULL,
PriorGamma = NULL,
tf.m0 = NULL,
tf.C0 = NULL,
verbose = TRUE
)
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
X |
A numeric vector or matrix of transfer-function inputs. Vectors are treated as a univariate input series. Matrices should have one row per time point and one column per covariate. |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
lam |
Transfer function rate parameter lambda, a value between 0 and 1. |
tf.df |
Discount factor specification for the transfer function
component. If |
fix.gamma |
Logical value indicating whether to fix gamma at |
gam.init |
Initial value for gamma (skewness parameter), or value at which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
exps0 |
Initial value for dynamic quantile. If |
tol |
Tolerance for convergence of dynamic quantile estimates. Default is |
n.IS |
Number of particles for the importance sampling of joint variational distribution of sigma and gamma. Default is |
n.samp |
Number of samples to draw from the approximated posterior distribution. Default is |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape |
PriorGamma |
List of parameters for truncated student-t prior on gamma; center |
tf.m0 |
Prior mean of the transfer function component. Defaults to a
zero vector of length |
tf.C0 |
Prior covariance of the transfer function component. Defaults to
the |
verbose |
Logical value indicating whether progress should be displayed. |
Details
Advanced options (set via options()):
-
exdqlm.use_cpp_kf: use the C++ Kalman filter bridge (default TRUE). -
exdqlm.compute_elbo: compute ELBO every iteration (default TRUE). -
exdqlm.tol_elbo: ELBO convergence tolerance (default 1e-6). -
exdqlm.use_cpp_samplers: use C++ samplers for s_t, u_t, theta (default FALSE). The GIG-based u_t sampler always uses the package C++ Devroye implementation; when FALSE, the remaining samplers fall back to R implementations. -
exdqlm.use_cpp_postpred: use C++ posterior predictive sampler (default FALSE).
Value
An object of class "exdqlmISVB" containing the following:
-
run.time- Algorithm run time in seconds. -
iter- Number of iterations until convergence was reached. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the augmented state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block, including transfer function component. -
dim.df- Dimension used for each block of discount factors, including transfer function component. -
lam- Transfer function rate parameter lambda. -
sig.init- Initial value for sigma, or value at which sigma was fixed iffix.sigma=TRUE. -
seq.sigma- Sequence of sigma estimated by the algorithm until convergence. -
samp.theta- Posterior sample of the state vector variational distribution. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma variational distribution. -
samp.vts- Posterior sample of latent parameters, v_t, variational distributions. -
theta.out- List containing the variational distribution of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
vts.out- List containing the variational distributions of latent parameters v_t. -
median.kt- Median number of time steps until the aggregated transfer effect|x_t^\top \psi_{t-1}|is less than or equal to 1e-3.
If dqlm.ind=FALSE, the object also contains:
-
gam.init- Initial value for gamma, or value at which gamma was fixed iffix.gamma=TRUE. -
seq.gamma- Sequence of gamma estimated by the algorithm until convergence. -
samp.gamma- Posterior sample of skewness parameter gamma variational distribution. -
samp.sts- Posterior sample of latent parameters, s_t, variational distributions. -
gammasig.out- List containing the IS estimate of the variational distribution ofsigmaandgamma. -
sts.out- List containing the variational distributions of latent parameters s_t.
Or if dqlm.ind=TRUE, the object also contains:
-
sig.out- As above but for the DQLM case (gamma = 0); list containing the IS estimate of the variational distribution of sigma.
Examples
data("scIVTmag", package = "exdqlm")
data("ELIanoms", package = "exdqlm")
old = options(exdqlm.max_iter = 20L)
y = scIVTmag[1:120]
X = ELIanoms[1:120]
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
seas.comp = seasMod(365, c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
# Legacy ISVB transfer fit retained for backward-compatible comparisons
M1 = exdqlmTransferISVB(y, p0 = 0.85, model = model,
X, df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97,0.97),
n.IS = 20, n.samp = 20, tol = 0.2,
verbose = FALSE)
X_multi = cbind(ELIanoms[1:120], scale(scIVTmag[1:120])[, 1])
M2 = exdqlmTransferISVB(y, p0 = 0.85, model = model,
X_multi, df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97, 0.99),
n.IS = 20, n.samp = 20, tol = 0.2,
verbose = FALSE)
options(old)
Transfer Function exDQLM - LDVB algorithm
Description
The function applies a Laplace-Delta Variational Bayes (LDVB) algorithm to
estimate the posterior of an exDQLM with an exponential-decay transfer
function component. For multivariate transfer inputs, each column of
X has its own instantaneous coefficient state in \psi_t, while a
single scalar decay rate lam controls persistence of the accumulated
transfer effect \zeta_t.
Usage
exdqlmTransferLDVB(
y,
p0,
model,
X,
df,
dim.df,
lam,
tf.df,
fix.gamma = FALSE,
gam.init = NA,
fix.sigma = FALSE,
sig.init = NA,
dqlm.ind = FALSE,
exps0,
tol = 0.1,
n.samp = 200,
PriorSigma = NULL,
PriorGamma = NULL,
tf.m0 = NULL,
tf.C0 = NULL,
verbose = TRUE,
debug_shapes = FALSE,
debug_every = 5
)
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
X |
A numeric vector or matrix of transfer-function inputs. Vectors are treated as a univariate input series. Matrices should have one row per time point and one column per covariate. |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
lam |
Single transfer-function decay-rate parameter |
tf.df |
Discount factor specification for the transfer function
component. These discount factors control the evolution variances of the
transfer states, separately from the deterministic decay rate
|
fix.gamma |
Logical value indicating whether to fix gamma at |
gam.init |
Initial value for gamma (skewness parameter), or value at which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
exps0 |
Initial value for dynamic quantile. If |
tol |
Tolerance for convergence of dynamic quantile estimates. Default is |
n.samp |
Number of samples to draw from the approximated posterior distribution. Default is |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape |
PriorGamma |
List of parameters for truncated student-t prior on gamma; center |
tf.m0 |
Prior mean of the transfer function component. Defaults to a
zero vector of length |
tf.C0 |
Prior covariance of the transfer function component. Defaults to
the |
verbose |
Logical value indicating whether progress should be displayed. |
debug_shapes |
Logical; if TRUE, print KF input/output shapes every |
debug_every |
Integer; frequency (in iterations) for shape prints when |
Value
An object of class "exdqlmLDVB" containing the following:
-
y- Time-series data used to fit the model. -
run.time- Algorithm run time in seconds. -
iter- Number of iterations until convergence was reached. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block. -
dim.df- Dimension used for each block of discount factors. -
sig.init- Initial value for sigma, or value at which sigma was fixed iffix.sigma=TRUE. -
seq.sigma- Sequence of sigma estimated by the algorithm until convergence. -
samp.theta- Posterior sample of the state vector variational distribution. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma variational distribution. -
samp.vts- Posterior sample of latent parameters, v_t, variational distributions. -
theta.out- List containing the variational distribution of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
vts.out- List containing the variational distributions of latent parameters v_t. -
fix.sigmaLogical value indicating whether sigma was fixed atsig.init. -
diagnostics- List containing ELBO trace, standardized VB iteration tracediagnostics$vb_trace(iteration-wise ELBO / sigma / gamma / convergence deltas), and convergence diagnostics (joint stopping status, deltas for state/sigma/gamma/ELBO, and criteria used).
If dqlm.ind=FALSE, the list also contains:
-
gam.init- Initial value for gamma, or value at which gamma was fixed iffix.gamma=TRUE. -
seq.gamma- Sequence of gamma estimated by the algorithm until convergence. -
samp.gamma- Posterior sample of skewness parameter gamma variational distribution. -
samp.sts- Posterior sample of latent parameters, s_t, variational distributions. -
gammasig.out- List containing the LD (Laplace-Delta) approximation for the variational distribution ofsigmaandgamma(means, transformed Hessian, and ELBO components). -
sts.out- List containing the variational distributions of latent parameters s_t. -
fix.gammaLogical value indicating whether gamma was fixed atgam.init.
Or if dqlm.ind=TRUE, the list also contains:
-
sig.out- As above but for the DQLM case (gamma = 0), the LD approximation forsigma.
Transfer-function return fields
In addition to the standard exdqlmLDVB() return values, the returned
model, df, and dim.df entries correspond to the
transfer-function-augmented state-space model, with appended \zeta_t
and \psi_t states. The object also contains:
-
lam- Single transfer-function decay-rate parameter\lambda. -
median.kt- Median number of time steps until the aggregated transfer effect|x_t^\top \psi_{t-1}|is less than or equal to1e-3. -
transfer_input_names- Column names of the transfer inputs after normalization ofX.
Examples
data("scIVTmag", package = "exdqlm")
data("ELIanoms", package = "exdqlm")
old = options(exdqlm.max_iter = 20L)
y = scIVTmag[1:120]
X = ELIanoms[1:120]
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
seas.comp = seasMod(365, c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M1 = exdqlmTransferLDVB(
y, p0 = 0.85, model = model, X = X,
df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97,0.97),
n.samp = 20, tol = 0.2, verbose = FALSE
)
X_multi = cbind(ELIanoms[1:120], scale(scIVTmag[1:120])[, 1])
M2 = exdqlmTransferLDVB(
y, p0 = 0.85, model = model, X = X_multi,
df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97, 0.99),
n.samp = 20, tol = 0.2, verbose = FALSE
)
options(old)
Transfer Function exDQLM - MCMC algorithm
Description
The function applies a Markov chain Monte Carlo (MCMC) algorithm to sample
the posterior of an exDQLM with an exponential-decay transfer function
component for a fixed transfer rate parameter lam. For multivariate
transfer inputs, each column of X has its own instantaneous coefficient
state in \psi_t, while a single scalar decay rate lam controls
persistence of the accumulated transfer effect \zeta_t.
Usage
exdqlmTransferMCMC(
y,
p0,
model,
X,
df,
dim.df,
lam,
tf.df,
fix.gamma = FALSE,
gam.init = NA,
fix.sigma = FALSE,
sig.init = NA,
dqlm.ind = FALSE,
Sig.mh,
joint.sample = FALSE,
n.burn = 2000,
n.mcmc = 1500,
init.from.isvb = FALSE,
PriorSigma = NULL,
PriorGamma = NULL,
verbose = TRUE,
init.from.vb = TRUE,
vb_init_controls = NULL,
vb_init_fit = NULL,
mh.proposal = c("slice", "laplace_rw", "rw"),
mh.adapt = TRUE,
mh.adapt.interval = 50L,
mh.target.accept = c(0.2, 0.45),
mh.scale.bounds = c(0.1, 10),
mh.max_scale.step = 0.35,
mh.min_burn_adapt = 50L,
slice.width = 0.1,
slice.max.steps = Inf,
trace.diagnostics = TRUE,
trace.every = 1L,
verbose.every = 500L,
progress_callback = NULL,
tf.m0 = NULL,
tf.C0 = NULL
)
Arguments
y |
A univariate time-series. |
p0 |
The quantile of interest, a value between 0 and 1. |
model |
List of the state-space model including |
X |
A numeric vector or matrix of transfer-function inputs. Vectors are treated as a univariate input series. Matrices should have one row per time point and one column per covariate. |
df |
Discount factors for each block. |
dim.df |
Dimension of each block of discount factors. |
lam |
Single transfer-function decay-rate parameter |
tf.df |
Discount factor specification for the transfer function
component. These discount factors control the evolution variances of the
transfer states, separately from the deterministic decay rate
|
fix.gamma |
Logical value indicating whether to fix gamma at
|
gam.init |
Initial value for gamma (skewness parameter), or value at
which gamma will be fixed if |
fix.sigma |
Logical value indicating whether to fix sigma at |
sig.init |
Initial value for sigma (scale parameter), or value at which
sigma will be fixed if |
dqlm.ind |
Logical value indicating whether to fix gamma at |
Sig.mh |
Covariance matrix used in the random walk MH step to jointly sample sigma and gamma. |
joint.sample |
Logical value indicating whether or not to recompute |
n.burn |
Number of MCMC iterations to burn. Default is |
n.mcmc |
Number of MCMC iterations to sample. Default is |
init.from.isvb |
Logical value indicating whether to use the legacy ISVB
warm start when |
PriorSigma |
List of parameters for inverse gamma prior on sigma; shape
|
PriorGamma |
List of parameters for truncated Student-t prior on gamma;
center |
verbose |
Logical value indicating whether progress should be displayed. |
init.from.vb |
Optional logical. If |
vb_init_controls |
Optional list controlling VB warm start. Supported keys:
|
vb_init_fit |
Optional precomputed VB fit object. If supplied, warm start uses this object directly and does not rerun VB internally. |
mh.proposal |
Character; proposal kernel for the exDQLM scale/skew block.
|
mh.adapt |
Logical; adapt MH proposal scale during burn-in. |
mh.adapt.interval |
Integer; adaptation interval (iterations). |
mh.target.accept |
Numeric length-2 vector with lower/upper target acceptance rates. |
mh.scale.bounds |
Numeric length-2 vector with min/max global scaling for MH covariance. |
mh.max_scale.step |
Numeric in (0,1); maximum fractional scale change per adaptation step. |
mh.min_burn_adapt |
Minimum burn-in iterations required to enable adaptation. |
slice.width |
Positive numeric width for the bounded slice sampler when
|
slice.max.steps |
Positive integer or |
trace.diagnostics |
Logical; if |
trace.every |
Positive integer; when |
verbose.every |
Positive integer controlling how often console progress
is printed when |
progress_callback |
Optional callback invoked with a named list at MCMC start, at each progress checkpoint, and on completion. Intended for workflow-level progress logging. |
tf.m0 |
Prior mean of the transfer function component. Defaults to a
zero vector of length |
tf.C0 |
Prior covariance of the transfer function component. Defaults to
the |
Value
An object of class "exdqlmMCMC" containing the following:
-
y- Time-series data used to fit the model. -
run.time- Algorithm run time in seconds. -
dqlm.ind- Logical value indicating whether gamma was fixed at0, reducing the exDQLM to the special case of the DQLM. -
model- List of the state-space model includingGG,FF, prior parametersm0andC0. -
p0- The quantile which was estimated. -
df- Discount factors used for each block. -
dim.df- Dimension used for each block of discount factors. -
samp.theta- Posterior sample of the state vector. -
samp.post.pred- Sample of the posterior predictive distributions. -
map.standard.forecast.errors- MAP standardized one-step-ahead forecast errors. -
samp.sigma- Posterior sample of scale parameter sigma. -
samp.vts- Posterior sample of latent parameters, v_t. -
theta.out- List containing the distributions of the state vector including filtered distribution parameters (fmandfC) and smoothed distribution parameters (smandsC). -
n.burnNumber of MCMC iterations that were burned. -
n.mcmcNumber of MCMC iterations that were sampled.
If dqlm.ind=FALSE, the object also contains the following:
-
samp.gamma- Posterior sample of skewness parameter gamma. -
samp.sts- Posterior sample of latent parameters, s_t. -
init.log.sigma- Burned samples of log sigma from the random walk MH joint sampling of sigma and gamma. -
init.logit.gamma- Burned samples of logit gamma from the random walk MH joint sampling of sigma and gamma. -
accept.rate- Acceptance rate of the MH step. -
accept.rate.burn- MH acceptance rate during burn-in. -
accept.rate.keep- MH acceptance rate in kept MCMC samples. -
Sig.mh- Covariance matrix used in MH step to jointly sample sigma and gamma. -
mh.diagnostics- MH tuning diagnostics (proposal mode, scaling path, adaptation summary). -
diagnostics- ESS and chain-ready summaries for sigma/gamma.
Transfer-function return fields
In addition to the standard exdqlmMCMC() return values, the returned
model, df, and dim.df entries correspond to the
transfer-function-augmented state-space model, with appended \zeta_t
and \psi_t states. The object also contains:
-
lam- Single transfer-function decay-rate parameter\lambda. -
median.kt- Median number of time steps until the aggregated transfer effect|x_t^\top \psi_{t-1}|is less than or equal to1e-3. -
transfer_input_names- Column names of the transfer inputs after normalization ofX.
Examples
data("scIVTmag", package = "exdqlm")
data("ELIanoms", package = "exdqlm")
y = scIVTmag[1:120]
X = ELIanoms[1:120]
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
seas.comp = seasMod(365, c(1,2), C0 = 10*diag(4))
model = trend.comp + seas.comp
M1 = exdqlmTransferMCMC(
y, p0 = 0.85, model = model, X = X,
df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97,0.97),
n.burn = 40, n.mcmc = 40,
init.from.vb = FALSE, verbose = FALSE
)
X_multi = cbind(ELIanoms[1:120], scale(scIVTmag[1:120])[, 1])
M2 = exdqlmTransferMCMC(
y, p0 = 0.85, model = model, X = X_multi,
df = c(1,1), dim.df = c(1,4),
gam.init = -3.5, sig.init = 15,
lam = 0.38, tf.df = c(0.97, 0.99),
n.burn = 40, n.mcmc = 40,
init.from.vb = FALSE, verbose = FALSE
)
Bounds for the exAL shape parameter gamma
Description
Returns valid lower/upper bounds (L, U) for the shape parameter gamma
of the standardized extended Asymmetric Laplace (exAL), given p0 in (0,1).
Usage
get_gamma_bounds(p0)
Arguments
p0 |
Numeric scalar in (0, 1); typically the target quantile level. |
Details
This is a user-facing convenience wrapper around the C++ routine
get_gamma_bounds_cpp(), which performs the actual computation.
Value
A numeric vector of length 2 named c("L","U").
Examples
get_gamma_bounds(0.5)
get_gamma_bounds(0.9)
exalStaticDiagnostic objects
Description
is.exalStaticDiagnostic tests if its argument is an exalStaticDiagnostic
object.
Usage
is.exalStaticDiagnostic(x)
Arguments
x |
an R object |
exalStaticLDVB objects
Description
is.exalStaticLDVB tests if its argument is an exalStaticLDVB object.
Usage
is.exalStaticLDVB(m)
Arguments
m |
an R object |
exalStaticMCMC objects
Description
is.exalStaticMCMC tests if its argument is an exalStaticMCMC object.
Usage
is.exalStaticMCMC(m)
Arguments
m |
an R object |
exdqlm objects
Description
is.exdqlm tests if its argument is a exdqlm object.
Usage
is.exdqlm(m)
Arguments
m |
an R object |
exdqlmDiagnostic objects
Description
is.exdqlmDiagnostic tests if its argument is a exdqlmDiagnostic object.
Usage
is.exdqlmDiagnostic(x)
Arguments
x |
an R object |
exdqlmForecast objects
Description
is.exdqlmForecast tests if its argument is a exdqlmForecast object.
Usage
is.exdqlmForecast(x)
Arguments
x |
an R object |
exdqlmISVB objects
Description
is.exdqlmISVB tests if its argument is a exdqlmISVB object.
Usage
is.exdqlmISVB(m)
Arguments
m |
an R object |
exdqlmLDVB objects
Description
is.exdqlmLDVB tests if its argument is a exdqlmLDVB object.
Usage
is.exdqlmLDVB(m)
Arguments
m |
an R object |
exdqlmMCMC objects
Description
is.exdqlmMCMC tests if its argument is a exdqlmMCMC object.
Usage
is.exdqlmMCMC(m)
Arguments
m |
an R object |
exdqlmSynthesis objects
Description
is.exdqlmSynthesis tests if its argument is an
exdqlmSynthesis object returned by quantileSynthesis.
Usage
is.exdqlmSynthesis(x)
Arguments
x |
an R object |
Cumulative Distribution Function (CDF) for the exAL Distribution
Description
Vectorized over q.
Usage
pexal(
q,
p0 = 0.5,
mu = 0,
sigma = 1,
gamma = 0,
lower.tail = TRUE,
log.p = FALSE
)
Arguments
q |
Numeric vector of quantiles. |
p0 |
Probability level used in the quantile parametrization. Scalar in (0, 1). Default |
mu |
Location parameter (scalar). Default |
sigma |
Scale parameter (scalar, strictly positive). Default |
gamma |
Skewness parameter controlling asymmetry (scalar). Must be within valid bounds implied by |
lower.tail |
Logical scalar; if |
log.p |
Logical scalar; if |
Value
Numeric vector of CDF values (same length as q).
Examples
pexal(0)
pexal(c(-1, 0, 1), p0 = 0.5, mu = 0, sigma = 1, gamma = 0.1)
Plot Method for exalStaticDiagnostic Objects
Description
Plot Method for exalStaticDiagnostic Objects
Usage
## S3 method for class 'exalStaticDiagnostic'
plot(x, cols = c("red", "blue"), ...)
Arguments
x |
An |
cols |
Character vector of length 1 or 2 giving color(s) used to plot diagnostics. |
... |
Additional arguments passed to plotting functions. |
Plot Method for exalStaticLDVB Objects
Description
Plot Method for exalStaticLDVB Objects
Usage
## S3 method for class 'exalStaticLDVB'
plot(x, X = NULL, add = FALSE, col = "purple", cr.percent = 0.95, ...)
Arguments
x |
An |
X |
Optional design matrix used to compute fitted quantiles. If omitted,
the method uses |
add |
Logical; add to an existing plot. |
col |
Character vector of length 1 giving color for fitted quantiles. |
cr.percent |
Numeric in |
... |
Additional arguments passed to |
Value
A list with map.quant, lb.quant, and ub.quant.
Plot Method for exalStaticMCMC Objects
Description
Plot Method for exalStaticMCMC Objects
Usage
## S3 method for class 'exalStaticMCMC'
plot(x, add = FALSE, col = "purple", cr.percent = 0.95, ...)
Arguments
x |
An |
add |
Logical; add to an existing plot. |
col |
Character vector of length 1 giving color for fitted quantiles. |
cr.percent |
Numeric in |
... |
Additional arguments passed to |
Value
A list with map.quant, lb.quant, and ub.quant.
Plot Method for exdqlmDiagnostic Objects
Description
Plot Method for exdqlmDiagnostic Objects
Usage
## S3 method for class 'exdqlmDiagnostic'
plot(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.95), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
M0.diags = exdqlmDiagnostics(M0, plot = FALSE)
plot(M0.diags)
options(old)
Plot Method for exdqlmForecast Objects
Description
Plot Method for exdqlmForecast Objects
Usage
## S3 method for class 'exdqlmForecast'
plot(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
M0.forecast = exdqlmForecast(start.t = 50, k = 5, m1 = M0)
plot(M0.forecast)
options(old)
Plot Method for exdqlmISVB Objects
Description
Plot Method for exdqlmISVB Objects
Usage
## S3 method for class 'exdqlmISVB'
plot(x, ...)
Arguments
x |
An |
... |
Additional arguments. |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
# Legacy ISVB object retained for backward-compatible plotting methods
M0 = exdqlmISVB(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.IS = 20, n.samp = 20, tol = 0.2,
verbose = FALSE)
plot(M0)
options(old)
Plot Method for exdqlmLDVB Objects
Description
Plot Method for exdqlmLDVB Objects
Usage
## S3 method for class 'exdqlmLDVB'
plot(x, ...)
Arguments
x |
An |
... |
Additional arguments. |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
plot(M0)
options(old)
Plot Method for exdqlmMCMC Objects
Description
Plot Method for exdqlmMCMC Objects
Usage
## S3 method for class 'exdqlmMCMC'
plot(x, ...)
Arguments
x |
An |
... |
Additional arguments. |
Examples
data("scIVTmag", package = "exdqlm")
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M2 = exdqlmMCMC(y, p0=0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.burn = 20, n.mcmc = 20,
init.from.vb = FALSE, verbose = FALSE)
plot(M2)
Plot Method for exdqlmSynthesis Objects
Description
Plot the pointwise posterior predictive interval produced by
quantileSynthesis. The method is intentionally separate from
quantileSynthesis() so the synthesis step remains a computation,
while the returned object still has a standard plotting interface.
Usage
## S3 method for class 'exdqlmSynthesis'
plot(
x,
y = NULL,
time = NULL,
add = FALSE,
interval = 0.95,
show.median = TRUE,
show.mean = FALSE,
band.col = grDevices::adjustcolor("lightblue", alpha.f = 0.35),
median.col = "blue",
mean.col = "darkblue",
y.col = "dark grey",
border = NA,
xlab = "time",
ylab = "posterior predictive synthesis",
main = NULL,
xlim = NULL,
ylim = NULL,
...
)
Arguments
x |
An |
y |
Optional observed series to overlay. |
time |
Optional time vector for the synthesized summaries. If omitted,
|
add |
Logical; add the synthesis interval to an existing plot. |
interval |
Numeric in |
show.median |
Logical; draw the synthesized posterior median. |
show.mean |
Logical; draw the synthesized posterior mean. |
band.col |
Fill color for the predictive interval. |
median.col |
Color for the posterior median line. |
mean.col |
Color for the posterior mean line. |
y.col |
Color for the optional observed series. |
border |
Border color for the predictive interval polygon. |
xlab, ylab, main |
Graphical labels. |
xlim, ylim |
Optional axis limits. |
... |
Additional graphical arguments passed to the initial
|
Create an n-th order polynomial exDQLM component
Description
The function creates an n-th order polynomial exDQLM component.
Usage
polytrendMod(order, m0, C0, backend = c("auto", "R", "cpp"))
Arguments
order |
Numeric order |
m0 |
Optional numeric prior mean. Defaults to |
C0 |
Optional numeric prior covariance. Defaults to matrix |
backend |
Backend selection for matrix construction:
|
Value
An object of class "exdqlm" containing the following:
-
FF-n \times 1observational vector. -
GG-n \times nevolution matrix. -
m0-n \times 1prior mean of the state vector. -
C0-n \times nprior covariance matrix of the state vector.
Examples
# create a second order polynomial component
trend.comp = polytrendMod(2, rep(0, 2), 10*diag(2))
Print Method for exalStaticDiagnostic Objects
Description
Print Method for exalStaticDiagnostic Objects
Usage
## S3 method for class 'exalStaticDiagnostic'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Print Method for exalStaticLDVB Objects
Description
Print Method for exalStaticLDVB Objects
Usage
## S3 method for class 'exalStaticLDVB'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Print Method for exalStaticMCMC Objects
Description
Print Method for exalStaticMCMC Objects
Usage
## S3 method for class 'exalStaticMCMC'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Print exDQLM model details
Description
Print the details of the exDQLM model.
Usage
## S3 method for class 'exdqlm'
print(x, ...)
Arguments
x |
a |
... |
further arguments (unused). |
Print Method for exdqlmDiagnostic Objects
Description
Print Method for exdqlmDiagnostic Objects
Usage
## S3 method for class 'exdqlmDiagnostic'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.95), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
M0.diags = exdqlmDiagnostics(M0, plot=FALSE)
print(M0.diags)
options(old)
Print Method for exdqlmForecast Objects
Description
Print Method for exdqlmForecast Objects
Usage
## S3 method for class 'exdqlmForecast'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
M0.forecast = exdqlmForecast(start.t = 50, k = 5, m1 = M0)
print(M0.forecast)
options(old)
Print Method for exdqlmISVB Objects
Description
Print Method for exdqlmISVB Objects
Usage
## S3 method for class 'exdqlmISVB'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
# Legacy ISVB object retained for backward-compatible inspection methods
M0 = exdqlmISVB(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.IS = 20, n.samp = 20, tol = 0.2,
verbose = FALSE)
print(M0)
options(old)
Print Method for exdqlmLDVB Objects
Description
Print Method for exdqlmLDVB Objects
Usage
## S3 method for class 'exdqlmLDVB'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
print(M0)
options(old)
Print Method for exdqlmMCMC Objects
Description
Print Method for exdqlmMCMC Objects
Usage
## S3 method for class 'exdqlmMCMC'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M2 = exdqlmMCMC(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.burn = 20, n.mcmc = 20,
init.from.vb = FALSE, verbose = FALSE)
print(M2)
Print Method for exdqlmSynthesis Objects
Description
Print Method for exdqlmSynthesis Objects
Usage
## S3 method for class 'exdqlmSynthesis'
print(x, ...)
Arguments
x |
An |
... |
Additional arguments (unused). |
Quantile Function for the exAL Distribution
Description
Vectorized over p.
Usage
qexal(
p,
p0 = 0.5,
mu = 0,
sigma = 1,
gamma = 0,
lower.tail = TRUE,
log.p = FALSE
)
Arguments
p |
Numeric vector of probabilities in (0, 1). |
p0 |
Probability level used in the quantile parametrization. Scalar in (0, 1). Default |
mu |
Location parameter (scalar). Default |
sigma |
Scale parameter (scalar, strictly positive). Default |
gamma |
Skewness parameter controlling asymmetry (scalar). Must be within valid bounds implied by |
lower.tail |
Logical scalar; if |
log.p |
Logical scalar; if |
Value
Numeric vector of quantiles (same length as p).
Examples
p <- seq(0.1, 0.9, by = 0.2)
q <- qexal(p, p0 = 0.5, mu = 0, sigma = 1, gamma = 0)
all.equal(p, pexal(q, p0 = 0.5, mu = 0, sigma = 1, gamma = 0), tol = 1e-4)
Synthesize a unified posterior predictive distribution from multiple quantile-model draws
Description
The function synthesizes posterior predictive draws from multiple fitted quantile models into a single posterior predictive distribution. It uses a two-step correction: (i) isotonic regression at the grid of target quantiles to align the fitted quantile levels, and (ii) distributional alignment (shift each model's draws so its tau-quantile matches the isotone anchor). It then builds a single predictive quantile function per time by piecewise-linear blending across adjacent quantile models with optional global monotone rearrangement.
Usage
quantileSynthesis(
draws_list,
p,
enforce_isotonic = TRUE,
rearrange = TRUE,
grid_M = 1001L,
n_samp = 1000L,
seed = NULL,
T_expected = NULL
)
Arguments
draws_list |
List of length |
p |
Numeric vector of target quantile levels in |
enforce_isotonic |
Logical; apply isotonic regression (PAVA) over the grid |
rearrange |
Logical; apply monotone rearrangement (evaluate -> sort -> reinterpolate)
on a dense grid over |
grid_M |
Integer; size of dense grid |
n_samp |
Integer; number of synthesized draws per time. Default |
seed |
NULL or integer for reproducible synthesized draws. Default |
T_expected |
Optional integer; if provided, forces the time dimension to |
Value
An object of class "exdqlmSynthesis", which is a list containing:
-
draws- Numeric matrixT x n_sampof synthesized draws. -
levels- Sorted copy ofp(lengthL). -
quantiles- Numeric matrixT x Lof isotone anchorsm^*_{i,t}. -
summary- List with row-wise summaries ofdraws(mean,q025,q250,q500,q750,q975). -
method- List of synthesis settings used (name,isotonic,rearrange,grid_M,T_inferred).
Examples
# short example
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 10L)
TT = 50
y = scIVTmag[1:TT]
# create a compact trend model
trend.comp = polytrendMod(1, stats::quantile(y, 0.85), 10)
model = trend.comp
# fit quantiles using LDVB and save posterior predictive samples
fits <- draws <- NULL
p0s = c(0.10, 0.50, 0.90)
for(i in 1:length(p0s)){
fits[[i]] = exdqlmLDVB(
y, p0 = p0s[i], model, df = 0.98, dim.df = 1,
sig.init = 15, n.samp = 20, tol = 0.2, verbose = FALSE
)
draws[[i]] = fits[[i]]$samp.post.pred
}
# synthesize posterior predictive from all quantiles
syn = quantileSynthesis(
draws_list = draws,
p = p0s,
T_expected = TT)
# alternatively, pass fitted dynamic objects directly
syn2 = quantileSynthesis(
draws_list = fits,
p = p0s,
T_expected = TT)
# plot the synthesized 95% posterior predictive interval
plot(syn2, y = y)
options(old)
Create a standard regression component for an exDQLM
Description
The function constructs a regression block where the observation vector at time t is
F_t = X_t (row of the design matrix), and the state evolves as
\theta_t = \theta_{t-1} (i.e., G_t = I_n).
Usage
regMod(X, m0, C0)
Arguments
X |
A numeric matrix of dimension |
m0 |
Optional numeric prior mean (length n). Defaults to zeros. |
C0 |
Optional numeric prior covariance ( |
Details
Input X is a T \times n matrix of regressors; the returned FF is an n \times T
matrix (i.e., t(X)), consistent with component composition via
+.exdqlm.
Value
An object of class "exdqlm" with elements:
-
FF-n \times Tmatrix with columntequal toF_t = X_t. -
GG-n \times nidentity matrix (static coefficients). -
m0,C0- Prior mean/covariance for regression coefficients.
Examples
data("climateIndices", package = "exdqlm")
T <- 150
bt_dates <- seq(as.Date("1987-01-01"), by = "month", length.out = T)
idx <- match(bt_dates, climateIndices$date)
X <- scale(climateIndices[idx, c("noi", "amo")])
# Single regressor (T x 1)
reg1 = regMod(X[, "noi"])
# Multiple regressors (T x n)
reg2 = regMod(X)
# Combine with trend/seasonal components
trend.comp = polytrendMod(order = 3, m0 = rep(0,3), C0 = diag(3))
seas.comp = seasMod(p = 12, h = 1, C0 = diag(1, 2))
base.mod = trend.comp + seas.comp
model.std = base.mod + reg2
Random Sample Generation for the exAL Distribution
Description
Random Sample Generation for the exAL Distribution
Usage
rexal(n, p0 = 0.5, mu = 0, sigma = 1, gamma = 0)
Arguments
n |
Positive integer number of samples to draw (scalar). |
p0 |
Probability level used in the quantile parametrization. Scalar in (0, 1). Default |
mu |
Location parameter (scalar). Default |
sigma |
Scale parameter (scalar, strictly positive). Default |
gamma |
Skewness parameter controlling asymmetry (scalar). Must be within valid bounds implied by |
Value
Numeric vector of length n.
Examples
set.seed(1)
rexal(3, p0 = 0.5, mu = c(-1, 0, 1))
Time series of daily average magnitude IVT in Santa Cruz, CA.
Description
ECMWF Re-Analysis 5 (ERA5) daily average magnitude IVT in Santa Cruz, CA (approximately 22 N, 122 W) from January 1, 1979 to December 31, 2019 with all February 29ths omitted.
Usage
scIVTmag
Format
A time series of length 14965.
Source
https://cds.climate.copernicus.eu
References
Hersbach, H, Bell, B, Berrisford, P, et al. The ERA5 global reanalysis. Q J R Meteorol Soc. 2020; 146: 1999– 2049. doi:10.1002/qj.3803
Create Fourier representation of a periodic exDQLM component
Description
The function creates a Fourier form periodic component for given period and harmonics.
Usage
seasMod(p, h, m0, C0, backend = c("auto", "R", "cpp"))
Arguments
p |
Numeric period. |
h |
Numeric vector of harmonics to be included. |
m0 |
Optional numeric prior mean. Defaults to |
C0 |
Optional numeric prior covariance. Defaults to matrix |
backend |
Backend selection for matrix construction:
|
Value
An object of class "exdqlm" containing the following:
-
FF-q \times 1observational vector. -
GG-q \times qevolution matrix. -
m0-q \times 1prior mean of the state vector. -
C0-q \times qprior covariance matrix of the state vector.
Examples
# create a seasonal component with first, second and fourth harmonics of a period of 365
seas.comp = seasMod(365, c(1, 2, 4), C0 = 10*diag(6))
Summary Method for exalStaticDiagnostic Objects
Description
Summary Method for exalStaticDiagnostic Objects
Usage
## S3 method for class 'exalStaticDiagnostic'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Summary Method for exalStaticLDVB Objects
Description
Summary Method for exalStaticLDVB Objects
Usage
## S3 method for class 'exalStaticLDVB'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Summary Method for exalStaticMCMC Objects
Description
Summary Method for exalStaticMCMC Objects
Usage
## S3 method for class 'exalStaticMCMC'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Summary exDQLM model details
Description
Print the details of the exDQLM model.
Usage
## S3 method for class 'exdqlm'
summary(object, ...)
Arguments
object |
a |
... |
further arguments (unused). |
Summary Method for exdqlmDiagnostic Objects
Description
Summary Method for exdqlmDiagnostic Objects
Usage
## S3 method for class 'exdqlmDiagnostic'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M0 = exdqlmLDVB(y, p0 = 0.85, model, df = c(0.95), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.samp = 20, tol = 0.2, verbose = FALSE)
M0.diags = exdqlmDiagnostics(M0, plot = FALSE)
summary(M0.diags)
options(old)
Summary Method for exdqlmForecast Objects
Description
Summary Method for exdqlmForecast Objects
Usage
## S3 method for class 'exdqlmForecast'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
M0.forecast = exdqlmForecast(start.t = 50, k = 5, m1 = M0)
summary(M0.forecast)
options(old)
Summary Method for exdqlmISVB Objects
Description
Summary Method for exdqlmISVB Objects
Usage
## S3 method for class 'exdqlmISVB'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
# Legacy ISVB object retained for backward-compatible inspection methods
M0 = exdqlmISVB(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.IS = 20, n.samp = 20, tol = 0.2,
verbose = FALSE)
summary(M0)
options(old)
Summary Method for exdqlmLDVB Objects
Description
Summary Method for exdqlmLDVB Objects
Usage
## S3 method for class 'exdqlmLDVB'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
old = options(exdqlm.max_iter = 15L)
y = scIVTmag[1:60]
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 = 20, tol = 0.2, verbose = FALSE)
summary(M0)
options(old)
Summary Method for exdqlmMCMC Objects
Description
Summary Method for exdqlmMCMC Objects
Usage
## S3 method for class 'exdqlmMCMC'
summary(object, ...)
Arguments
object |
An |
... |
Additional arguments (unused). |
Examples
data("scIVTmag", package = "exdqlm")
y = scIVTmag[1:60]
model = polytrendMod(1, stats::quantile(y, 0.85), 10)
M2 = exdqlmMCMC(y, p0 = 0.85, model, df = c(0.98), dim.df = c(1),
gam.init = -3.5, sig.init = 15,
n.burn = 20, n.mcmc = 20,
init.from.vb = FALSE, verbose = FALSE)
summary(M2)
Summary Method for exdqlmSynthesis Objects
Description
Summary Method for exdqlmSynthesis Objects
Usage
## S3 method for class 'exdqlmSynthesis'
summary(object, time = NULL, ...)
Arguments
object |
An |
time |
Optional vector of time values. If supplied, it must have length
equal to the number of rows in |
... |
Additional arguments (unused). |
Value
A data frame containing pointwise summaries of the synthesized posterior predictive draws.