Learn R Programming

hdMTD (version 0.1.1)

MTDmodel: Creates a Mixture Transition Distribution (MTD) Model

Description

Generates an MTD model as an object of class MTD given a set of parameters.

Usage

MTDmodel(
  Lambda,
  A,
  lam0 = NULL,
  lamj = NULL,
  pj = NULL,
  p0 = NULL,
  single_matrix = FALSE,
  indep_part = TRUE
)

Value

A list of class MTD containing:

P

The transition probability matrix of the MTD model.

lambdas

A vector with MTD weights (lam0 and lamj).

pj

A list of stochastic matrices defining conditional transition probabilities.

p0

The independent probability distribution.

Lambda

The vector of relevant lags.

A

The state space.

Arguments

Lambda

A numeric vector of positive integers representing the relevant lag set. The elements will be sorted from smallest to greatest. The smallest number represents the latest (most recent) time in the past, and the largest number represents the earliest time in the past.

A

A vector with nonnegative integers representing the state space.

lam0

A numeric value in [0,1), representing the weight of the independent distribution.

lamj

A numeric vector of weights for the transition probability matrices in pj. Values must be in the range [0, 1), and their sum with lam0 must be equal to 1. The first element in lamj must be the weight for the first element in Lambda and so on.

pj

A list with length(Lambda) stochastic matrices, each of size length(A) x length(A). The first matrix in pj must refer to the first element in Lambda and so on.

p0

A probability vector for the independent component of the MTD model. If NULL and indep_part=TRUE, the distribution will be sampled from a uniform distribution. If indep_part=FALSE, then there is no independent distribution and p0 entries will be set to zero. If you enter p0=0, indep_part is set to FALSE.

single_matrix

Logical. If TRUE, all matrices in list pj are identical.

indep_part

Logical. If FALSE, the model does not include an independent distribution and p0 is set to zero.

Details

The resulting MTD object can be used by functions such as oscillation(), which retrieves the model's oscillation, and perfectSample(), which will sample an MTD Markov chain from its invariant distribution.

Examples

Run this code
MTDmodel(Lambda=c(1,3),A=c(4,8,12))

MTDmodel(Lambda=c(2,4,9),A=c(0,1),lam0=0.05,lamj=c(0.35,0.2,0.4),
pj=list(matrix(c(0.5,0.7,0.5,0.3),ncol=2)),p0=c(0.2,0.8),single_matrix=TRUE)

MTDmodel(Lambda=c(2,4,9),A=c(0,1),lam0=0.05,
pj=list(matrix(c(0.5,0.7,0.5,0.3),ncol=2)),single_matrix=TRUE,indep_part=FALSE)

Run the code above in your browser using DataLab