% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/BaumWelch.R
\name{BaumWelch}
\alias{BaumWelch}
\title{Baum-Welch Algorithm (EM) for HMM}
\usage{
BaumWelch(
  Y,
  K,
  N,
  initT = NULL,
  initO = NULL,
  initPi = NULL,
  num.iter = 100L,
  thr = 1e-06,
  verbose = FALSE
)
}
\arguments{
\item{Y}{Integer vector of observations (values in 1:N), or a list of
integer vectors for multiple sequences.}

\item{K}{Number of hidden states}

\item{N}{Number of distinct observation symbols}

\item{initT}{Initial transition matrix (K x K). If NULL, random initialization.}

\item{initO}{Initial emission matrix (K x N). If NULL, random initialization.}

\item{initPi}{Initial state distribution (length K). If NULL, uniform.}

\item{num.iter}{Maximum EM iterations (default: 100)}

\item{thr}{Convergence threshold on log-likelihood relative change (default: 1e-6)}

\item{verbose}{Logical (default: FALSE)}
}
\value{
A list with components:
  \describe{
    \item{T_mat}{Estimated transition matrix (K x K)}
    \item{O}{Estimated emission matrix (K x N)}
    \item{pi0}{Estimated initial distribution (length K)}
    \item{loglik}{Vector of log-likelihoods per iteration}
    \item{converged}{Logical}
    \item{iter}{Number of iterations}
  }
}
\description{
Estimates HMM parameters (T, O, pi) from observation sequences
using the Expectation-Maximization algorithm.
}
