simMC: Simulation of a finite-state discrete time-homogeneous Markov...

Description Usage Arguments Value References Examples

Description

This method is used to simulate a finite-state discrete time-homogeneous Markov Chain.

Usage

1
simMC(trMatrix, InitStateIndex = NULL, steps, presentation = TRUE)

Arguments

trMatrix

Transition matrix of the Markov chain

InitStateIndex

The index of the initial state in the vector of states

steps

The number of iterations

presentation

Decide whether the states simulated is in number or state name.The default value is TRUE.

Value

A sequence of states

References

Grimmett, G., & Stirzaker, D. (2001). Probability and Random Processes (3rd ed.). New York: Oxford University Press.

Examples

1
2
3
4
5
6
7
8
egstate <- c("1", "2", "3")
MC <- matrix(data = c(1, 0, 0, 0, 1, 0, 0, 0, 1),
         nrow = 3, byrow = TRUE,
         dimnames = list(egstate, egstate))

index <- 1
n <- 50
simMC(MC,index,n)

ZiqingHo/BasicMC documentation built on May 21, 2019, 2:29 a.m.