# \donttest{
# 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)
# }
Run the code above in your browser using DataLab