MultDTMC: Multiple Discrete time Markov Chains

Description Usage Arguments Value Author(s) See Also Examples

View source: R/MultDTMC.R

Description

An extension of the DTMC package which enables multiple cocurrent Markov Chain simulations. At this time, plotting is not enabled.

Usage

1
MultDTMC(nchains, tmat, io, n)

Arguments

nchains

Number of chains to simulate (integer).

tmat

Transition Matrix

io

Initial distribution

n

Number of iterations to run each chain.

Value

chains

Returns nchains matrices of length nrow(tmat) by n which depict the transition of the Markov Chain.

Author(s)

Will Nicholson

See Also

DTMC

Examples

1
2
3
data(gr)
data(id)
MultDTMC(20,gr,id,10) # 20 chains with 10 iterations using the Gambler's ruin example.

Example output

[[1]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    1    0    1    0    1    0    1     0
[2,]    0    1    0    1    0    1    0    1    0     1
[3,]    0    0    0    0    0    0    0    0    0     0
[4,]    0    0    0    0    0    0    0    0    0     0

[[2]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    1     0
[2,]    0    0    0    0    0    0    0    1    0     1
[3,]    1    0    1    0    1    0    1    0    0     0
[4,]    0    1    0    1    0    1    0    0    0     0

[[3]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    0     0
[2,]    0    0    0    0    0    0    0    0    0     1
[3,]    1    0    1    0    1    0    1    0    1     0
[4,]    0    1    0    1    0    1    0    1    0     0

[[4]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    1    0    1    0    1    0    0    0     0
[2,]    1    0    1    0    1    0    1    0    1     0
[3,]    0    0    0    0    0    0    0    1    0     1
[4,]    0    0    0    0    0    0    0    0    0     0

[[5]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    0    0    0    0    0    0    0     0
[2,]    0    1    0    0    0    1    0    1    0     1
[3,]    0    0    1    0    1    0    1    0    1     0
[4,]    0    0    0    1    0    0    0    0    0     0

[[6]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    0     0
[2,]    0    0    1    0    1    0    1    0    0     0
[3,]    0    1    0    1    0    1    0    1    0     1
[4,]    1    0    0    0    0    0    0    0    1     0

[[7]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    1    0    0    0    0     0
[2,]    0    1    0    1    0    1    0    0    0     0
[3,]    1    0    1    0    0    0    1    0    1     0
[4,]    0    0    0    0    0    0    0    1    0     1

[[8]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    1    0    1    0    0    0    0     0
[2,]    0    1    0    1    0    1    0    1    0     0
[3,]    1    0    0    0    0    0    1    0    1     0
[4,]    0    0    0    0    0    0    0    0    0     1

[[9]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    1    0    0    0    0    0    0     0
[2,]    0    1    0    1    0    1    0    0    0     0
[3,]    0    0    0    0    1    0    1    0    1     0
[4,]    0    0    0    0    0    0    0    1    0     1

[[10]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    0     0
[2,]    1    0    0    0    0    0    0    0    0     0
[3,]    0    1    0    1    0    1    0    1    0     1
[4,]    0    0    1    0    1    0    1    0    1     0

[[11]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    0    0    0    0    0    0    1     0
[2,]    0    1    0    0    0    1    0    1    0     1
[3,]    0    0    1    0    1    0    1    0    0     0
[4,]    0    0    0    1    0    0    0    0    0     0

[[12]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    0     0
[2,]    0    0    0    0    0    0    0    0    0     0
[3,]    0    1    0    1    0    1    0    1    0     1
[4,]    1    0    1    0    1    0    1    0    1     0

[[13]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    1    0    1    0     0
[2,]    0    0    0    0    1    0    1    0    1     0
[3,]    0    1    0    1    0    0    0    0    0     1
[4,]    1    0    1    0    0    0    0    0    0     0

[[14]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    0    0    0    0    1    0    0     0
[2,]    0    1    0    0    0    1    0    1    0     0
[3,]    0    0    1    0    1    0    0    0    1     0
[4,]    0    0    0    1    0    0    0    0    0     1

[[15]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    1    0    0     0
[2,]    0    0    0    1    0    1    0    1    0     1
[3,]    1    0    1    0    1    0    0    0    1     0
[4,]    0    1    0    0    0    0    0    0    0     0

[[16]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    1    0    1    0    0    0    1     0
[2,]    0    1    0    1    0    1    0    1    0     1
[3,]    0    0    0    0    0    0    1    0    0     0
[4,]    0    0    0    0    0    0    0    0    0     0

[[17]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    1    0    0    0    0    0    0     0
[2,]    0    1    0    1    0    1    0    1    0     1
[3,]    1    0    0    0    1    0    1    0    1     0
[4,]    0    0    0    0    0    0    0    0    0     0

[[18]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    0    0    0     1
[2,]    0    0    0    0    0    0    0    0    1     0
[3,]    0    1    0    1    0    1    0    1    0     0
[4,]    1    0    1    0    1    0    1    0    0     0

[[19]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    0    0    0    0    0    0    1    0    1     0
[2,]    0    1    0    0    0    1    0    1    0     1
[3,]    1    0    1    0    1    0    0    0    0     0
[4,]    0    0    0    1    0    0    0    0    0     0

[[20]]
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,]    1    0    1    0    0    0    0    0    0     0
[2,]    0    1    0    1    0    1    0    0    0     0
[3,]    0    0    0    0    1    0    1    0    1     0
[4,]    0    0    0    0    0    0    0    1    0     1

DTMCPack documentation built on May 2, 2019, 2:06 a.m.