| build_mmm | R Documentation |
Discovers latent subgroups with different transition dynamics using Expectation-Maximization. Each mixture component has its own transition matrix. Sequences are probabilistically assigned to components.
build_mmm(
data,
k = 2L,
n_starts = 50L,
max_iter = 200L,
tol = 1e-06,
smooth = 0.01,
seed = NULL,
covariates = NULL
)
data |
A data.frame (wide format), |
k |
Integer. Number of mixture components. Default: 2. |
n_starts |
Integer. Number of random restarts. Default: 50. |
max_iter |
Integer. Maximum EM iterations per start. Default: 200. |
tol |
Numeric. Convergence tolerance. Default: 1e-6. |
smooth |
Numeric. Laplace smoothing constant. Default: 0.01. |
seed |
Integer or NULL. Random seed. |
covariates |
Optional. Covariates integrated into the EM algorithm
to model covariate-dependent mixing proportions. Accepts formula,
character vector, string, or data.frame (same forms as
|
An object of class net_mmm with components:
List of netobjects, one per component.
Number of components.
Numeric vector of mixing proportions.
N x k matrix of posterior probabilities.
Integer vector of hard assignments (1..k).
List: avepp (per-class), avepp_overall,
entropy, relative_entropy,
classification_error.
Model fit statistics.
Character vector of state names.
compare_mmm, build_network
seqs <- data.frame(V1 = sample(c("A","B","C"), 30, TRUE),
V2 = sample(c("A","B","C"), 30, TRUE))
mmm <- build_mmm(seqs, k = 2, n_starts = 1, max_iter = 10, seed = 1)
mmm
seqs <- data.frame(
V1 = sample(LETTERS[1:3], 30, TRUE), V2 = sample(LETTERS[1:3], 30, TRUE),
V3 = sample(LETTERS[1:3], 30, TRUE), V4 = sample(LETTERS[1:3], 30, TRUE)
)
mmm <- build_mmm(seqs, k = 2, seed = 42)
print(mmm)
summary(mmm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.