View source: R/sequence_terminal.R
| mark_terminal_state | R Documentation |
Replaces every cell after each row's last observed state with the
label given by state, leaving non-terminal NAs untouched. The
result, passed to build_network(), yields a Markov chain in
which the marked state is absorbing by construction
(P[state, state] = 1).
mark_terminal_state(data, state = "End", cols = NULL)
data |
A wide-format matrix or data.frame (rows = actors,
cols = time steps) of state labels with |
state |
Character. Label to insert in terminal-NA cells.
Default |
cols |
Optional state-column names; otherwise all columns. |
This is the small piece of pre-processing required to turn
right-censored sequence data into an absorbing-chain model. The
chain on the resulting matrix has one extra state (state)
which is structurally absorbing because every cell after the
actor's last observed step has been set to state - the chain
stays there forever once entered.
Use chain_structure() on the result to compute mean absorption
time, absorption probabilities, and per-state classification.
Note that markov_stability() is not the right summary for
absorbing chains; its stationary distribution will collapse to
the absorbing state.
A data.frame of the same shape as data with terminal
NAs filled by state.
actor_endpoints(), chain_structure(), build_network()
M <- mark_terminal_state(trajectories, state = "Dropout")
net <- build_network(M, method = "relative")
chain_structure(net)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.