Description Usage Arguments Value Examples
Create an appropriate markov chain object
1 |
pijdef |
Transition matrix definition. Can be a matrix or a function with input(i,j) and output P(i to j). |
stateNames |
Names of states. Default to NULL, which forces the names to be 1 to n. |
chainName |
Name of the markov chain. Default to NULL. |
qidef |
A vector of holding time distribution parameters. Must have for continuous markov chain. |
discrete |
A logical value indicating if the markov chain is discrete (FALSE means continuous). |
infinite |
A logical value indicating if the markov chain is infinite (FALSE means finite). |
use_ratematrix |
If you wish to solve the problem with a matrix. |
returns an appropriate markov chain object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # discrete finite
threeHeads = function(){
p = matrix(0, nrow=3, ncol=3)
p[1, c(1,2)] = 0.5
p[2, c(1,3)] = 0.5
p[3, 1] = 1
return(p)
}
ex = mc.create(pijdef = threeHeads(), discrete = TRUE, infinite = FALSE)
# discrete infinite
singleServer = function(i,j){
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.