fit.hmmR {HMMRel}R Documentation

Non-parametric fitting of a HMM using the Baum-Welch algorithm.

Description

This function adapts the EM algorithm to fit the transition matrix of the hidden Markov chain as well as the emission probability matrix of a HMM.

Usage

fit.hmmR(Y,P0,M0,alpha0,max.iter=50,epsilon=1e-9,Nx,Ny)

Arguments

Y

A sequence of observations consisting of signals of system performance.

P0

A square matrix of dimension Nx with the transition probabilities of the hidden MC at the first iteration of the algorithm.

M0

A matrix of dimension Nx \times Ny with the emission probabilities at the first step of the algorithm.

alpha0

A vector of size Nx with the initial distribution of the hidden Markov chain at the first iteration of the algorithm.

max.iter

An integer value with the maximum number of iterations in the iterative algorithm. Default value is max.ite=50.

epsilon

A numeric value with the tolerance in the iterative algorithm. Default value is epsilon=1e-9.

Nx

An integer value with the maximum number of states of the hidden Markov chain.

Ny

An integer value with the maximum number of signals emitted by the system.

Details

Value

Among other information, this function provides the following values:

P

A square matrix with Nx rows with the estimated transition probabilities.

M

A matrix of Nx rows and Ny columns, with the estimated emission probabilities.

n.iter

An integer indicating the number of iterations performed in the algorithm.

tol

A numeric value with the achieved tolerance value in the algorithm.

Fm

A matrix of dimension n \times Nx with the estimated forward probability values at the last iteration of the algorithm, where n is the size of the observed vector Y.

Bm

A matrix of dimension Nx \times n with the estimated forward probability values at the last iteration of the algorithm.

AIC

The estimated value of the Akaike statistics. The number of parameters to be estimated is nparam=Nx*(Nx-1)+Nx*(Ny-1).

Author(s)

M.L. Gamiz, N. Limnios, and M.C. Segovia-Garcia (2024)

References

Gamiz, M.L., Limnios, N., and Segovia-Garcia, M.C. (2023). Hidden Markov models in reliability and maintenance. European Journal of Operational Research, 304(3), 1242-1255.

See Also

See def.hmmR to define an object HMM, and sim.hmmR to simulate a random path from a given HMM object.

Examples

model<-'other'
rate<-NA
p<-NA
P<-matrix(c(0.7,0.3,1,0),2,2,byrow=TRUE)
M<-matrix(c(0.6,0.4,0,0,0,1),2,3,byrow=TRUE)
alpha<-c(1,0)
Nx<-2
Ny<-3
n.up<-1
n.green<-2
hmm0<-def.hmmR(model,rate,p,alpha,P,M,Nx,Ny,n.up,n.green)
set.seed(1969)
datos<-sim.hmmR(hmmR=hmm0,n=10)
estim<-fit.hmmR(Y=datos$Yn,P0=P,M0=M,alpha0=alpha,max.iter=50,epsilon=1e-9,Ny=3,Nx=2)
estim$P;P
estim$M;M

[Package HMMRel version 0.1.1 Index]