getStationaryDistribution: getStationaryDistribution

Description Usage Arguments Value Examples

View source: R/getStationaryDistribution.R

Description

Calculate the stationary distribution of a markov chain if it exists

Usage

1
getStationaryDistribution(mc.obj, epsilon=0.01, iteration=30, totalProb=0.9)

Arguments

mc.obj

Markov chain object created by the 'mc.create' function

epsilon

The threshold for the converging (in cosine). Needed in infinite markov chain. Default to 0.01.

iteration

The max iteration for the approximation algorithm. Needed in infinite markov chain. Default to 30

totalProb

The proportion of information that the approximate distribution contains. Default to 0.9

Value

In the case of finite, returns the stationary distribution. In the case of infinite, returns a list containing an success indicator, converge state count, approximated stationary distribution, and converge transition matrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
singleServer = function(i,j){
  if(i==1 && j==2)
    return(1)
  p = 0.3
  q = 0.7
  r = 0
  if(j == i+1)
    return(p)
  if(j == i-1)
    return(q)
  if(j==i)
    return(r)
  return(0)
}
ex = mc.create(pijdef=singleServer, discrete=TRUE, infinite=TRUE)
ans = getStationaryDistribution(ex)

qiwei-li/infiniteMC documentation built on May 26, 2019, 11:36 a.m.