EMnormal | R Documentation |
‘EMnormal’ is used to estimate the parameters of a univariate or multivariate
normal mixture model using the expectation-maximization (EM) algorithm.
The result can be used as the initial value for the mixLogconc
and
mixLogconcHD
function.
EMnormal(x, C = 2, nstart = 20, tol = 1e-05)
x |
an n by p data matrix where n is the number of observations and p is the dimension of the data. |
C |
number of mixture components. Default is 2. |
nstart |
number of initializations to try. Default is 20. |
tol |
stopping criteria (threshold value) for the EM algorithm. Default is 1e-05. |
A list containing the following elements:
loglik |
final log-likelihood. |
pi |
estimated mixing proportions. |
mu |
estimated component means. |
sigma |
estimated component standard deviation or covariance matrix. |
mixLogconc
, mixLogconcHD
#-----------------------------------------------------------------------------------------#
# Univariate Case
#-----------------------------------------------------------------------------------------#
x = matrix(rnorm(100, 2, sqrt(2)), nrow = 100)
x[1:60] = x[1:60] + 5
ini = EMnormal(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.