StatHMMR-class {samurais} | R Documentation |
A Reference Class which contains statistics of a HMMR model.
Description
StatHMMR contains all the statistics associated to a HMMR model. It mainly includes the E-Step of the EM algorithm calculating the posterior distribution of the hidden variables (ie the smoothing probabilities), as well as the calculation of the prediction and filtering probabilities, the log-likelhood at each step of the algorithm and the obtained values of model selection criteria..
Fields
tau_tk
Matrix of size
(m, K)
giving the posterior probability that the observationY_{i}
originates from thek
-th regression model.alpha_tk
Matrix of size
(m, K)
giving the forwards probabilities:P(Y_{1},\dots,Y_{t}, z_{t} = k)
.beta_tk
Matrix of size
(m, K)
, giving the backwards probabilities:P(Y_{t+1},\dots,Y_{m} | z_{t} = k)
.xi_tkl
Array of size
(m - 1, K, K)
giving the joint post probabilities:xi_tk[t, k, l] = P(z_{t} = k, z_{t-1} = l | \boldsymbol{Y})
fort = 2,\dots,m
.f_tk
Matrix of size
(m, K)
giving the cumulative distribution functionf(y_{t} | z{_t} = k)
.log_f_tk
Matrix of size
(m, K)
giving the logarithm of the cumulative distributionf_tk
.loglik
Numeric. Log-likelihood of the HMMR model.
stored_loglik
Numeric vector. Stored values of the log-likelihood at each iteration of the EM algorithm.
klas
Column matrix of the labels issued from
z_ik
. Its elements areklas(i) = k
,k = 1,\dots,K
.z_ik
Hard segmentation logical matrix of dimension
(m, K)
obtained by the Maximum a posteriori (MAP) rule:z\_ik = 1 \ \textrm{if} \ z\_ik = \textrm{arg} \ \textrm{max}_{s} \ P(z_{i} = s | \boldsymbol{Y}) = tau\_tk;\ 0 \ \textrm{otherwise}
,k = 1,\dots,K
.state_probs
Matrix of size
(m, K)
giving the distribution of the Markov chain.P(z_{1},\dots,z_{m};\pi,\boldsymbol{A})
with\pi
the prior probabilities (fieldprior
of the class ParamHMMR) and\boldsymbol{A}
the transition matrix (fieldtrans_mat
of the class ParamHMMR) of the Markov chain.BIC
Numeric. Value of BIC (Bayesian Information Criterion).
AIC
Numeric. Value of AIC (Akaike Information Criterion).
regressors
Matrix of size
(m, K)
giving the values of the estimated polynomial regression components.predict_prob
Matrix of size
(m, K)
giving the prediction probabilities:P(z_{t} = k | y_{1},\dots,y_{t-1})
.predicted
Row matrix of size
(m, 1)
giving the sum of the polynomial components weighted by the prediction probabilitiespredict_prob
.filter_prob
Matrix of size
(m, K)
giving the filtering probabilitiesPr(z_{t} = k | y_{1},\dots,y_{t})
.filtered
Row matrix of size
(m, 1)
giving the sum of the polynomial components weighted by the filtering probabilities.smoothed_regressors
Matrix of size
(m, K)
giving the polynomial components weighted by the posterior probabilitytau_tk
.smoothed
Row matrix of size
(m, 1)
giving the sum of the polynomial components weighted by the posterior probabilitytau_tk
.
Methods
computeLikelihood(paramHMMR)
Method to compute the log-likelihood based on some parameters given by the object
paramHMMR
of class ParamHMMR.computeStats(paramHMMR)
Method used in the EM algorithm to compute statistics based on parameters provided by the object
paramHMMR
of class ParamHMMR.EStep(paramHMMR)
Method used in the EM algorithm to update statistics based on parameters provided by the object
paramHMMR
of class ParamHMMR (prior and posterior probabilities).MAP()
MAP calculates values of the fields
z_ik
andklas
by applying the Maximum A Posteriori Bayes allocation rule.z\_ik = 1 \ \textrm{if} \ z\_ik = \textrm{arg} \ \textrm{max}_{s} \ P(z_{i} = s | \boldsymbol{Y}) = tau\_tk;\ 0 \ \textrm{otherwise}