exdqlmMCMC {exdqlm} | R Documentation |
exDQLM - MCMC algorithm
Description
The function applies a Markov chain Monte Carlo (MCMC) algorithm to sample the posterior of an exDQLM.
Usage
exdqlmMCMC(
y,
p0,
model,
df,
dim.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 = TRUE,
PriorSigma = NULL,
PriorGamma = 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 |
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 or not to initialize the MCMC using the ISVB algorithm. 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. |
Value
A list of the following is returned:
-
run.time
- Algorithm run time in seconds. -
model
- List of the state-space model includingGG
,FF
, prior parametersm0
andC0
. -
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 (fm
andfC
) and smoothed distribution parameters (sm
andsC
).
If dqlm.ind=FALSE
, the list 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. -
Sig.mh
- Covariance matrix used in MH step to jointly sample sigma and gamma.
Examples
y = scIVTmag[1:100]
trend.comp = polytrendMod(1,mean(y),10)
seas.comp = seasMod(365,c(1,2,4),C0=10*diag(6))
model = combineMods(trend.comp,seas.comp)
M2 = exdqlmMCMC(y,p0=0.85,model,df=c(1,1),dim.df = c(1,6),
gam.init=-3.5,sig.init=15,
n.burn=100,n.mcmc=150)