Description Usage Arguments Value See Also Examples
Merges the states given by the user.
The names of merged states are concatenations of names of the states being merged.
merged_cohort\@ time.to.state
is defined as time, when the patient arrives
in the first state which was merged into the new state.
The function creates also a hfNames
matrix
for the merged states. They are used only to plot a graph of possible
transmissions between merged states.
1 | mergeStates(cohort, statesGroups)
|
cohort |
a |
statesGroups |
a |
list(cohortGroup, hfNames)
cohortGroup
is an object with a structure like a cohort
simulated by simulateCohort
. States names
are now concatentations of the names of the states which were merged. Times of transitions
(cohortGroup (at) time.to.state) are recomputed for groups of merged states. The other attributes of the cohorts
stay unchanged.
hfNames
is a matrix
with row names beeing concatenated names of the states that were merged, the values in the matrix are
"impossible", if the transition between given groups of states is impossible, or "possible", if there is some possible transition between
the states in the given two groups of states.
simulateCohort
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | hfNames <- array(rep("Exponential", 16), dim = c(4,4))
hfNames[col(hfNames) <= row(hfNames)]<-"NULL"
rownames(hfNames) <- as.list(paste("state", 1:4))
colnames(hfNames) <- as.list(paste("state", 1:4))
M <- makeM(hfNames)
param <- generateParameterMatrix(M)
param[[1,2]] <- list(rate = 1)
param[[1,3]] <- list(rate = 2)
param[[2,3]] <- list(rate = 0.5)
param[[1,4]] <- list(rate = 1)
param[[2,4]] <- list(rate = 2)
param[[3,4]] <- list(rate = 0.5)
cohort <- simulateCohort(
transitionFunctions = M,
parameters = param,
cohortSize = 100,
to=10)
tmp <- mergeStates(cohort, statesGroup = list(list(1,2), list(3,4)))
merged_cohort <- tmp[["cohort"]]
merged_hfNames <- tmp[["hfNames"]]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.