EMGr: Function for model-based clustering with the multivariate...

Description Usage Arguments Details Value Author(s) Examples

View source: R/skewed_models_Browne.R

Description

For fitting of a family of 16 mixture models based on mixtures of multivariate skew power exponential distributions with eigen-decomposed covariance structures.

Usage

1
2
3
EMGr(data = NULL, initialization = NULL, iModel = "EIIE", G = 2, max.iter = 500,
epsilon = 0.01, label = NULL, modelSet = "all", skewness = FALSE,
keepResults = FALSE, seedno = 1, scale = TRUE)

Arguments

data

A matrix such that rows correspond to observations and columns correspond to variables.

initialization

0 means a k-means start. A single number indicates number of random starts in addition to a k-means and heirarchical clustering start. A z matrix can be provided directly here as well. Finally, a list can be provided with the same format as modelfit$bestmod$gpar.

iModel

Initialization model used to generate initial parameter estimates.

G

A sequence of integers corresponding to the number of components to be fitted.

max.iter

Maximum number of GEM iterations allowed

epsilon

Threshold for convergence for the GEM algorithm used in the Aitken's stopping criterion.

label

Used for model-based classification aka semi-supervised classification. This is a vector of group labels with 0 for unlabelled observations.

modelSet

A total of 16 models are provided: "EIIE", "VIIE", "EEIE", "VVIE", "EEEE", "EEVE", "VVEE", "VVVE", "EIIV", "VIIV", "EEIV", "VVIV", "EEEV", "EEVV", "VVEV", "VVVV". modelSet="all" fits all models automatically. Otherwise, a character vector of a subset of these models can be provided.

skewness

If FALSE (default), fits mixtures of multivariate power exponential distributions that cannot model skewness. If TRUE, fits mixtures of multivariate skewed power exponential distributions that can model skewness.

keepResults

Keep results from all models

seedno

Seed number for initialization of k-means or random starts.

scale

If TRUE, scales the data before model fitting.

Details

The component scale matrix is decomposed using an eigen-decomposition:
Σ_g = λ_g Γ_g Δ_g Γ'_g
The nomenclature is as follows: a EEVE model denotes a model with equal constants associated with the eigenvalues (λ) for each group, equal orthogonal matrix of eigenvectors (Γ), variable diagonal matrices with values proportional to the eigenvalues of each component scale matrix (Δ_g), and equal shape parameter (β).

Value

allModels

Output for each model run.

bestmod

Output for the best model chosen by the BIC.

loglik

Maximum log likelihood for each model

num.iter

Number of iterations required for convergence for each model

num.par

Number of parameters fit for each model

BIC

BIC for each model

maxBIC

Which model was selected by the BIC in the BIC matrix?

Author(s)

Ryan P. Browne, Utkarsh J. Dang, Michael P. B. Gallaugher, and Paul D. McNicholas

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set.seed(1)
Nobs1 <- 200
Nobs2 <- 250
X1 <- rpe(n = Nobs1, mean = c(0,0), scale = diag(2), beta = 1)
X2 <- rpe(n = Nobs2, mean = c(3,0), scale = diag(2), beta = 2)
x <- as.matrix(rbind(X1, X2))
membership <- c(rep(1, Nobs1), rep(2, Nobs2))
mperun <- EMGr(data=x, initialization=0, iModel="EIIV", G=2:3,
max.iter=500, epsilon=5e-3, label=NULL, modelSet=c("EIIV"),
skewness=FALSE, keepResults=TRUE, seedno=1, scale=FALSE)
print(mperun)
print(table(membership,mperun$bestmod$map))
msperun <- EMGr(data=x, initialization=0, iModel="EIIV", G=2:3,
max.iter=500, epsilon=5e-3, label=NULL, modelSet=c("EIIV"),
skewness=TRUE, keepResults=TRUE, seedno=1, scale=FALSE)
#print(msperun)
#print(table(membership,msperun$bestmod$map))

set.seed(1)
data(iris)
membership <- as.numeric(factor(iris[, "Species"]))
label <- membership
label[sample(x = 1:length(membership),size = ceiling(0.75*length(membership)),replace = FALSE)] <- 0
dat <- data.matrix(iris[, 1:4])
semisup_class_skewed = EMGr(data=dat, initialization=0, iModel="EIIV",
G=3, max.iter=500, epsilon=5e-3, label=label, modelSet=c("VVVE"),
skewness=TRUE, keepResults=TRUE, seedno=1, scale=TRUE)
#table(membership,semisup_class_skewed$bestmod$map)

mixSPE documentation built on Jan. 25, 2021, 9:07 a.m.