phyclust.e.step: One E-Step of phyclust

View source: R/f_phyclust_em_step.r

phyclust.e.stepR Documentation

One E-Step of phyclust

Description

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

Usage

phyclust.e.step(X, ret.phyclust = NULL, K = NULL, Eta = NULL,
    Mu = NULL, pi = NULL, kappa = NULL, Tt = NULL,
    substitution.model = NULL, identifier = NULL, code.type = NULL,
    Z.state = TRUE, 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.

Eta

proportion of subpopulations, \eta_k, length = K, sum to 1.

Mu

centers of subpopulations, dim = K\times L, each row is a center.

pi

equilibrium probabilities, each row sums to 1.

kappa

transition and transversion bias.

Tt

total evolution time, t.

substitution.model

substitution model.

identifier

identifier.

code.type

code type.

Z.state

see ‘Details’.

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 except Z.state. ret.phyclust can be obtain either from an EM iteration of phyclust or from a M step of phyclust.m.step.

Z.state indicates the return values of Z_{nk}. If TRUE, the Z.normalized returned by this function will be posterior probabilities. Otherwise, it will be logPt, log of transition probabilities, \log(\phi(\cdots)).

If label is inputted, the label information will be used the E-step, even the ret.phyclust is the result of unsupervised clustering.

Value

This function returns a Z_{nk} matrix with dimension = N\times K. The values is dependent on Z.state, and they are either posterior probabilities if TRUE or transition probabilities otherwise.

Author(s)

Wei-Chen Chen wccsnow@gmail.com

References

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

See Also

phyclust, phyclust.em.step, phyclust.m.step.

Examples

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

set.seed(1234)
EMC.1 <- .EMC
EMC.1$EM.iter <- 1
# the same as EMC.1 <- .EMControl(EM.iter = 1)
X <- seq.data.toy$org

ret.1 <- phyclust(X, 2, EMC = EMC.1)
ret.2 <- phyclust.e.step(X, ret.phyclust = ret.1)
str(ret.2)

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

## End(Not run)

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