Learn R Programming

ManlyMix (version 0.1.3)

Manly.contour: Contour plot for Manly mixture model

Description

Provides a contour plot for the fitted data with Manly mixture model.

Usage

Manly.contour(X, var1 = 1, var2 = 2, model = NULL, x.slice = 100, y.slice = 100, x.mar = 1, y.mar = 1, col = "lightgrey", ...)

Arguments

X
dataset matrix (n x p)
var1
x-axis variable
var2
y-axis variable
model
fitted Manly mixture model
x.slice
number of slices in the first variable sequence in the contour
y.slice
number of slices in the second variable sequence in the contour
x.mar
value to be subtracted/added to the smallest/largest observation in the x-axis
y.mar
value to be subtracted/added to the smallest/largest observation in the y-axis
col
color of the contour lines
...
further arguments related to contour

Details

Provides the contour plot for the fitted data by Manly mixture model. This plot is designed for two-dimensional data.

See Also

Manly.EM

Examples

Run this code

set.seed(123)

K <- 2; p <- 2
X <- as.matrix(faithful)

# Obtain initial memberships based on the K-means algorithm
id.km <- kmeans(X, K)$cluster

# Run the EM algorithm for a Manly mixture model based on K-means solution
la <- matrix(0.1, K, p)
B <- Manly.EM(X, id.km, la)

Manly.contour(X, model = B, x.mar = 1, y.mar = 2,
xaxs="i", yaxs="i", xaxt="n", yaxt="n", xlab="", 
ylab = "", nlevels = 10, drawlabels = FALSE, 
lwd = 3.2, col = "lightgrey", pch = 19)

Run the code above in your browser using DataLab