initialize_model function

initialize the hhsmmspec model for a specified emission distribution

initialize the hhsmmspec model for a specified emission distribution

Initialize the hhsmmspec model by using an initial clustering obtained by initial_cluster and the emission distribution characterized by mstep and dens.emission

initialize_model( clus, mstep = NULL, dens.emission = dmixmvnorm, sojourn = NULL, semi = NULL, M, verbose = FALSE, ... )

Arguments

  • clus: initial clustering obtained by initial_cluster

  • mstep: the mstep function of the EM algorithm with an style simillar to that of mixmvnorm_mstep. If NULL, the mixmvnorm_mstep is considered for the complete data set and miss_mixmvnorm_mstep is considered for the data with missing values (NA or NaN)

  • dens.emission: the density of the emission distribution with an style simillar to that of dmixmvnorm

  • sojourn: one of the following cases:

    • "nonparametric" non-parametric sojourn distribution
    • "nbinom" negative binomial sojourn distribution
    • "logarithmic" logarithmic sojourn distribution
    • "poisson" poisson sojourn distribution
    • "gamma" gamma sojourn distribution
    • "weibull" weibull sojourn distribution
    • "lnorm" log-normal sojourn distribution
    • "auto" automatic determination of the sojourn distribution using the chi-square test
  • semi: logical and of one of the following forms:

    • a logical value: if TRUE all states are considered as semi-Markovian else Markovian
    • a logical vector of length nstate: the TRUE associated states are considered as semi-Markovian and FALSE associated states are considered as Markovian
    • NULL if ltr=TRUE then semi = c(rep(TRUE,nstate-1),FALSE), else semi = rep(TRUE,nstate)
  • M: maximum number of waiting times in each state

  • verbose: logical. if TRUE the outputs will be printed the normal distributions will be estimated

  • ...: additional parameters of the mstep function

Returns

a hhsmmspec model containing the following items:

  • init initial probabilities of states
  • transition transition matrix
  • parms.emission parameters of the mixture normal emission (mu, sigma, mix.p)
  • sojourn list of sojourn time distribution parameters and its type
  • dens.emission the emission probability density function
  • mstep the M step function of the EM algorithm
  • semi a logical vector of length nstate with the TRUE associated states are considered as semi-Markovian

Examples

J <- 3 initial <- c(1, 0, 0) semi <- c(FALSE, TRUE, FALSE) P <- matrix(c(0.8, 0.1, 0.1, 0.5, 0, 0.5, 0.1, 0.2, 0.7), nrow = J, byrow = TRUE) par <- list(mu = list(list(7, 8), list(10, 9, 11), list(12, 14)), sigma = list(list(3.8, 4.9), list(4.3, 4.2, 5.4), list(4.5, 6.1)), mix.p = list(c(0.3, 0.7), c(0.2, 0.3, 0.5), c(0.5, 0.5))) sojourn <- list(shape = c(0, 3, 0), scale = c(0, 10, 0), type = "gamma") model <- hhsmmspec(init = initial, transition = P, parms.emis = par, dens.emis = dmixmvnorm, sojourn = sojourn, semi = semi) train <- simulate(model, nsim = c(10, 8, 8, 18), seed = 1234, remission = rmixmvnorm) clus = initial_cluster(train, nstate = 3, nmix = c(2 ,2, 2),ltr = FALSE, final.absorb = FALSE, verbose = TRUE) initmodel = initialize_model(clus = clus, sojourn = "gamma", M = max(train$N))

Author(s)

Morteza Amini, morteza.amini@ut.ac.ir , Afarin Bayat, aftbayat@gmail.com

  • Maintainer: Morteza Amini
  • License: GPL-3
  • Last published: 2024-09-04

Useful links