Learn R Programming

hdMTD (version 0.1.4)

oscillation: Oscillations of an MTD Markov chain

Description

Calculates the oscillations of an MTD model object, of an MTDest fit, or estimates the oscillations of a chain sample.

Usage

oscillation(x, ...)

# S3 method for MTD oscillation(x, ...)

# S3 method for default oscillation(x, S, A = NULL, ...)

Value

A named numeric vector of oscillations. If the x parameter is an MTD or MTDest object, it will provide the oscillations for each element in Lambda (or S for MTDest). If x is a chain sample, it estimates the oscillations for a user-inputted set of lags S.

Arguments

x

Either an MTD model object, an MTDest fit, or a chain sample.

...

Ignored.

S

A numeric vector of distinct positive integers. Represents a set of lags.

A

Optional integer vector giving the state space. If omitted, defaults to sort(unique(x)).

Methods (by class)

  • oscillation(MTD): For an MTD (or MTDest) object: computes \(\delta_j\) for all \(j \in \Lambda\) (or for all \(j \in S\)).

  • oscillation(default): For a chain sample: estimates \(\delta_j\) for each \(j\) in S.

Details

For an MTD model or an MTDest fit, the oscillation for lag \(j\) (i.e., \( \{ \delta_j:\ j \in \Lambda \} \) for MTD or \( \{ \delta_j:\ j \in S \} \) for MTDest) is the product of the mixture weight \(\lambda_j\) and the maximum of the total variation distance between the distributions in a stochastic matrix \(p_j\). That is, $$\delta_j = \lambda_j\max_{b,c \in \mathcal{A}} d_{TV}(p_j(\cdot | b), p_j(\cdot | c)).$$ When x is an object of class MTD (or MTDest), the quantities \(\Lambda\) (or \(S\)), \(\mathcal{A}\), \(\lambda_j\), and \(p_j\) are directly available. In this case, the oscillations can be computed exactly from the model parameters.

Alternatively, when estimating oscillations from data, x must be a realization of a chain and S must be provided as a candidate lag set. The transition probabilities are then estimated from the sample before computing the corresponding oscillations. Let \(\hat{p}(\cdot| x_S)\) symbolize an estimated distribution in \(\mathcal{A}\) given a certain past \(x_S\) ( which is a sequence of elements of \(\mathcal{A}\) where each element occurred at a lag in S), and \(\hat{p}(\cdot|b_jx_S)\) an estimated distribution given past \(x_S\) and that the symbol \(b\in\mathcal{A}\) occurred at lag \(j\). If \(N\) is the sample size, \(d=\)max(S) and \(N(x_S)\) is the number of times the sequence \(x_S\) appeared in the sample, then $$\delta_j = \max_{c_j,b_j \in \mathcal{A}} \frac{1}{N-d}\sum_{x_{S} \in \mathcal{A}^{S}} N(x_S)d_{TV}(\hat{p}(. | b_jx_S), \hat{p}(. | c_jx_S) )$$ is the estimated oscillation for a lag \(j \in \{1,\dots,d\}\setminus\)S. Note that \(\mathcal{A}^S\) is the space of sequences of \(\mathcal{A}\) indexed by S.

Examples

Run this code
oscillation(MTDmodel(Lambda = c(1, 4), A = c(2, 3)))
oscillation(MTDmodel(Lambda = c(1, 4), A = c(2, 3), lam0 = 0.01, lamj = c(0.49, 0.5),
                      pj = list(matrix(c(0.1, 0.9, 0.9, 0.1), ncol = 2)),
                      single_matrix = TRUE))

Run the code above in your browser using DataLab