Learn R Programming

LaMa (version 1.0.0)

tpm_thinned: Compute the transition probability matrix of a thinned periodically inhomogeneous Markov chain.

Description

If the transition probability matrix of an inhomogeneous Markov chain varies only periodically (with period length \(L\)), it converges to a so-called periodically stationary distribution. This happens, because the thinned Markov chain, which has a full cycle as each time step, has homogeneous transition probability matrix

\(\Gamma_t = \Gamma^{(t)} \Gamma^{(t+1)} \dots \Gamma^{(t+L-1)}\) for all \(t = 1, \dots, L\).

This function calculates the matrix above efficiently as a preliminery step to calculating the periodically stationary distribution.

Usage

tpm_thinned(Gamma, t)

Value

Thinned transition probabilty matrix of dimension c(N,N)

Arguments

Gamma

Array of transition probability matrices of dimension c(N,N,L).

t

Integer index of the time point in the cycle, for which to calculate the thinned transition probility matrix

Examples

Run this code
# setting parameters for trigonometric link
beta = matrix(c(-1, -2, 2, -1, 2, -4), nrow = 2, byrow = TRUE)
# building trigonometric design matrix
Z = cbind(1,trigBasisExp(1:24, 24, 1))
# calculating all 24 linear predictor vectors
Eta = Z%*%t(beta)
# building all 24 t.p.m.s
Gamma = array(dim = c(2,2,24))
for(t in 1:24){
  Gamma[,,t] = tpm(Eta[t,])
}
# calculating 
tpm_thinned(Gamma, 4)

Run the code above in your browser using DataLab