% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mmm.R
\name{cluster_mmm}
\alias{cluster_mmm}
\title{Cluster sequences using Mixed Markov Models}
\usage{
cluster_mmm(
  data,
  k = 2L,
  n_starts = 50L,
  max_iter = 200L,
  tol = 1e-06,
  smooth = 0.01,
  seed = NULL,
  covariates = NULL
)
}
\arguments{
\item{data}{A data.frame (wide format), \code{netobject}, or
\code{tna} model. For tna objects, extracts the stored data.}

\item{k}{Integer. Number of mixture components. Default: 2.}

\item{n_starts}{Integer. Number of random restarts. Default: 50.}

\item{max_iter}{Integer. Maximum EM iterations per start. Default: 200.}

\item{tol}{Numeric. Convergence tolerance. Default: 1e-6.}

\item{smooth}{Numeric. Laplace smoothing constant. Default: 0.01.}

\item{seed}{Integer or NULL. Random seed.}

\item{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
\code{\link{build_clusters}}). Unlike the post-hoc analysis in
\code{build_clusters()}, these covariates directly influence cluster
membership during estimation. Requires the \pkg{nnet} package.}
}
\value{
A \code{net_mmm} object. See \code{\link{build_mmm}} for details.
}
\description{
Convenience alias for \code{\link{build_mmm}}. Fits a mixture of Markov
chains to sequence data and returns per-component transition networks with
EM-fitted initial state probabilities.
}
\details{
Use \code{\link{build_network}} on the result to extract per-cluster
networks with any estimation method, or use \code{\link{cluster_network}}
for a one-shot clustering + network call.
}
\examples{
seqs <- data.frame(V1 = sample(c("A","B","C"), 30, TRUE),
                   V2 = sample(c("A","B","C"), 30, TRUE))
mmm <- cluster_mmm(seqs, k = 2, n_starts = 1, max_iter = 10, seed = 1)
mmm
\donttest{
seqs <- data.frame(
  V1 = sample(LETTERS[1:3], 40, TRUE),
  V2 = sample(LETTERS[1:3], 40, TRUE),
  V3 = sample(LETTERS[1:3], 40, TRUE)
)
mmm <- cluster_mmm(seqs, k = 2)
print(mmm)
}
}
\seealso{
\code{\link{build_mmm}}, \code{\link{cluster_network}}
}
