| process_hid_formulas | R Documentation |
Process and standardise formulas for the state process of hidden Markov models
process_hid_formulas(formulas, nStates, ref = NULL)
formulas |
formulas for the transition process of a hidden Markov model, either as a single formula, a list of formulas, or a matrix. |
nStates |
number of states of the Markov chain |
ref |
optional vector of reference categories for each state, defaults to |
named list of formulas of length nStates * (nStates - 1), where each formula corresponds to a transition from state i to state j, excluding transitions from i to ref[i].
# single formula for all non-reference category elements
formulas = process_hid_formulas(~ s(x), nStates = 3)
# now a list of length 6 with names tr.ij, not including reference categories
# different reference categories
formulas = process_hid_formulas(~ s(x), nStates = 3, ref = c(1,1,1))
# different formulas for different entries (and only for 2 of 6)
formulas = list(tr.12 ~ s(x), tr.23 ~ s(y))
formulas = process_hid_formulas(formulas, nStates = 3, ref = c(1,1,1))
# also a list of length 6, remaining entries filled with tr.ij ~ 1
# matrix input with reference categories
formulas = matrix(c(".", "~ s(x)", "~ s(y)",
"~ g", ".", "~ I(x^2)",
"~ y", "~ 1", "."),
nrow = 3, byrow = TRUE)
# dots define reference categories
formulas = process_hid_formulas(formulas, nStates = 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.