Learn R Programming

hdMTD (version 0.1.4)

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.

single_matrix

A logical argument, if TRUE indicates that all matrices in pj are identical.

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.

Methods (S3)

Objects returned by MTDmodel() have class "MTD" and support:

  • print: compact display of the relevant lag set and the state space (see MTD-methods).

  • summary: detailed summary of the model components (see MTD-methods).

  • coef: extracts the model parameters lambdas, pj, and p0 (see MTD-methods).

  • logLik: logLik(object, X) computes the log-likelihood, provided that the user supplies a sample X (see MTD-methods).

  • plot: diagnostic plots, including oscillations by lag, mixture weights, and transition graphs (see plot.MTD).

  • oscillation: oscillations by lag computed from the model parameters.

  • perfectSample: perfect sampling from the stationary distribution, provided that \(\lambda_0 > 0\).

  • probs: one-step predictive probabilities.

Accessors

Stable access to model components is provided by MTD-accessors: lags, Lambda, lambdas, pj, p0, states, and transitP.

See Also

MTDest for EM-based parameter estimation, hdMTD for lag selection procedures, MTD-methods for methods applicable to "MTD" objects, MTD-accessors for stable access to model components, oscillation, perfectSample, and probs for additional inference and simulation utilities.

Examples

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

MM <- 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)
transitP(MM); pj(MM); oscillation(MM)


MM <- 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)
p0(MM); lambdas(MM)

Run the code above in your browser using DataLab