The function generates random CTMC transitions as per the provided generator matrix.
Usage
rctmc(n, ctmc, initDist = numeric(), T = 0, include.T0 = TRUE,
out.type = "list")Value
Based on out.type, a list or a data frame is returned. The returned list has two elements - a character vector (states) and a numeric vector (indicating time of transitions). The data frame is similarly structured.
References
Introduction to Stochastic Processes with Applications in the Biosciences (2013), David F. Anderson, University of Wisconsin at Madison
Examples
energyStates <- c("sigma", "sigma_star")
byRow <- TRUE
gen <- matrix(data = c(-3, 3, 1, -1), nrow = 2,
byrow = byRow, dimnames = list(energyStates, energyStates))
molecularCTMC <- new("ctmc", states = energyStates,
byrow = byRow, generator = gen,
name = "Molecular Transition Model")
statesDist <- c(0.8, 0.2)
rctmc(n = Inf, ctmc = molecularCTMC, T = 1)
#> [[1]]
#> [1] "sigma_star"
#>
#> [[2]]
#> [1] 0
#>
rctmc(n = 5, ctmc = molecularCTMC, initDist = statesDist, include.T0 = FALSE)
#> [[1]]
#> [1] "sigma" "sigma_star" "sigma" "sigma_star" "sigma"
#>
#> [[2]]
#> [1] 1.413688 1.942383 2.351227 2.805303 5.178264
#>