Home   >   User Resources   >   Online Help   >   apaNormalMixture.Estimate
 

 

Function index Version 3.0.0

apaNormalMixture.Estimate(DataMatrix, numComponents, nMultiStarts, Seed)

Excel=apaNormalMixture.Estimate(DataMatrix, numComponents, nMultiStarts, Seed)

Result

Estimates a multivariate Gaussian mixture model with the multi-start EM algorithm and returns the component parameters and the per-sample responsibilities. The function is non-volatile.

Syntax

DataMatrix: r x c matrix of data, each column containing a series

numComponents: number of mixture components

nMultiStarts: optional; number of multi-starts. Default value: 1 (also used if omitted or below 1)

Seed: optional; seed of the random number generator. Default value: 1 (also used if omitted or 0)

Algorithm

Inputs are validated: non-empty DataMatrix, 1 ≤ numComponents ≤ r.

Each start draws the initial component centres by k-means++ seeding: the first centre is a randomly chosen observation, and each further centre is an observation drawn with probability proportional to its squared distance to the nearest centre already chosen. Each observation is assigned to its nearest centre, and the initial weights, means and covariances are those of the resulting clusters; clusters with fewer than c + 1 members start with the sample covariance.

The EM algorithm then alternates the computation of the responsibilities with the responsibility-weighted update of weights, means and covariances until the change of the log-likelihood falls below 1E-7. A floor of 1E-6 times the average population variance (denominator n) of the series is added to the diagonal of each component covariance matrix, so the results do not depend on the scale of the data.

A component is re-seeded, with its mean at a randomly drawn observation and the population covariance matrix (denominator n) of all observations, when its effective number of observations falls below max(1, 0.001·r) or when one of its variances falls below 1E-4 times the population variance (denominator n) of that series, i.e. when it collapses onto repeated values such as zero returns from stale prices. At most 10·numComponents re-seeds are made per start. Starts that end with such a degenerate component are only returned if no start avoids one; otherwise the start with the highest log-likelihood is returned.

AIC and BIC count numComponents·c means, numComponents·c(c+1)/2 covariance parameters and numComponents − 1 weights.

Remarks

Covariances are maximum-likelihood (EM) estimates: probability-weighted, population-type, no small-sample correction.