phyclust.se.update {phyclust} | R Documentation

## Update phyclust Results by the Sequencing Error Model

### Description

Since `phyclust.se` is difficult to optimize on a constrained high dimension parameter space, the `phyclust` is relatively easier to find a better result, as well as the `find.best` function.

This function will use the `phyclust` result as initial parameters and perform a sequencing error model. All parameters (Eta, Mu, Q, ...) in this function will be updated through the EM algorithm as `phyclust.se`.

Typically, this function run on the `find.best` results will yield a better result than on the `phyclust.se`.

### Usage

    phyclust.se.update(X, EMC = .EMC, ret.phyclust = NULL,
        K = NULL, Eta = NULL, Mu = NULL, pi = NULL, kappa = NULL,
        Tt = NULL, byrow = TRUE)

### Arguments

`X` | nid/sid matrix with N rows/sequences and L columns/sites.
`EMC` | EM control.
`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*L, each row is a center.
`pi` | equilibrium probabilities, each row sums to 1.
`kappa` | transition and transversion bias.
`Tt` | total evolution time, t.
`byrow` | advanced option for `X`, default = TRUE.

### Details

All the input arguments are the same as the inputs of the function `phyclust.em.step` and `phyclust.update`.

### 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.se`, `phyclust.update`, `phyclust`, `find.best`.

### Examples

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

    set.seed(1234)
    X <- seq.data.toy$org

    (ret.1 <- find.best(X, 4))
    (ret.2 <- phyclust.se.update(X, ret.phyclust = ret.1))
    .EMC$se.constant <- 1e-3
    (ret.3 <- phyclust.se.update(X, ret.phyclust = ret.2))

    ### Search optimal error
    func <- function(C){
      .EMC$se.constant <<- C
      -phyclust.se.update(X, ret.phyclust = ret.1)$logL
    }
    (ret.opt <- optimize(f = func, lower = 1e-3, upper = 1e-1))
    .EMC$se.constant <- ret.opt$minimum
    (ret.se.opt <- phyclust.se.update(X, ret.phyclust = ret.1))

    ## End(Not run)

[Package phyclust version 0.1-25 Index]