R/multmixinit.R

Defines functions multmix.init

Documented in multmix.init

multmix.init <- function(y, lambda = NULL, theta = NULL, k = 2){

n <- nrow(y)
p <- ncol(y)

    if (is.null(theta)) {
        theta = matrix(runif(p * k), k, p)
        theta = theta/apply(theta, 1, sum)
    }
    else k = nrow(theta)
    if (is.null(lambda)) {
        lambda = runif(k)
        lambda = lambda/sum(lambda)
    } else k = length(lambda)

list(lambda=lambda, theta=theta, k=k)


}

Try the mixtools package in your browser

Any scripts or data that you put into this service are public.

mixtools documentation built on Dec. 5, 2022, 5:23 p.m.