In term_defm_transition
, users can specify a particular motif to model. Motifs
are represented by cells with values equal to 1, for example, the matrix:
t0: 1 NA NA
t1: 1 1 NA
represents a transition y0 -> (y1, y2)
. If 0 is a motif of interest, then
the matrix should include 0 to mark zero values.
The function term_defm_transition_formula
,
will take the formula and generate the corresponding
input for defm::counter_transition(). Formulas can be specified in the
following ways:
Intercept effect: ... No transition, only including the current state.
Transition effect: ... > ... Includes current and previous states.
The general notation is [0]y[column id]_[row id]
. A preceeding zero
means that the value of the cell is considered to be zero. The column
id goes between 0 and the number of columns in the array - 1 (so it
is indexed from 0,) and the row id goes from 0 to m_order.
Intercept effects
Intercept effects only involve a single set of curly brackets. Using the
'greater-than' symbol (i.e., '<') is only for transition effects. When
specifying intercept effects, users can skip the row_id
, e.g.,
y0_0
is equivalent to y0
. If the passed row id
is different from
the Markov order, i.e., row_id != m_order
, then the function returns
with an error.
Examples:
Transition effects
Transition effects can be specified using two sets of curly brackets and
an greater-than symbol, i.e., {...} > {...}
. The first set of brackets,
which we call LHS, can only hold row id
that are less than m_order
.
The term term_defm_logit_intercept
will add what is equivalent to an
intercept in a logistic regression. When coords
is specified, then the
function will add one intercept per outcome. These can be weighted by
a covariate.
The function rule_not_one_to_zero
will avoid the transition one to zero in a Markov process.
The +
method is a shortcut for term_formula