Package 'CHMM'

Title: Coupled Hidden Markov Models
Description: An exact and a variational inference for coupled Hidden Markov Models applied to the joint detection of copy number variations.
Authors: Xiaoqiang Wang [aut], Julie Aubert [aut, cre]
Maintainer: Julie Aubert <[email protected]>
License: GPL-2
Version: 0.1.1
Built: 2024-11-10 04:29:07 UTC
Source: https://github.com/julieaubert/chmm

Help Index


Perform exact inference of coupled hidden markov models.

Description

Perform exact inference of coupled hidden markov models.

Usage

CHMM_EM(X, nb.states, S, omega, meth.init = "mclust", var.equal = TRUE,
  itmax = 500, threshold = 1e-07)

Arguments

X

a data matrix of observations. Columns correspond to individuals.

nb.states

a integer specifying the numbers of states.

S

a matrix of similarity between individuals.

omega

a value of omega.

meth.init

a string specifying the initialization method ("mclust" or "kmeans"). The default method is "mclust".

var.equal

a logical variable indicating whether to treat the variances as being equal.

itmax

an integer specifying the maximal number of iterations for the EM algorithm.

threshold

a value for the threshold used for the stopping criteria.

Value

a list of 10 components

postPr

a list containing for each series the posterior probabilities.

initGb

a numeric specifying the initial state probabilities.

transGb

a matrix of the state transition probabilities.

emisGb

a list containing for each series the emission probabilities.

esAvg

a numeric of the estimated mean for each state.

esVar

a numeric of the estimated variance for each state.

ID.K

a matrix containing all combination of possible state for nbI series.

loglik

a numeric with the value of the loglikelihood.

RSS

a numeric corresponding to the Residuals Sum of Squares.

iterstop

an integer corresponding to the total number of iterations.

References

Wang, X., Lebarbier, E., Aubert, J. and Robin, S., Variational inference for coupled Hidden Markov Models applied to the joint detection of copy number variations.


Perform variational inference of coupled Hidden Markov Models.

Description

Perform variational inference of coupled Hidden Markov Models.

Usage

CHMM_VEM(X, nb.states, S = NULL, omega = 0.7, meth.init = "mclust",
  var.equal = TRUE, itmax = 500, threshold = 1e-07)

Arguments

X

a data matrix of observations. Columns correspond to individuals.

nb.states

a integer specifying the numbers of states.

S

a matrix of similarity between individuals.

omega

a value of omega.

meth.init

a string specifying the initialization method ("mclust" or "kmeans"). The default method is "mclust".

var.equal

a logical variable indicating whether to treat the variances as being equal.

itmax

an integer specifying the maximal number of iterations for the EM algorithm.

threshold

a value for the threshold used for the stopping criteria.

Value

a list of 9 components

postPr

a list containing for each series the posterior probabilities.

initPr

a numeric specifying the initial state probabilities.

transPr

a matrix of the state transition probabilities.

esAvg

a numeric of the estimated mean for each state.

esVar

a numeric of the estimated variance for each state.

emisPr

a list containing for each series the emission probabilities.

emisPrW

a list containing for each series the emission probabilities taking into account for the dependency structure.

RSS

a numeric corresponding to the Residuals Sum of Squares.

iterstop

an integer corresponding to the total number of iterations.

References

Wang, X., Lebarbier, E., Aubert, J. and Robin, S., Variational inference for coupled Hidden Markov Models applied to the joint detection of copy number variations.


Summarize the results of the coupled HMM.

Description

Summarize the results of the coupled HMM.

Usage

clusterseg(x)

Arguments

x

a matrix of status. Columns corresponds to series (individuals).

Value

a data.frame with 4 columns

sample

name of the sample (series).

posbegin

beginning position.

posend

ending position.

status

status.


Perform inference of coupled hidden markov models.

Description

Perform inference of coupled hidden markov models.

Usage

coupledHMM(X, nb.states = 3, S = NULL, omega.list = c(0.3, 0.7, 0.9),
  var.equal = TRUE, exact = FALSE, meth.init = "mclust", viterbi = TRUE,
  itmax = 500, threshold = 1e-07)

Arguments

X

a matrix of observations. Columns correspond to series (individuals).

nb.states

a integer specifying the numbers of states.

S

a matrix of similarity between individuals.

omega.list

a vector of omega values.

var.equal

a logical variable indicating whether to treat the variances as being equal (var.equal = TRUE).

exact

a logical variable indicating whether to use VEM (exact = FALSE) or EM (exact = TRUE) algorithm for the inference of the model.

meth.init

a string specifying the initialization method ("mclust" or "kmeans") for the (V)-EM algorithm. The default method is "mclust".

viterbi

a logical variable indicating whether to use Maximum A Posteriori method (FALSE) or Viterbi algorithm (TRUE, by default) for recovering the most likely path.

itmax

an integer specifying the maximal number of iterations for the CHMM_(V)EM algorithm.

threshold

a value for the threshold used for the stopping criteria for the CHMM_(V)EM algorithm.

Value

A list of 4 objets.

omega

an integer corresponding to the selected value among the omega.list.

model

a list corresponding to the output of the CHMM-EM or CHMM-VEM function for the selected model.

status

a matrix with status associated to each series in column and each position in row.

RSS.omega

a dataframe with omega values and the associated Residuals Sum of Squares.

References

Wang, X., Lebarbier, E., Aubert, J. and Robin, S., Variational inference for coupled Hidden Markov Models applied to the joint detection of copy number variations.

See Also

CHMM_VEM, CHMM_EM

Examples

data(toyexample)
# Variational inference of a coupled hidden Markov Chains
resCHMM <- coupledHMM(X = toydata, nb.states = 3, S = cor(toystatus),
                      omega.list = c(0.3, 0.5, 0.7, 0.9))
# Breakpoints positions and status of segments
info <- clusterseg(resCHMM$status)
# head(info)

Initialization step of the CHMM_EM function.

Description

Initialization step of the CHMM_EM function.

Usage

init.EM(X, nb.states, meth.init, var.equal, nbI, nbT)

Arguments

X

a matrix of observations. Columns correspond to series (individuals).

nb.states

an integer specifying the numbers of states.

meth.init

a string specifying the initialization method ("mclust" or "kmeans"). The default method is "mclust".

var.equal

a logical variable indicating whether to treat the variances as being equal (TRUE, value by default) or not (FALSE).

nbI

an integer specifying the number of series.

nbT

an integer specifying the length of one series.

Details

By default, an initialization with the meth.init="mclust" is performed with homogeneous variances.

Value

A list of 6 objects.

esAvgGb

a matrix of nbK(nb.states^nbI) rows and nbI columns of estimated mean.

esVarGb

a matrix of nbK(nb.states^nbI) rows and nbI columns of estimated variance.

esAvg

a numeric of the estimated mean for each state.

esVar

a numeric of the estimated variance for each state.

transGb

a matrix of the state transition probabilities.

initGb

a numeric specifying the initial state probabilities.

See Also

CHMM_EM


Initialization step of the CHMM_VEM function.

Description

Initialization step of the CHMM_VEM function.

Usage

init.VEM(X, nb.states, meth.init, var.equal, nbI, nbT)

Arguments

X

a matrix of observations. Columns correspond to series (individuals).

nb.states

an integer specifying the numbers of states.

meth.init

a string specifying the initialization method ("mclust" or "kmeans"). The default method is "mclust".

var.equal

a logical variable indicating whether to treat the variances as being equal (TRUE, value by default) or not (FALSE).

nbI

an integer specifying the number of series.

nbT

an integer specifying the length of one series.

Value

A list containing the parameters of the model

esAvg

a numeric of the estimated mean for each state.

esVar

a numeric of the estimated variance for each state.

transPr

a matrix of the state transition probabilities

postPr

a list containing for each series the posterior probabilities.

initPr

a numeric specifying the initial state probabilities

.


Toy example - observations for 5 correlated samples.

Description

A matrix containing the observations for the 1,000 positions of 5 correlated samples.

Format

A simulated matrix with 1000 rows and 5 columns. Each column is a series

Examples

data(toyexample)
# Variational inference of a coupled hidden Markov Chains
resCHMM <- coupledHMM(X = toydata, nb.states = 3, S = cor(toystatus),
                      omega.list = c(0.3, 0.5, 0.7, 0.9))
# Breakpoints positions and status of segments
info <- clusterseg(resCHMM$status)
# head(info)

Toy example - status for 5 correlated samples.

Description

A matrix containing the hidden status for the 1,000 positions of 5 correlated samples.

Format

A matrix of the hidden status corresponding to the toydata matrix.