| sample_tna | R Documentation |
Fit TNA to a sequence sample
sample_tna(
data,
fraction = 0.3,
replace = FALSE,
seed = NULL,
format = c("auto", "long", "wide"),
id = "id",
period = "period",
state = "state",
group = NULL,
...
)
data |
Sequence data, in long or wide form. |
fraction |
Single number in |
replace |
Single flag, whether to draw with replacement. Default
|
seed |
Optional single seed, restored on exit. |
format |
One of |
id, period, state |
Column names identifying the sequence, the position
within it, and the state. Used only when |
group |
Optional column name. When given, sequences are sampled within each group and the refit is grouped. |
... |
Further arguments passed to |
The fit_tna() result for the sampled sequences: a simulab_sim
edge list with one row per transition and the columns from, to and
weight, plus the initial_probabilities and model_info components.
data <- simulate_sequences(n = 40, n_states = 3, chain_length = 12, seed = 1)
if (requireNamespace("tna", quietly = TRUE)) {
head(sample_tna(data, fraction = 0.5, seed = 1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.