em_clust_norm: Mixture modeling of normally distributed univariate data.

View source: R/clust_norm.R

em_clust_normR Documentation

Mixture modeling of normally distributed univariate data.

Description

This function uses the EM algorithm to do clustering of k-mixture components where each component is one-dimensional N(\mu, \sigma^2).

Usage

em_clust_norm(data, nclust, itmax = 10000, tol = 10^-8)

Arguments

data

An n-length vector. Must not be character.

nclust

The number of clusters.

itmax

The maximum number of iterations allowed. Defaults to 10000.

tol

Tuning parameter for convergence. Defaults to 10^-8.

Value

A list containing: it the number of iterations; clust_prop the estimated mixture proportions; clust_params the estimated mixture parameters; mix_est a vector of the estimated mixture for each data point; log_lik the log likelihood of the data; bic the modeled BIC.

See Also

em_clust_mvn, em_clust_mvn_miss, gen_clust

Examples

# generate test data
c1 <- rnorm(100, 5, 1); c2 <- rnorm(100, 15, 1); c3 <- rnorm(100, 20, 1)
c_tot <- c(c1, c2, c3); rm(c1,c2,c3)
# run example
norm_ex <- em_clust_norm(c_tot, nclust= 3) 

alexWhitworth/emclustr documentation built on June 12, 2024, 10:13 p.m.