phyclust.m.step: One M-Step of phyclust

View source: R/f_phyclust_em_step.r

phyclust.m.stepR Documentation

One M-Step of phyclust

Description

This is a single M-step of phyclust, usually following or followed by the other E-step.

Usage

phyclust.m.step(X, ret.phyclust = NULL, K = NULL,
    pi = NULL, kappa = NULL, Tt = NULL, Z.normalized = NULL,
    substitution.model = NULL, identifier = NULL, code.type = NULL,
    label = NULL)

Arguments

X

nid/sid matrix with N rows/sequences and L columns/sites.

ret.phyclust

an object with the class phyclust.

K

number of clusters.

pi

equilibrium probabilities, each row sums to 1.

kappa

transition and transversion bias.

Tt

total evolution time, t.

Z.normalized

posterior probabilities obtained from an E-step.

substitution.model

substitution model.

identifier

identifier.

code.type

code type.

label

label of sequences for semi-supervised clustering.

Details

X should be a numerical matrix containing sequence data that can be transfered by code2nid or code2sid.

Either input ret.phyclust or all other arguments for this function. ret.phyclust can be obtained either from an EM iteration of phyclust or from a E step of phyclust.e.step.

If label is inputted, the label information will be used the M-step and Z.normalized will be replaced, even the ret.phyclust is the result of unsupervised clustering.

Value

This function returns an object with class phyclust.

Author(s)

Wei-Chen Chen wccsnow@gmail.com

References

Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/

See Also

phyclust, phyclust.em.step, phyclust.e.step.

Examples

## Not run: 
library(phyclust, quiet = TRUE)

set.seed(1234)
EMC.1 <- .EMC
EMC.1$short.iter <- 1
EMC.1$EM.iter <- 1

# Test with phyclust.
X <- seq.data.toy$org
ret.1 <- phyclust(X, 2, EMC = EMC.1)

# Test with an em step.
ret.em <- phyclust.em.step(X, ret.1)

# Test with an E- and M-step.
ret.1$Z.normalized <- phyclust.e.step(X, ret.phyclust = ret.1)
ret.m <- phyclust.m.step(X, ret.phyclust = ret.1)

# Test with 2 em steps.
set.seed(1234)
EMC.2 <- EMC.1
EMC.2$EM.iter <- 2
ret.2 <- phyclust(X, 2, EMC = EMC.2)

# Check logL.
phyclust.logL(X, ret.1)
phyclust.logL(X, ret.em)
phyclust.logL(X, ret.m)
phyclust.logL(X, ret.2)

# For semi-supervised.
semi.label <- rep(0, nrow(X))
semi.label[1:3] <- 1
ret.m.1 <- phyclust.m.step(X, ret.phyclust = ret.1, label = semi.label)

## End(Not run)

snoweye/phyclust documentation built on Sept. 12, 2023, 5 a.m.