Calculates the oscillations of an MTD model object or estimates the oscillations of a chain sample.
oscillation(x, ...)If the x parameter is an MTD object, it will provide the oscillations for
each element in Lambda. In case x is a chain sample, it estimates the oscillations
for a user-inputted set S of lags.
Must be an MTD object or a chain sample.
Additional parameters that might be required. Such as:
S: If x is a chain sample the user should provide a set of lags
for which he wishes to estimate the oscillations. It must be labeled as S, an in
this scenario the function takes an upper bound for the order as d=max{S}.
A: If x is a chain sample, and there may be elements in A that did not
appear in x, the state space should be specified, and it must be labeled as A.
The oscillation for a certain lag \(j\) of an MTD model
( \( \{ \delta_j:\ j \in \Lambda \} \)), is the product of the weight \(\lambda_j\)
multiplied by the maximum of the total variation distance between the distributions in a
stochastic matrix \(p_j\).
$$\delta_j = \lambda_j\max_{b,c \in \mathcal{A}} d_{TV}(p_j(\cdot | b), p_j(\cdot | c)).$$
So, if x is an MTD object, the parameters \(\Lambda\), \(\mathcal{A}\), \(\lambda_j\),
and \(p_j\) are inputted through, respectively, the entries Lambda, A,
lambdas and the list pj of stochastic matrices. Hence, an oscillation \(\delta_j\)
may be calculated for all \(j \in \Lambda\).
If we wish to estimate the oscillations from a sample, then x must be a chain,
and S, a vector representing a set of lags, must be informed. This way the transition
probabilities can be estimated. 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.
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