View source: R/quantileSynthesis.R
| quantileSynthesis | R Documentation |
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.
quantileSynthesis(
draws_list,
p,
enforce_isotonic = TRUE,
rearrange = TRUE,
grid_M = 1001L,
n_samp = 1000L,
seed = NULL,
T_expected = NULL
)
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 |
An object of class "exdqlmSynthesis", which is a list containing:
draws - Numeric matrix T x n_samp of synthesized draws.
levels - Sorted copy of p (length L).
quantiles - Numeric matrix T x L of isotone anchors m^*_{i,t}.
summary - List with row-wise summaries of draws
(mean, q025, q250, q500, q750, q975).
method - List of synthesis settings used
(name, isotonic, rearrange, grid_M, T_inferred).
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.