Title: | Statistical Models for the Unsupervised Segmentation of Time-Series ('SaMUraiS') |
---|---|
Description: | Provides a variety of original and flexible user-friendly statistical latent variable models and unsupervised learning algorithms to segment and represent time-series data (univariate or multivariate), and more generally, longitudinal data, which include regime changes. 'samurais' is built upon the following packages, each of them is an autonomous time-series segmentation approach: Regression with Hidden Logistic Process ('RHLP'), Hidden Markov Model Regression ('HMMR'), Multivariate 'RHLP' ('MRHLP'), Multivariate 'HMMR' ('MHMMR'), Piece-Wise regression ('PWR'). For the advantages/differences of each of them, the user is referred to our mentioned paper references. |
Authors: | Faicel Chamroukhi [aut] , Marius Bartcus [aut], Florian Lecocq [aut, cre] |
Maintainer: | Florian Lecocq <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.0 |
Built: | 2024-11-01 11:46:10 UTC |
Source: | CRAN |
samurais
is a toolbox including many original and flexible
user-friendly statistical latent variable models and efficient unsupervised
algorithms to segment and represent time-series data (univariate or
multivariate), and more generally, longitudinal data, which include regime
changes.
samurais
contains the following time series segmentation models:
RHLP;
HMM/HMMR;
PWR;
MRHLP;
MHMMR;
For the advantages/differences of each of them, the user is referred to our mentioned paper references.
To learn more about samurais
, start with the vignettes:
browseVignettes(package = "samurais")
Maintainer: Florian Lecocq [email protected]
Authors:
Faicel Chamroukhi [email protected] (0000-0002-5894-3103)
Marius Bartcus [email protected]
Chamroukhi, F., and Hien D. Nguyen. 2019. Model-Based Clustering and Classification of Functional Data. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery. https://doi.org/10.1002/widm.1298.
Chamroukhi, F. 2015. Statistical Learning of Latent Data Models for Complex Data Analysis. Habilitation Thesis (HDR), Universite de Toulon. https://chamroukhi.com/Dossier/FChamroukhi-Habilitation.pdf.
Trabelsi, D., S. Mohammed, F. Chamroukhi, L. Oukhellou, and Y. Amirat. 2013. An Unsupervised Approach for Automatic Activity Recognition Based on Hidden Markov Model Regression. IEEE Transactions on Automation Science and Engineering 3 (10): 829–335. https://chamroukhi.com/papers/Chamroukhi-MHMMR-IeeeTase.pdf.
Chamroukhi, F., D. Trabelsi, S. Mohammed, L. Oukhellou, and Y. Amirat. 2013. Joint Segmentation of Multivariate Time Series with Hidden Process Regression for Human Activity Recognition. Neurocomputing 120: 633–44. https://chamroukhi.com/papers/chamroukhi_et_al_neucomp2013b.pdf.
Chamroukhi, F., A. Same, G. Govaert, and P. Aknin. 2010. A Hidden Process Regression Model for Functional Data Description. Application to Curve Discrimination. Neurocomputing 73 (7-9): 1210–21. https://chamroukhi.com/papers/chamroukhi_neucomp_2010.pdf.
Chamroukhi, F. 2010. Hidden Process Regression for Curve Modeling, Classification and Tracking. Ph.D. Thesis, Universite de Technologie de Compiegne. https://chamroukhi.com/papers/FChamroukhi-Thesis.pdf.
Chamroukhi, F., A. Same, G. Govaert, and P. Aknin. 2009. Time Series Modeling by a Regression Approach Based on a Latent Process. Neural Networks 22 (5-6): 593–602. https://chamroukhi.com/papers/Chamroukhi_Neural_Networks_2009.pdf.
Useful links:
emHMMR implements the maximum-likelihood parameter estimation of the HMMR model by the Expectation-Maximization (EM) algorithm, known as Baum-Welch algorithm in the context of HMMs.
emHMMR(X, Y, K, p = 3, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE)
emHMMR(X, Y, K, p = 3, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Numeric vector of length m representing the observed
response/output |
K |
The number of regimes/segments (HMMR components). |
p |
Optional. The order of the polynomial regression. By default, |
variance_type |
Optional character indicating if the model is "homoskedastic" or "heteroskedastic" (i.e same variance or different variances for each of the K regmies). By default the model is "heteroskedastic". |
n_tries |
Optional. Number of runs of the EM algorithm. The solution providing the highest log-likelihood will be returned. If |
max_iter |
Optional. The maximum number of iterations for the EM algorithm. |
threshold |
Optional. A numeric value specifying the threshold for the relative difference of log-likelihood between two steps of the EM as stopping criteria. |
verbose |
Optional. A logical value indicating whether or not values of the log-likelihood should be printed during EM iterations. |
emHMMR function implements the EM algorithm for the HMMR model. This
function starts with an initialization of the parameters done by the method
initParam
of the class ParamHMMR, then it alternates between
the E-Step (method of the class StatHMMR) and the M-Step
(method of the class ParamHMMR) until convergence (until the
relative variation of log-likelihood between two steps of the EM algorithm
is less than the threshold
parameter).
EM returns an object of class ModelHMMR.
ModelHMMR, ParamHMMR, StatHMMR
data(univtoydataset) hmmr <- emHMMR(univtoydataset$x, univtoydataset$y, K = 5, p = 1, verbose = TRUE) hmmr$summary() hmmr$plot()
data(univtoydataset) hmmr <- emHMMR(univtoydataset$x, univtoydataset$y, K = 5, p = 1, verbose = TRUE) hmmr$summary() hmmr$plot()
emMHMMR implements the maximum-likelihood parameter estimation of the MHMMR model by the Expectation-Maximization (EM) algorithm, known as Baum-Welch algorithm in the context of HMMs.
emMHMMR(X, Y, K, p = 3, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE)
emMHMMR(X, Y, K, p = 3, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Matrix of size |
K |
The number of regimes (MHMMR components). |
p |
Optional. The order of the polynomial regression. By default, |
variance_type |
Optional character indicating if the model is "homoskedastic" or "heteroskedastic". By default the model is "heteroskedastic". |
n_tries |
Optional. Number of runs of the EM algorithm. The solution providing the highest log-likelihood will be returned. If |
max_iter |
Optional. The maximum number of iterations for the EM algorithm. |
threshold |
Optional. A numeric value specifying the threshold for the relative difference of log-likelihood between two steps of the EM as stopping criteria. |
verbose |
Optional. A logical value indicating whether or not values of the log-likelihood should be printed during EM iterations. |
emMHMMR function implements the EM algorithm. This function starts
with an initialization of the parameters done by the method initParam
of
the class ParamMHMMR, then it alternates between the E-Step
(method of the class StatMHMMR) and the M-Step (method of the
class ParamMHMMR) until convergence (until the relative
variation of log-likelihood between two steps of the EM algorithm is less
than the threshold
parameter).
EM returns an object of class ModelMHMMR.
ModelMHMMR, ParamMHMMR, StatMHMMR
data(multivtoydataset) mhmmr <- emMHMMR(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) mhmmr$summary() mhmmr$plot()
data(multivtoydataset) mhmmr <- emMHMMR(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) mhmmr$summary() mhmmr$plot()
emMRHLP implements the maximum-likelihood parameter estimation of the MRHLP model by the Expectation-Maximization (EM) algorithm.
emMRHLP(X, Y, K, p = 3, q = 1, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE, verbose_IRLS = FALSE)
emMRHLP(X, Y, K, p = 3, q = 1, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE, verbose_IRLS = FALSE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Matrix of size |
K |
The number of regimes (MRHLP components). |
p |
Optional. The order of the polynomial regression. By default, |
q |
Optional. The dimension of the logistic regression. For the purpose of segmentation, it must be set to 1 (which is the default value). |
variance_type |
Optional character indicating if the model is "homoskedastic" or "heteroskedastic". By default the model is "heteroskedastic". |
n_tries |
Optional. Number of runs of the EM algorithm. The solution providing the highest log-likelihood will be returned. If |
max_iter |
Optional. The maximum number of iterations for the EM algorithm. |
threshold |
Optional. A numeric value specifying the threshold for the relative difference of log-likelihood between two steps of the EM as stopping criteria. |
verbose |
Optional. A logical value indicating whether or not values of the log-likelihood should be printed during EM iterations. |
verbose_IRLS |
Optional. A logical value indicating whether or not values of the criterion optimized by IRLS should be printed at each step of the EM algorithm. |
emMRHLP function implements the EM algorithm of the MRHLP model.
This function starts with an initialization of the parameters done by the
method initParam
of the class ParamMRHLP, then it
alternates between the E-Step (method of the class StatMRHLP)
and the M-Step (method of the class ParamMRHLP) until
convergence (until the relative variation of log-likelihood between two
steps of the EM algorithm is less than the threshold
parameter).
EM returns an object of class ModelMRHLP.
ModelMRHLP, ParamMRHLP, StatMRHLP
data(multivtoydataset) mrhlp <- emMRHLP(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) mrhlp$summary() mrhlp$plot()
data(multivtoydataset) mrhlp <- emMRHLP(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) mrhlp$summary() mrhlp$plot()
emRHLP implements the maximum-likelihood parameter estimation of the RHLP model by the Expectation-Maximization (EM) algorithm.
emRHLP(X, Y, K, p = 3, q = 1, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE, verbose_IRLS = FALSE)
emRHLP(X, Y, K, p = 3, q = 1, variance_type = c("heteroskedastic", "homoskedastic"), n_tries = 1, max_iter = 1500, threshold = 1e-06, verbose = FALSE, verbose_IRLS = FALSE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Numeric vector of length m representing the observed
response/output |
K |
The number of regimes (RHLP components). |
p |
Optional. The order of the polynomial regression. By default, |
q |
Optional. The dimension of the logistic regression. For the purpose of segmentation, it must be set to 1 (which is the default value). |
variance_type |
Optional character indicating if the model is "homoskedastic" or "heteroskedastic". By default the model is "heteroskedastic". |
n_tries |
Optional. Number of runs of the EM algorithm. The solution providing the highest log-likelihood will be returned. If |
max_iter |
Optional. The maximum number of iterations for the EM algorithm. |
threshold |
Optional. A numeric value specifying the threshold for the relative difference of log-likelihood between two steps of the EM as stopping criteria. |
verbose |
Optional. A logical value indicating whether or not values of the log-likelihood should be printed during EM iterations. |
verbose_IRLS |
Optional. A logical value indicating whether or not values of the criterion optimized by IRLS should be printed at each step of the EM algorithm. |
emRHLP function implements the EM algorithm for the RHLP model. This
function starts with an initialization of the parameters done by the method
initParam
of the class ParamRHLP, then it alternates between
the E-Step (method of the class StatRHLP) and the M-Step
(method of the class ParamRHLP) until convergence (until the
relative variation of log-likelihood between two steps of the EM algorithm
is less than the threshold
parameter).
EM returns an object of class ModelRHLP.
ModelRHLP, ParamRHLP, StatRHLP
data(univtoydataset) rhlp <- emRHLP(univtoydataset$x, univtoydataset$y, K = 3, p = 1, verbose = TRUE) rhlp$summary() rhlp$plot()
data(univtoydataset) rhlp <- emRHLP(univtoydataset$x, univtoydataset$y, K = 3, p = 1, verbose = TRUE) rhlp$summary() rhlp$plot()
fitPWRFisher is used to fit a Piecewise Regression (PWR) model by maximum-likelihood via an optimized dynamic programming algorithm. The estimation performed by the dynamic programming algorithm provides an optimal segmentation of the time series.
fitPWRFisher(X, Y, K, p = 3)
fitPWRFisher(X, Y, K, p = 3)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Numeric vector of length m representing the observed
response/output |
K |
The number of regimes/segments (PWR components). |
p |
Optional. The order of the polynomial regression. By default, |
fitPWRFisher function implements an optimized dynamic programming
algorithm of the PWR model. This function starts with the calculation of
the "cost matrix" then it estimates the transition points given K
the
number of regimes thanks to the method computeDynamicProgram
(method of
the class ParamPWR).
fitPWRFisher returns an object of class ModelPWR.
data(univtoydataset) pwr <- fitPWRFisher(univtoydataset$x, univtoydataset$y, K = 5, p = 1) pwr$summary() pwr$plot()
data(univtoydataset) pwr <- fitPWRFisher(univtoydataset$x, univtoydataset$y, K = 5, p = 1) pwr$summary() pwr$plot()
hmmProcess calculates the probability distribution of a random process following a Markov chain
hmmProcess(prior, trans_mat, n)
hmmProcess(prior, trans_mat, n)
prior |
Numeric vector or a one row matrix of length K representing the prior probabilities of the Markov chain. |
trans_mat |
Matrix of size |
n |
Numeric. Number of variables of the Markov chain. |
hmmProcess calculates the distribution
of a Markov chain
with prior probability
and transition
matrix
.
The calculation is based on the following formula:
Matrix of size giving the distribution of process given
the K-state Markov chain parameters.
MData is a reference class which represents multivariate objects. The data
can be ordered by time (multivariate time series). In the last case, the
field X
represents the time.
X
Numeric vector of length m.
Y
Matrix of size representing a
dimension
function of
X
observed at points .
mkStochastic ensures that it is a stochastic vector, matrix or array.
mkStochastic(M)
mkStochastic(M)
M |
A vector, matrix or array to transform. |
mkStochastic ensures that the giving argument is a stochastic vector, matrix or array, i.e., that the sum over the last dimension is 1.
A vector, matrix or array for which the sum over the last dimension is 1.
ModelHMMR represents an estimated HMMR model.
param
An object of class ParamHMMR. It contains the estimated values of the parameters.
stat
An object of class StatHMMR. It contains all the statistics associated to the HMMR model.
plot(what = c("predicted", "filtered", "smoothed", "regressors",
"loglikelihood"), ...)
Plot method.
what
The type of graph requested:
"predicted" =
Predicted time series and predicted
regime probabilities (fields predicted
and
predict_prob
of class StatHMMR).
"filtered" =
Filtered time series and filtering
regime probabilities (fields filtered
and
filter_prob
of class StatHMMR).
"smoothed" =
Smoothed time series, and
segmentation (fields smoothed
and klas
of the
class StatHMMR).
"regressors" =
Polynomial regression components
(fields regressors
and tau_tk
of class
StatHMMR).
"loglikelihood" =
Value of the log-likelihood for
each iteration (field stored_loglik
of class
StatHMMR).
...
Other graphics parameters.
By default, all the graphs mentioned above are produced.
summary(digits = getOption("digits"))
Summary method.
digits
The number of significant digits to use when printing.
data(univtoydataset) hmmr <- emHMMR(univtoydataset$x, univtoydataset$y, K = 5, p = 1, verbose = TRUE) # hmmr is a ModelHMMR object. It contains some methods such as 'summary' and 'plot' hmmr$summary() hmmr$plot() # hmmr has also two fields, stat and param which are reference classes as well # Log-likelihood: hmmr$stat$loglik # Parameters of the polynomial regressions: hmmr$param$beta
data(univtoydataset) hmmr <- emHMMR(univtoydataset$x, univtoydataset$y, K = 5, p = 1, verbose = TRUE) # hmmr is a ModelHMMR object. It contains some methods such as 'summary' and 'plot' hmmr$summary() hmmr$plot() # hmmr has also two fields, stat and param which are reference classes as well # Log-likelihood: hmmr$stat$loglik # Parameters of the polynomial regressions: hmmr$param$beta
ModelMHMMR represents an estimated MHMMR model.
param
A ParamMHMMR object. It contains the estimated values of the parameters.
stat
A StatMHMMR object. It contains all the statistics associated to the MHMMR model.
plot(what = c("predicted", "filtered", "smoothed", "regressors",
"loglikelihood"), ...)
Plot method.
what
The type of graph requested:
"predicted" =
Predicted time series and predicted
regime probabilities (fields predicted
and
predict_prob
of class StatMHMMR).
"filtered" =
Filtered time series and filtering
regime probabilities (fields filtered
and
filter_prob
of class StatMHMMR).
"smoothed" =
Smoothed time series, and
segmentation (fields smoothed
and klas
of class
StatMHMMR).
"regressors" =
Polynomial regression components
(fields regressors
and tau_tk
of class
StatMHMMR).
"loglikelihood" =
Value of the log-likelihood for
each iteration (field stored_loglik
of class
StatMHMMR).
...
Other graphics parameters.
By default, all the above graphs are produced.
summary(digits = getOption("digits"))
Summary method.
digits
The number of significant digits to use when printing.
data(multivtoydataset) mhmmr <- emMHMMR(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) # mhmmr is a ModelMHMMR object. It contains some methods such as 'summary' and 'plot' mhmmr$summary() mhmmr$plot() # mhmmr has also two fields, stat and param which are reference classes as well # Log-likelihood: mhmmr$stat$loglik # Parameters of the polynomial regressions: mhmmr$param$beta
data(multivtoydataset) mhmmr <- emMHMMR(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) # mhmmr is a ModelMHMMR object. It contains some methods such as 'summary' and 'plot' mhmmr$summary() mhmmr$plot() # mhmmr has also two fields, stat and param which are reference classes as well # Log-likelihood: mhmmr$stat$loglik # Parameters of the polynomial regressions: mhmmr$param$beta
ModelMRHLP represents an estimated MRHLP model.
param
A ParamMRHLP object. It contains the estimated values of the parameters.
stat
A StatMRHLP object. It contains all the statistics associated to the MRHLP model.
plot(what = c("regressors", "estimatedsignal", "loglikelihood"), ...)
Plot method.
what
The type of graph requested:
...
Other graphics parameters.
By default, all the graphs mentioned above are produced.
summary(digits = getOption("digits"))
Summary method.
digits
The number of significant digits to use when printing.
data(multivtoydataset) mrhlp <- emMRHLP(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) # mrhlp is a ModelMRHLP object. It contains some methods such as 'summary' and 'plot' mrhlp$summary() mrhlp$plot() # mrhlp has also two fields, stat and param which are reference classes as well # Log-likelihood: mrhlp$stat$loglik # Parameters of the polynomial regressions: mrhlp$param$beta
data(multivtoydataset) mrhlp <- emMRHLP(multivtoydataset$x, multivtoydataset[,c("y1", "y2", "y3")], K = 5, p = 1, verbose = TRUE) # mrhlp is a ModelMRHLP object. It contains some methods such as 'summary' and 'plot' mrhlp$summary() mrhlp$plot() # mrhlp has also two fields, stat and param which are reference classes as well # Log-likelihood: mrhlp$stat$loglik # Parameters of the polynomial regressions: mrhlp$param$beta
ModelPWR represents an estimated PWR model.
param
A ParamPWR object. It contains the estimated values of the parameters.
stat
A StatPWR object. It contains all the statistics associated to the PWR model.
plot(what = c("regressors", "segmentation"), ...)
Plot method.
what
The type of graph requested:
...
Other graphics parameters.
By default, all the graphs mentioned above are produced.
summary(digits = getOption("digits"))
Summary method.
digits
The number of significant digits to use when printing.
data(univtoydataset) pwr <- fitPWRFisher(univtoydataset$x, univtoydataset$y, K = 5, p = 1) # pwr is a ModelPWR object. It contains some methods such as 'summary' and 'plot' pwr$summary() pwr$plot() # pwr has also two fields, stat and param which are reference classes as well # Value of the objective function: pwr$stat$objective # Parameters of the polynomial regressions: pwr$param$beta
data(univtoydataset) pwr <- fitPWRFisher(univtoydataset$x, univtoydataset$y, K = 5, p = 1) # pwr is a ModelPWR object. It contains some methods such as 'summary' and 'plot' pwr$summary() pwr$plot() # pwr has also two fields, stat and param which are reference classes as well # Value of the objective function: pwr$stat$objective # Parameters of the polynomial regressions: pwr$param$beta
ModelRHLP represents an estimated RHLP model.
param
A ParamRHLP object. It contains the estimated values of the parameters.
stat
A StatRHLP object. It contains all the statistics associated to the RHLP model.
plot(what = c("regressors", "estimatedsignal", "loglikelihood"), ...)
Plot method.
what
The type of graph requested:
...
Other graphics parameters.
By default, all the graphs mentioned above are produced.
summary(digits = getOption("digits"))
Summary method.
digits
The number of significant digits to use when printing.
data(univtoydataset) rhlp <- emRHLP(univtoydataset$x, univtoydataset$y, K = 3, p = 1, verbose = TRUE) # rhlp is a ModelMHMMR object. It contains some methods such as 'summary' and 'plot' rhlp$summary() rhlp$plot() # rhlp has also two fields, stat and param which are reference classes as well # Log-likelihood: rhlp$stat$loglik # Parameters of the polynomial regressions: rhlp$param$beta
data(univtoydataset) rhlp <- emRHLP(univtoydataset$x, univtoydataset$y, K = 3, p = 1, verbose = TRUE) # rhlp is a ModelMHMMR object. It contains some methods such as 'summary' and 'plot' rhlp$summary() rhlp$plot() # rhlp has also two fields, stat and param which are reference classes as well # Log-likelihood: rhlp$stat$loglik # Parameters of the polynomial regressions: rhlp$param$beta
This dataset is provided for illustration only and represents the three acceleration components recorded over time with body mounted accelerometers during the activity of a given person. These data consist therefore of multidimensional time series with several regime changes over time, each regime is associated with an activity.
multivrealdataset
multivrealdataset
A data frame with 2253 rows and 4 columns:
The covariate variable (the sampling time).
X axis component of the acceleration.
Y axis component of the acceleration.
Z axis component of the acceleration.
A simulated non-stationary multidimensional time series with five regimes (segments). This time series is used for illustration.
multivtoydataset
multivtoydataset
A data frame with 670 rows and 4 columns:
The covariate variable (the sampling time for time series).
The first dimension of the time series. The latter has been generated as follows:
First regime: 100 values of standard Normally distributed random numbers.
Second regime: 120 values of Normally distributed random numbers with mean 7 and unit variance.
Third regime: 200 values of Normally distributed random numbers with mean 4 and unit variance.
Fourth regime: 100 values of Normally distributed random numbers with mean -1 and unit variance.
Fifth regime: 150 values of Normally distributed random numbers with mean 3.5 and unit variance.
The second dimension of the time series. The latter has been generated as follows:
First regime: 100 values of Normally distributed random numbers with mean 1 and unit variance.
Second regime: 120 values of Normally distributed random numbers with mean 5 and unit variance.
Third regime: 200 values of Normally distributed random numbers with mean 6 and unit variance.
Fourth regime: 100 values of Normally distributed random numbers with mean -2 and unit variance.
Fifth regime: 150 values of Normally distributed random numbers with mean 2 and unit variance.
The third dimension of the time series. The latter has been generated as follows:
First regime: 100 values of Normally distributed random numbers with mean -2 and unit variance.
Second regime: 120 values of Normally distributed random numbers with mean 10 and unit variance.
Third regime: 200 values of Normally distributed random numbers with mean 8 and unit variance.
Fourth regime: 100 values of Normally distributed random numbers and unit variance.
Fifth regime: 150 values of Normally distributed random numbers with mean 5 and unit variance.
ParamHMMR contains all the parameters of a HMMR model. The parameters are calculated by the initialization Method and then updated by the Method implementing the M-Step of the EM algorithm.
X
Numeric vector of length m representing the covariates/inputs
.
Y
Numeric vector of length m representing the observed
response/output .
m
Numeric. Length of the response/output vector Y
.
K
The number of regimes (HMMR components).
p
The order of the polynomial regression.
variance_type
Character indicating if the model is homoskedastic
(variance_type = "homoskedastic"
) or heteroskedastic (variance_type = "heteroskedastic"
). By default the model is heteroskedastic.
prior
The prior probabilities of the Markov chain. prior
is a row
matrix of dimension .
trans_mat
The transition matrix of the Markov chain. trans_mat
is a
matrix of dimension .
mask
Mask applied to the transition matrices trans_mat
. By default,
a mask of order one is applied.
beta
Parameters of the polynomial regressions. is a matrix of dimension
,
with
p
the order of the polynomial regression. p
is fixed to 3 by
default.
sigma2
The variances for the K
regimes. If HMMR model is
heteroskedastic (variance_type = "heteroskedastic"
) then sigma2
is a
matrix of size (otherwise HMMR model is homoskedastic
(
variance_type = "homoskedastic"
) and sigma2
is a matrix of size
).
nu
The degree of freedom of the HMMR model representing the complexity of the model.
phi
A list giving the regression design matrices for the polynomial and the logistic regressions.
initParam(try_algo = 1)
Method to initialize parameters mask
, prior
,
trans_mat
, beta
and sigma2
.
If try_algo = 1
then beta
and sigma2
are
initialized by segmenting the time series Y
uniformly into
K
contiguous segments. Otherwise, beta
and
sigma2
are initialized by segmenting randomly the time series
Y
into K
segments.
MStep(statHMMR)
Method which implements the M-step of the EM algorithm to learn the
parameters of the HMMR model based on statistics provided by the object
statHMMR
of class StatHMMR (which contains the E-step).
ParamMHMMR contains all the parameters of a MHMMR model. The parameters are calculated by the initialization Method and then updated by the Method implementing the M-Step of the EM algorithm.
mData
MData object representing the sample (covariates/inputs
X
and observed multivariate responses/outputs Y
).
K
The number of regimes (MHMMR components).
p
The order of the polynomial regression.
variance_type
Character indicating if the model is homoskedastic
(variance_type = "homoskedastic"
) or heteroskedastic (variance_type = "heteroskedastic"
). By default the model is heteroskedastic.
prior
The prior probabilities of the Markov chain. prior
is a row
matrix of dimension .
trans_mat
The transition matrix of the Markov chain. trans_mat
is a
matrix of dimension .
mask
Mask applied to the transition matrices trans_mat
. By default,
a mask of order one is applied.
beta
Parameters of the polynomial regressions. is an array of dimension
,
with
p
the order of the polynomial regression. p
is fixed to 3 by
default.
sigma2
The variances for the K
regimes. If MRHLP model is
heteroskedastic (variance_type = "heteroskedastic"
) then sigma2
is an
array of size (otherwise MRHLP model is homoskedastic
(
variance_type = "homoskedastic"
) and sigma2
is a matrix of size
).
nu
The degree of freedom of the MHMMR model representing the complexity of the model.
phi
A list giving the regression design matrices for the polynomial and the logistic regressions.
initParam(try_algo = 1)
Method to initialize parameters prior
, trans_mat
,
beta
and sigma2
.
If try_algo = 1
then beta
and sigma2
are
initialized by segmenting the time series Y
uniformly into
K
contiguous segments. Otherwise, beta
and
sigma2
are initialized by segmenting randomly the time series
Y
into K
segments.
MStep(statMHMMR)
Method which implements the M-step of the EM algorithm to learn the
parameters of the MHMMR model based on statistics provided by the object
statMHMMR
of class StatMHMMR (which contains the
E-step).
ParamMRHLP contains all the parameters of a MRHLP model. The parameters are calculated by the initialization Method and then updated by the Method implementing the M-Step of the EM algorithm.
mData
MData object representing the sample (covariates/inputs
X
and observed responses/outputs Y
).
K
The number of regimes (MRHLP components).
p
The order of the polynomial regression.
q
The dimension of the logistic regression. For the purpose of segmentation, it must be set to 1.
variance_type
Character indicating if the model is homoskedastic
(variance_type = "homoskedastic"
) or heteroskedastic (variance_type = "heteroskedastic"
). By default the model is heteroskedastic.
W
Parameters of the logistic process.
is a matrix of dimension
, with
q
the order of the
logistic regression. q
is fixed to 1 by default.
beta
Parameters of the polynomial regressions. is an array of dimension
,
with
p
the order of the polynomial regression. p
is fixed to 3 by
default.
sigma2
The variances for the K
regimes. If MRHLP model is
heteroskedastic (variance_type = "heteroskedastic"
) then sigma2
is an
array of size (otherwise MRHLP model is homoskedastic
(
variance_type = "homoskedastic"
) and sigma2
is a matrix of size
).
nu
The degree of freedom of the MRHLP model representing the complexity of the model.
phi
A list giving the regression design matrices for the polynomial and the logistic regressions.
initParam(try_algo = 1)
Method to initialize parameters W
, beta
and
sigma2
.
If try_algo = 1
then beta
and sigma2
are
initialized by segmenting the time series Y
uniformly into
K
contiguous segments. Otherwise, W
, beta
and
sigma2
are initialized by segmenting randomly the time series
Y
into K
segments.
MStep(statMRHLP, verbose_IRLS)
Method which implements the M-step of the EM algorithm to learn the
parameters of the MRHLP model based on statistics provided by the object
statMRHLP
of class StatMRHLP (which contains the
E-step).
ParamPWR contains all the parameters of a PWR model. The parameters are calculated by the initialization Method and then updated by the Method dynamic programming (here dynamic programming)
X
Numeric vector of length m representing the covariates/inputs
.
Y
Numeric vector of length m representing the observed
response/output .
m
Numeric. Length of the response/output vector Y
.
K
The number of regimes (PWR components).
p
The order of the polynomial regression. p
is fixed to 3 by
default.
gamma
Set of transition points. gamma
is a column matrix of size
.
beta
Parameters of the polynomial regressions. beta
is a matrix of
dimension , with
p
the order of the polynomial
regression. p
is fixed to 3 by default.
sigma2
The variances for the K
regimes. sigma2
is a matrix of size
.
phi
A list giving the regression design matrices for the polynomial and the logistic regressions.
computeDynamicProgram(C1, K)
Method which implements the dynamic programming based on the cost matrix
C1
and the number of regimes/segments K
.
computeParam()
Method which estimates the parameters beta
and sigma2
knowing the transition points gamma
.
ParamRHLP contains all the parameters of a RHLP model. The parameters are calculated by the initialization Method and then updated by the Method implementing the M-Step of the EM algorithm.
X
Numeric vector of length m representing the covariates/inputs
.
Y
Numeric vector of length m representing the observed
response/output .
m
Numeric. Length of the response/output vector Y
.
K
The number of regimes (RHLP components).
p
The order of the polynomial regression.
q
The dimension of the logistic regression. For the purpose of segmentation, it must be set to 1.
variance_type
Character indicating if the model is homoskedastic
(variance_type = "homoskedastic"
) or heteroskedastic (variance_type = "heteroskedastic"
). By default the model is heteroskedastic.
W
Parameters of the logistic process.
is a matrix of dimension
, with
q
the order of the
logistic regression. q
is fixed to 1 by default.
beta
Parameters of the polynomial regressions. is a matrix of dimension
,
with
p
the order of the polynomial regression. p
is fixed to 3 by
default.
sigma2
The variances for the K
regimes. If RHLP model is
heteroskedastic (variance_type = "heteroskedastic"
) then sigma2
is a
matrix of size (otherwise RHLP model is homoskedastic
(
variance_type = "homoskedastic"
) and sigma2
is a matrix of size
).
nu
The degree of freedom of the RHLP model representing the complexity of the model.
phi
A list giving the regression design matrices for the polynomial and the logistic regressions.
initParam(try_algo = 1)
Method to initialize parameters W
, beta
and
sigma2
.
If try_algo = 1
then beta
and sigma2
are
initialized by segmenting the time series Y
uniformly into
K
contiguous segments. Otherwise, W
, beta
and
sigma2
are initialized by segmenting randomly the time series
Y
into K
segments.
MStep(statRHLP, verbose_IRLS)
Method which implements the M-step of the EM algorithm to learn the
parameters of the RHLP model based on statistics provided by the object
statRHLP
of class StatRHLP (which contains the E-step).
selectHMMR implements a model selection procedure to select an optimal HMMR model with unknown structure.
selectHMMR(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
selectHMMR(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Numeric vector of length m representing the observed
response/output |
Kmin |
The minimum number of regimes (HMMR components). |
Kmax |
The maximum number of regimes (HMMR components). |
pmin |
The minimum order of the polynomial regression. |
pmax |
The maximum order of the polynomial regression. |
criterion |
The criterion used to select the HMMR model ("BIC", "AIC"). |
verbose |
Optional. A logical value indicating whether or not a summary of the selected model should be displayed. |
selectHMMR selects the optimal HMMR model among a set of model
candidates by optimizing a model selection criteria, including the Bayesian
Information Criterion (BIC). This function first fits the different HMMR
model candidates by varying the number of regimes K
from Kmin
to Kmax
and the order of the polynomial regression p
from pmin
to pmax
. The
model having the highest value of the chosen selection criterion is then
selected.
selectHMMR returns an object of class ModelHMMR
representing the selected HMMR model according to the chosen criterion
.
data(univtoydataset) selectedhmmr <- selectHMMR(X = univtoydataset$x, Y = univtoydataset$y, Kmin = 2, Kmax = 6, pmin = 0, pmax = 2) selectedhmmr$plot()
data(univtoydataset) selectedhmmr <- selectHMMR(X = univtoydataset$x, Y = univtoydataset$y, Kmin = 2, Kmax = 6, pmin = 0, pmax = 2) selectedhmmr$plot()
selectMHMMR implements a model selection procedure to select an optimal MHMMR model with unknown structure.
selectMHMMR(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
selectMHMMR(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Matrix of size |
Kmin |
The minimum number of regimes (c components). |
Kmax |
The maximum number of regimes (MHMMR components). |
pmin |
The minimum order of the polynomial regression. |
pmax |
The maximum order of the polynomial regression. |
criterion |
The criterion used to select the MHMMR model ("BIC", "AIC"). |
verbose |
Optional. A logical value indicating whether or not a summary of the selected model should be displayed. |
selectMHMMR selects the optimal MHMMR model among a set of model
candidates by optimizing a model selection criteria, including the Bayesian
Information Criterion (BIC). This function first fits the different MHMMR
model candidates by varying the number of regimes K
from Kmin
to Kmax
and the order of the polynomial regression p
from pmin
to pmax
. The
model having the highest value of the chosen selection criterion is then
selected.
selectMHMMR returns an object of class ModelMHMMR
representing the selected MHMMR model according to the chosen criterion
.
data(multivtoydataset) x <- multivtoydataset$x y <- multivtoydataset[, c("y1", "y2", "y3")] selectedmhmmr <- selectMHMMR(X = x, Y = y, Kmin = 2, Kmax = 6, pmin = 0, pmax = 2) selectedmhmmr$summary()
data(multivtoydataset) x <- multivtoydataset$x y <- multivtoydataset[, c("y1", "y2", "y3")] selectedmhmmr <- selectMHMMR(X = x, Y = y, Kmin = 2, Kmax = 6, pmin = 0, pmax = 2) selectedmhmmr$summary()
selecMRHLP implements a model selection procedure to select an optimal MRHLP model with unknown structure.
selectMRHLP(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
selectMRHLP(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Matrix of size |
Kmin |
The minimum number of regimes (MRHLP components). |
Kmax |
The maximum number of regimes (MRHLP components). |
pmin |
The minimum order of the polynomial regression. |
pmax |
The maximum order of the polynomial regression. |
criterion |
The criterion used to select the MRHLP model ("BIC", "AIC"). |
verbose |
Optional. A logical value indicating whether or not a summary of the selected model should be displayed. |
selectMRHLP selects the optimal MRHLP model among a set of model
candidates by optimizing a model selection criteria, including the Bayesian
Information Criterion (BIC). This function first fits the different MRHLP
model candidates by varying the number of regimes K
from Kmin
to Kmax
and the order of the polynomial regression p
from pmin
to pmax
. The
model having the highest value of the chosen selection criterion is then
selected.
selectMRHLP returns an object of class ModelMRHLP
representing the selected MRHLP model according to the chosen criterion
.
data(multivtoydataset) # Let's select a MRHLP model on a multivariate time series with 3 regimes: data <- multivtoydataset[1:320, ] x <- data$x y <- data[, c("y1", "y2", "y3")] selectedmrhlp <- selectMRHLP(X = x, Y = y, Kmin = 2, Kmax = 4, pmin = 0, pmax = 1) selectedmrhlp$summary()
data(multivtoydataset) # Let's select a MRHLP model on a multivariate time series with 3 regimes: data <- multivtoydataset[1:320, ] x <- data$x y <- data[, c("y1", "y2", "y3")] selectedmrhlp <- selectMRHLP(X = x, Y = y, Kmin = 2, Kmax = 4, pmin = 0, pmax = 1) selectedmrhlp$summary()
selecRHLP implements a model selection procedure to select an optimal RHLP model with unknown structure.
selectRHLP(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
selectRHLP(X, Y, Kmin = 1, Kmax = 10, pmin = 0, pmax = 4, criterion = c("BIC", "AIC"), verbose = TRUE)
X |
Numeric vector of length m representing the covariates/inputs
|
Y |
Numeric vector of length m representing the observed
response/output |
Kmin |
The minimum number of regimes (RHLP components). |
Kmax |
The maximum number of regimes (RHLP components). |
pmin |
The minimum order of the polynomial regression. |
pmax |
The maximum order of the polynomial regression. |
criterion |
The criterion used to select the RHLP model ("BIC", "AIC"). |
verbose |
Optional. A logical value indicating whether or not a summary of the selected model should be displayed. |
selectRHLP selects the optimal MRHLP model among a set of model
candidates by optimizing a model selection criteria, including the Bayesian
Information Criterion (BIC). This function first fits the different RHLP
model candidates by varying the number of regimes K
from Kmin
to Kmax
and the order of the polynomial regression p
from pmin
to pmax
. The
model having the highest value of the chosen selection criterion is then
selected.
selectRHLP returns an object of class ModelRHLP
representing the selected RHLP model according to the chosen criterion
.
data(univtoydataset) # Let's select a RHLP model on a time series with 3 regimes: data <- univtoydataset[1:320,] selectedrhlp <- selectRHLP(X = data$x, Y = data$y, Kmin = 2, Kmax = 4, pmin = 0, pmax = 1) selectedrhlp$summary()
data(univtoydataset) # Let's select a RHLP model on a time series with 3 regimes: data <- univtoydataset[1:320,] selectedrhlp <- selectRHLP(X = data$x, Y = data$y, Kmin = 2, Kmax = 4, pmin = 0, pmax = 1) selectedrhlp$summary()
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..
tau_tk
Matrix of size giving the posterior probability
that the observation
originates from the
-th regression
model.
alpha_tk
Matrix of size giving the forwards
probabilities:
.
beta_tk
Matrix of size , giving the backwards
probabilities:
.
xi_tkl
Array of size giving the joint post
probabilities:
for
.
f_tk
Matrix of size giving the cumulative distribution
function
.
log_f_tk
Matrix of size giving the logarithm of the
cumulative distribution
f_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 are
,
.
z_ik
Hard segmentation logical matrix of dimension
obtained by the Maximum a posteriori (MAP) rule:
,
.
state_probs
Matrix of size giving the distribution of the
Markov chain.
with
the prior probabilities (field
prior
of the class
ParamHMMR) and the transition matrix
(field
trans_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 giving the values of the
estimated polynomial regression components.
predict_prob
Matrix of size giving the prediction
probabilities:
.
predicted
Row matrix of size giving the sum of the
polynomial components weighted by the prediction probabilities
predict_prob
.
filter_prob
Matrix of size giving the filtering
probabilities
.
filtered
Row matrix of size giving the sum of the
polynomial components weighted by the filtering probabilities.
smoothed_regressors
Matrix of size giving the polynomial
components weighted by the posterior probability
tau_tk
.
smoothed
Row matrix of size giving the sum of the
polynomial components weighted by the posterior probability
tau_tk
.
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
and klas
by applying the Maximum A Posteriori Bayes allocation rule.
StatMHMMR contains all the statistics associated to a MHMMR 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..
tau_tk
Matrix of size giving the posterior probability
that the observation
originates from the
-th regression
model.
alpha_tk
Matrix of size giving the forwards
probabilities:
.
beta_tk
Matrix of size , giving the backwards
probabilities:
.
xi_tkl
Array of size giving the joint post
probabilities:
for
.
f_tk
Matrix of size giving the cumulative distribution
function
.
log_f_tk
Matrix of size giving the logarithm of the
cumulative distribution
f_tk
.
loglik
Numeric. Log-likelihood of the MHMMR 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 are
,
.
z_ik
Hard segmentation logical matrix of dimension
obtained by the Maximum a posteriori (MAP) rule:
,
.
state_probs
Matrix of size giving the distribution of the
Markov chain.
with
the prior probabilities (field
prior
of the class
ParamMHMMR) and the transition matrix
(field
trans_mat
of the class ParamMHMMR) of the Markov
chain.
BIC
Numeric. Value of BIC (Bayesian Information Criterion).
AIC
Numeric. Value of AIC (Akaike Information Criterion).
regressors
Matrix of size giving the values of the
estimated polynomial regression components.
predict_prob
Matrix of size giving the prediction
probabilities:
.
predicted
Row matrix of size giving the sum of the
polynomial components weighted by the prediction probabilities
predict_prob
.
filter_prob
Matrix of size giving the filtering
probabilities
.
filtered
Row matrix of size giving the sum of the
polynomial components weighted by the filtering probabilities.
smoothed_regressors
Matrix of size giving the polynomial
components weighted by the posterior probability
tau_tk
.
smoothed
Row matrix of size giving the sum of the
polynomial components weighted by the posterior probability
tau_tk
.
computeLikelihood(paramMHMMR)
Method to compute the log-likelihood based on some parameters given by
the object paramMHMMR
of class ParamMHMMR.
computeStats(paramMHMMR)
Method used in the EM algorithm to compute statistics based on
parameters provided by the object paramMHMMR
of class
ParamMHMMR.
EStep(paramMHMMR)
Method used in the EM algorithm to update statistics based on parameters
provided by the object paramMHMMR
of class ParamMHMMR
(prior and posterior probabilities).
MAP()
MAP calculates values of the fields z_ik
and klas
by applying the Maximum A Posteriori Bayes allocation rule.
StatMRHLP contains all the statistics associated to a MRHLP model. It mainly includes the E-Step of the EM algorithm calculating the posterior distribution of the hidden variables, as well as the calculation of the log-likelhood at each step of the algorithm and the obtained values of model selection criteria..
pi_ik
Matrix of size representing the prior/logistic
probabilities
of
the latent variable
.
z_ik
Hard segmentation logical matrix of dimension
obtained by the Maximum a posteriori (MAP) rule:
,
.
klas
Column matrix of the labels issued from z_ik
. Its elements are
,
.
tau_ik
Matrix of size giving the posterior probability
that the observation
originates from the
-th regression
model.
polynomials
Array of size giving the values of the
estimated polynomial regression components.
weighted_polynomials
Array of size giving the values
of the estimated polynomial regression components weighted by the prior
probabilities
pi_ik
.
Ex
Matrix of size (m, d). Ex
is the curve expectation
(estimated signal): sum of the polynomial components weighted by the
logistic probabilities pi_ik
.
loglik
Numeric. Observed-data log-likelihood of the MRHLP model.
com_loglik
Numeric. Complete-data log-likelihood of the MRHLP model.
stored_loglik
Numeric vector. Stored values of the log-likelihood at each EM iteration.
stored_com_loglik
Numeric vector. Stored values of the Complete log-likelihood at each EM iteration.
BIC
Numeric. Value of BIC (Bayesian Information Criterion).
ICL
Numeric. Value of ICL (Integrated Completed Likelihood).
AIC
Numeric. Value of AIC (Akaike Information Criterion).
log_piik_fik
Matrix of size giving the values of the
logarithm of the joint probability
,
.
log_sum_piik_fik
Column matrix of size m giving the values of
,
.
computeLikelihood(reg_irls)
Method to compute the log-likelihood. reg_irls
is the value of
the regularization part in the IRLS algorithm.
computeStats(paramMRHLP)
Method used in the EM algorithm to compute statistics based on
parameters provided by the object paramMRHLP
of class
ParamMRHLP.
EStep(paramMRHLP)
Method used in the EM algorithm to update statistics based on parameters
provided by the object paramMRHLP
of class ParamMRHLP
(prior and posterior probabilities).
MAP()
MAP calculates values of the fields z_ik
and klas
by applying the Maximum A Posteriori Bayes allocation rule.
StatPWR contains all the statistics associated to a PWR model.
z_ik
Logical matrix of dimension giving the class vector.
klas
Column matrix of the labels issued from z_ik
. Its elements are
,
.
mean_function
Approximation of the time series given the estimated
parameters. mean_function
is a matrix of size .
regressors
Matrix of size giving the values of the
estimated polynomial regression components.
objective
Numeric. Value of the objective function.
computeStats(paramPWR)
Method used at the end of the dynamic programming algorithm to compute
statistics based on parameters provided by paramPWR
.
StatRHLP contains all the statistics associated to a RHLP model. It mainly includes the E-Step of the EM algorithm calculating the posterior distribution of the hidden variables, as well as the calculation of the log-likelhood at each step of the algorithm and the obtained values of model selection criteria..
pi_ik
Matrix of size representing the prior/logistic
probabilities
of
the latent variable
.
z_ik
Hard segmentation logical matrix of dimension
obtained by the Maximum a posteriori (MAP) rule:
,
.
klas
Column matrix of the labels issued from z_ik
. Its elements are
,
.
tau_ik
Matrix of size giving the posterior probability
that the observation
originates from the
-th regression
model.
polynomials
Matrix of size giving the values of the
estimated polynomial regression components.
Ex
Column matrix of dimension m. Ex
is the curve expectation
(estimated signal): sum of the polynomial components weighted by the
logistic probabilities pi_ik
.
loglik
Numeric. Observed-data log-likelihood of the RHLP model.
com_loglik
Numeric. Complete-data log-likelihood of the RHLP model.
stored_loglik
Numeric vector. Stored values of the log-likelihood at each EM iteration.
stored_com_loglik
Numeric vector. Stored values of the Complete log-likelihood at each EM iteration.
BIC
Numeric. Value of BIC (Bayesian Information Criterion).
ICL
Numeric. Value of ICL (Integrated Completed Likelihood).
AIC
Numeric. Value of AIC (Akaike Information Criterion).
log_piik_fik
Matrix of size giving the values of the
logarithm of the joint probability
,
.
log_sum_piik_fik
Column matrix of size m giving the values of
,
.
computeLikelihood(reg_irls)
Method to compute the log-likelihood. reg_irls
is the value of
the regularization part in the IRLS algorithm.
computeStats(paramRHLP)
Method used in the EM algorithm to compute statistics based on
parameters provided by the object paramRHLP
of class
ParamRHLP.
EStep(paramRHLP)
Method used in the EM algorithm to update statistics based on parameters
provided by the object paramRHLP
of class ParamRHLP
(prior and posterior probabilities).
MAP()
MAP calculates values of the fields z_ik
and klas
by applying the Maximum A Posteriori Bayes allocation rule.
This dataset is provided for illustration only; It is issued from the switch railway monitoring domain. The switch mechanism enables trains to be guided from one track to another at a railway junction. During each switch operation, a set of measurements are recorded. Each measurement represents the consumed electrical power. The resulting time series present regime changes.
univrealdataset
univrealdataset
A data frame with 562 rows and 3 columns:
The covariate variables which are the sampling time in this time-series case.
Measurements of the electrical power consumed during time for a first example of switch operations.
Measurements of the electrical power consumed during during time for another example of switch operations.
A simulated non-stationary time series with regime changes. This time series is used for illustration.
univtoydataset
univtoydataset
A data frame with 670 rows and 2 columns:
The covariate variable which is the time in this time-series case.
The time series. The latter has been generated as follows:
First regime: 100 values of standard Normally distributed random numbers.
Second regime: 120 values of Normally distributed random numbers with mean 7 and unit variance.
Third regime: 200 values of Normally distributed random numbers with mean 4 and unit variance.
Fourth regime: 100 values of Normally distributed random numbers with mean -2 and unit variance.
Fifth regime: 150 values of Normally distributed random numbers with mean 3.5 and unit variance.