emMixRHLP function

emMixRHLP implements the EM algorithm to fit a mixture of RHLP models.

emMixRHLP implements the EM algorithm to fit a mixture of RHLP models.

emMixRHLP implements the maximum-likelihood parameter estimation of a mixture of RHLP models by the Expectation-Maximization (EM) algorithm.

emMixRHLP(X, Y, K, R, p = 3, q = 1, variance_type = c("heteroskedastic", "homoskedastic"), init_kmeans = TRUE, n_tries = 1, max_iter = 1000, threshold = 1e-05, verbose = FALSE, verbose_IRLS = FALSE)

Arguments

  • X: Numeric vector of length m representing the covariates/inputs x1,,xmx_{1},\dots,x_{m}.

  • Y: Matrix of size (n,m)(n, m) representing the observed responses/outputs. Y consists of n functions of X observed at points 1,,m1,\dots,m.

  • K: The number of clusters (Number of RHLP models).

  • R: The number of regimes (RHLP components) for each cluster.

  • p: Optional. The order of the polynomial regression. By default, p is set at 3.

  • 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".

  • init_kmeans: Optional. A logical indicating whether or not the curve partition should be initialized by the K-means algorithm. Otherwise the curve partition is initialized randomly.

  • n_tries: Optional. Number of runs of the EM algorithm. The solution providing the highest log-likelihood will be returned.

    If n_tries > 1, then for the first run, parameters are initialized by uniformly segmenting the data into R segments, and for the next runs, parameters are initialized by randomly segmenting the data into R contiguous segments.

  • 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.

Returns

EM returns an object of class ModelMixRHLP .

Details

emMixRHLP function implements the EM algorithm. This function starts with an initialization of the parameters done by the method initParam of the class ParamMixRHLP , then it alternates between the E-Step (method of the class StatMixRHLP ) and the M-Step (method of the class ParamMixRHLP ) until convergence (until the relative variation of log-likelihood between two steps of the EM algorithm is less than the threshold parameter).

Examples

data(toydataset) # Let's fit a mixRHLP model on a dataset containing 2 clusters: data <- toydataset[1:190,1:21] x <- data$x Y <- t(data[,2:ncol(data)]) mixrhlp <- emMixRHLP(X = x, Y = Y, K = 2, R = 2, p = 1, verbose = TRUE) mixrhlp$summary() mixrhlp$plot()

See Also

ModelMixRHLP , ParamMixRHLP , StatMixRHLP

  • Maintainer: Florian Lecocq
  • License: GPL (>= 3)
  • Last published: 2019-08-06