march.dcmm.construct: Construct a double chain Markov model (DCMM).

Description Usage Arguments Value Author(s) See Also Examples

View source: R/march.dcmm.R

Description

Construct a march.Dcmm-class object, with visible order orderVC, hidden order orderHC and M hidden states, according to a march.Dataset-class. The first maxOrder-orderVC elements of each sequence are truncated in order to return a model which can be compared with other Markovian model of visible order maxOrder. The construction is performed either by an evolutionary algorithm (EA) or by improving an existing DCMM. The EA performs gen generations on a population of popSize individuals. The EA behaves as a Lamarckian evolutionary algorithm, using a Baum-Welch algorithm as optimization step, running until log-likelihood improvement is less than stopBw or for iterBw iterations. Finally only the best individual from the population is returned as solution. If a seedModel is provided, the only step executed is the optimization step, parameters related to the EA do not apply in this case.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
march.dcmm.construct(
  y,
  orderHC,
  orderVC,
  M = 2,
  gen = 5,
  popSize = 4,
  maxOrder = orderVC,
  seedModel = NULL,
  iterBw = 2,
  stopBw = 0.1,
  Amodel = "mtd",
  Cmodel = "mtd",
  AMCovar = 0,
  CMCovar = 0,
  AConst = FALSE,
  pMut = 0.05,
  pCross = 0.5
)

Arguments

y

the dataset from which the Dcmm will be constructed march.Dataset-class.

orderHC

the order of the hidden chain of the constructed Dcmm.

orderVC

the order of the visible chain of the constructed Dcmm (0 for a HMM).

M

the number of hidden states of the Dcmm.

gen

the number of generations performed by the EA.

popSize

the number of individuals stored into the population.

maxOrder

the maximum visible order among the set of Markovian models to compare.

seedModel

a model to optimize using Baum-Welch algorithm.

iterBw

the number of iterations performed by the Baum-Welch algorithm.

stopBw

the minimum increase in quality (log-likelihood) authorized in the Baum-Welch algorithm.

Amodel

the modeling of the hidden transition matrix (mtd, mtdg or complete)

Cmodel

the modeling of the visible transition matrix (mtd, mtdg or complete)

AMCovar

vector of the size Ncov indicating which covariables are used into the hidden process (0: no, 1:yes)

CMCovar

vector of the size Ncov indicating which covariables are used into the visible process (0: no, 1:yes)

AConst

logical, indicating whether or not the hidden transition matrix has the identity (diagonal) constraint

pMut

mutation probability for the evolutionary algorithm

pCross

crossover probability for the evolutionary algorithm

Value

the best march.Dcmm-class constructed by the EA or the result of the Baum-Welch algorithm on seedModel.

Author(s)

Emery Kevin

See Also

march.Dcmm-class, march.Model-class, march.Dataset-class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Construct a 2 hidden states DCMM for the pewee data
# with hidden order set to 2 and visible order set to 1.
# The estimation procedure uses both the evolutionary algorithm (population size 2, 
# one generation) and the Bauw-Welch algorithm (one iteration).
## Not run: march.dcmm.construct(y=pewee,orderHC=2,
                              orderVC=1,M=2,popSize=2,gen=1,iterBw=1,stopBw=0.0001)
 
# Same as above, but the DCMM is replaced by a HMM (the visible order OrderVC is set to zero).
HMM<-march.dcmm.construct(y=pewee,orderHC=2,orderVC=0,M=2,popSize=2,gen=1,iterBw=1,stopBw=0.0001)  

# A first model is computed using both EA and Baum-Welch algorithms.
# The previous model is improved through two rounds of Baum-Welch optimization.
models <- list()
models[[length(models)+1]] <- HMM
models[[length(models)+1]] <- march.dcmm.construct(y=pewee,seedModel=models[[1]],
                                                   orderVC=0,iterBw=10,stopBw=0.001)
models[[length(models)+1]] <- march.dcmm.construct(y=pewee,seedModel=models[[2]],
                                                   orderVC=0,iterBw=10,stopBw=0.0001)
# Show performance indicators (ll, number of independent parameters,
# BIC and AIC) for all computed models.
#r <- do.call(rbind,lapply(models,march.summary))
#print(r)

# Construct a three hidden states, first-order HMM (hence OrderVC=0) for the sleep data.
# By setting gen=1 and popSize=1, the estimation procedure uses only the Baum-Welch algorithm.
HMM <- march.dcmm.construct(pewee,orderHC=1,orderVC=0,M=2,gen=1,popSize=1,iterBw=10,stopBw=0.0001)
## End(Not run)

march documentation built on Jan. 13, 2021, 10:50 p.m.