View source: R/functions_HMMRel.R
fit.hmmR | R Documentation |
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.
fit.hmmR(Y,P0,M0,alpha0,max.iter=50,epsilon=1e-9,Nx,Ny)
Y |
A sequence of observations consisting of signals of system performance. |
P0 |
A square matrix of dimension |
M0 |
A matrix of dimension |
alpha0 |
A vector of size |
max.iter |
An integer value with the maximum number of iterations in the iterative algorithm. Default value is |
epsilon |
A numeric value with the tolerance in the iterative algorithm. Default value is |
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. |
The argument alpha0
representing the initial distribution of the hidden MC is fixed, and defined by the user. The argument Nx
is the size of the state space of the hidden MC. As default, the set of numbers 1,...,Nx
is the state space of the hidden MC.
Ny
is the size of the alphabet of signals emitted. As default, the set of numbers 1,...,Ny
is the signal-alphabet.
The successive iterations of the algorithm can be traced and information is accessible from the outcome of this function.
Among other information, this function provides the following values:
P |
A square matrix with |
M |
A matrix of |
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 |
Bm |
A matrix of dimension |
AIC |
The estimated value of the Akaike statistics. The number of parameters to be estimated is |
M.L. Gamiz, N. Limnios, and M.C. Segovia-Garcia (2024)
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 def.hmmR
to define an object HMM, and sim.hmmR
to simulate a random path from a given HMM object.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.