| extract_transition_matrix | R Documentation |
Extract the transition probability matrix from a TNA model object.
extract_transition_matrix(model, type = c("raw", "scaled"))
model |
A TNA model object or a list containing a 'weights' element. |
type |
Character. Type of matrix to return:
Default: "raw". |
TNA models store transition weights in different locations depending on the model type. This function handles the extraction automatically.
For "scaled" type, each row is divided by its sum to create valid transition probabilities. This is useful when the original weights don't sum to 1.
A square numeric matrix with row and column names as state names.
extract_initial_probs for extracting initial probabilities,
extract_edges for extracting an edge list.
seqs <- data.frame(V1 = c("A","B","A"), V2 = c("B","A","C"), V3 = c("A","C","B"))
net <- build_network(seqs, method = "relative")
trans_mat <- extract_transition_matrix(net)
print(trans_mat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.