R/printnormal.R

Defines functions printnormal

## print normal mixture

printnormal <- function(x, digits) {
	ncomp <- length(x$pi)
	name <- paste("comp", 1:ncomp, sep = "")
	res1 <- matrix(0, nrow = 3, ncol = ncomp)
	rownames(res1) <- c("pi", "mu", "sd")
	colnames(res1) <- name
	res1[1, ] <- x$pi
	res1[2, ] <- x$mu
	res1[3, ] <- x$sd
	res2 <- c(x$iter, x$aic, x$bic)
	names(res2) <- c("EM iteration", "AIC", "BIC")
	cat(paste("Normal mixture model with", ncomp, "components\n"))
	print(round(res1, digits))
	cat("\n")
	cat(paste(c("EM iterations:", x$iter, "AIC:", round(x$aic, 2), 
	"BIC:", round(x$bic, 2), "log-likelihood:", round(x$loglik, 2))))
	cat('\n')
}

Try the mixR package in your browser

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

mixR documentation built on June 1, 2021, 5:07 p.m.