ltm_mcmc: MCMC LTM

Description Usage Arguments Value References Examples

View source: R/mcmc.R

Description

Given x and y performs the MCMC optimization.

Usage

1
2
ltm_mcmc(x, y, burnin = 2000, iter = 8000, K = 3,
  prior_par = create_prior_parameters())

Arguments

x

data points

y

response variable

burnin

number of burnin iterations

iter

number of iterations after burnin

K

parameter K

prior_par

List of parameters for prior distrributions. See create_prior_parameters().

Value

matrix containing the posterior samples. Each line is one sample after the burnin period and each column is one of the parameters of the model. Columns are named to find the parameters with ease.

References

Nakajima, Jouchi, and Mike West. "Bayesian analysis of latent threshold dynamic models." Journal of Business & Economic Statistics 31.2 (2013): 151-164.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Generates 10 series, each one with 500 observations and 2 regressors.

d_sim <- ltm_sim(
  ns = 500, nk = 2, ni = 10,
  vmu = matrix(c(.5,.5), nrow = 2),
  mPhi = diag(2) * c(.99, .99),
  mSigs = c(.1,.1),
  dsig = .15,
  vd = matrix(c(.4,.4), nrow = 2),
  alpha = 0
)

# Fit model

fit_model <- ltm_mcmc(d_sim$mx, d_sim$vy, burnin = 0, iter = 2)

bltm documentation built on July 18, 2019, 9:06 a.m.