dmc_inv: Invariant distributions of a discrete-time finite statespace...

Description Usage Arguments Value See Also Examples

View source: R/dmc_inv.R

Description

dmc_inv can calculate invariant distributions of the input chain. Moreover, for user's convenience, dmc_inv is also empowered to calculate the period for each closed class, which is similar to a part of function dmc_irreclass.

Usage

1
2
dmc_inv(MC, show_mat = TRUE, show_closed = TRUE, lambda_tol = 1e-04,
  imag_tol = 1e-04, too_big_to_print = 15, row_tol = 1e-04)

Arguments

MC

is an object in class 'stat2003.d'

show_mat

A logical scalar. If TRUE (the default) the transition matrix (rounded to 1 decimal places) is printed to screen so that the user can check it. Otherwise (show_mat = FALSE) the matrix is not printed.

show_closed

A logical scalar. If TRUE the number of colsed class and the details of each closed class is printed to screen so that the user can check it. Otherwise (show_closed = FALSE) the classes is not printed.

lambda_tol

A numeric scalar. Tolerance for finding eigenvalues of probability transition matrix whose real part is equal to 1. Any eignvalue within a distance lambda_tol of 1 is treated as being equal to 1.

imag_tol

A numeric scalar. Tolerance for checking that the imaginary part of an eigenvalue is close enough to zero. This is only used when the real part of the eigenvalue is close enough to 1. Also used to check that the imaging parts of the corresponding eigenvectors are close enough to zero.

too_big_to_print

A numeric scalar. If the statespace is bigger than this, the transition matrix will also not be printed.

row_tol

A numeric scalar. Tolerance for checking that the rows of the input probability transition matrix sum to 1. Any matrix that has any row sums more than row_tol away from 1 is rejected.

Value

An n_inv by n_s numeric matrix, where n_stat is the number of invariant distributions and n_s is the size of the state space, i.e. the dimension of the symmetric input transition matrix. Therefore, each ROW of the matrix contains an invariant distribution of the Markov chain.

See Also

stat2003.d-class A class type of discrete-time finite state space Markov chain in stat2003 package.

dmc_simu simulates a discrete-time Markov chain by returning one possible sequence and a states against steps plot.

dmc_tp can calculate transient probabilities at a specific step, and also can give a graph about transient probabilities from step zero to that specific step.

dmc_equi returns the equilibrium distribution for a discrete-time Markov chain.

dmc_irreclass focuses on irreducible classes for a given discrete-time Markov chain

dmc_period returns the period of each state for a given discrete-time Markov chain

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
m <- matrix(c(1/3, 2/3, 0, 0,
              1, 0, 0, 0,
              1/4, 1/4, 1/4, 1/4,
              0, 0, 1, 0), nr = 4, nc=4, byrow = TRUE)

A <- new("stat2003.d", p_start = c(1/2, 0, 0, 1/2), p = m,
         statespace = c("0", "1", "C", "D") )
dmc_inv(A)


m <- matrix(c(1, 0, 0, 0, 0, 0,
              1/4, 0, 3/4, 0, 0, 0,
              0, 1/2, 0, 1/2, 0, 0,
              0, 0, 1/2, 0, 1/3, 1/6,
              0, 0, 0, 0, 1/4, 3/4,
              0, 0, 0, 0, 1/3, 2/3), nr = 6, nc=6, byrow = TRUE)
A <- new("stat2003.d", p_start = rep(1/6, 6), p = m,
         statespace = letters[1 : 6] )
dmc_inv(A)

paulnorthrop/stat2003 documentation built on May 24, 2019, 10:31 p.m.