% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hmm_em.R
\name{fit_hmm_em}
\alias{fit_hmm_em}
\title{Fit a Gaussian or Student-t HMM via EM with multiple random restarts.}
\usage{
fit_hmm_em(
  x,
  K = 3L,
  model = c("gaussian", "student"),
  n_starts = 5L,
  max_iter = 200L,
  tol = 1e-06,
  nu_grid = c(3:30, 40, 60, 100),
  verbose = TRUE
)
}
\arguments{
\item{x}{Numeric vector of observations (log returns).}

\item{K}{Integer number of hidden states.}

\item{model}{\code{"gaussian"} or \code{"student"}.}

\item{n_starts}{Number of random restarts.}

\item{max_iter}{Maximum EM iterations per restart.}

\item{tol}{Log-likelihood convergence tolerance.}

\item{nu_grid}{Candidate degrees-of-freedom for Student-t grid search.}

\item{verbose}{Logical; if \code{TRUE} print iteration progress.}
}
\value{
A list with components:
  \describe{
    \item{model}{Model type string.}
    \item{A}{K x K transition matrix.}
    \item{delta}{Length-K initial state probability vector.}
    \item{params}{List with \code{mu}, \code{sigma}, and (Student-t) \code{nu}.}
    \item{gamma}{T x K posterior state probabilities.}
    \item{xi}{(T-1) x K x K posterior joint transition probabilities.}
    \item{logLik}{Scalar log-likelihood at convergence.}
    \item{n}{Number of observations.}
    \item{K}{Number of states.}
  }
}
\description{
Fit a Gaussian or Student-t HMM via EM with multiple random restarts.
}
