Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.kde.part

Partition plot for kernel density clustering


Description

Plot of partition for kernel density clustering for 2-dimensional data.

Usage

mvnorm.mixt.part(mus, Sigmas, props=1, xmin, xmax, gridsize, max.iter=100,
   verbose=FALSE)
kms.part(x, H, xmin, xmax, gridsize, verbose=FALSE, ...)

## S3 method for class 'kde.part'
plot(x, display="filled.contour", col, add=FALSE, ...)

Arguments

mus

(stacked) matrix of mean vectors

Sigmas

(stacked) matrix of variance matrices

props

vector of mixing proportions

xmin,xmax

vector of minimum/maximum values for grid

gridsize

vector of number of grid points

max.iter

maximum number of iterations

verbose

flag to print out progress information. Default is FALSE.

x

matrix of data values or an object of class kde.part

H

bandwidth matrix. If missing, Hpi(x,deriv,order=1) is called by default.

display

type of display, "slice" for contour plot, "persp" for perspective plot, "image" for image plot, "filled.contour" for filled contour plot (1st form), "filled.contour2" (2nd form)

col

vector of plotting colours

add

flag to add to current plot. Default is FALSE.

...

other parameters

Details

For 2-d data, kms.part and mvnorm.mixt.part produce a kde.part object whose values are the class labels, rather than probability density values.

Value

A kernel partition is an object of class kde.part which is a list with fields:

x

data points - same as input

eval.points

vector or list of points at which the estimate is evaluated

estimate

density estimate at eval.points

H

bandwidth matrix

gridtype

"linear"

gridded

flag for estimation on a grid

binned

flag for binned estimation

names

variable names

w

vector of weights

cont

vector of probability contour levels

end.points

matrix of final iterates starting from x

label

vector of cluster labels

mode

matrix of cluster modes

nclust

number of clusters

nclust.table

frequency table of cluster labels

tol.iter,tol.clust,min.clust.size

tuning parameter values - same as input

Plot is sent to graphics window.

See Also

Examples

## normal mixture partition
mus <- rbind(c(-1,0), c(1, 2/sqrt(3)), c(1,-2/sqrt(3)))
Sigmas <- 1/25*rbind(invvech(c(9, 63/10, 49/4)), invvech(c(9,0,49/4)), invvech(c(9,0,49/4)))
props <- c(3,3,1)/7
nmixt.part <- mvnorm.mixt.part(mus=mus, Sigmas=Sigmas, props=props)
plot(nmixt.part, asp=1, xlim=c(-3,3), ylim=c(-3,3))

## kernel mean shift partition
if (interactive()) {
set.seed(81928192)
x <- rmvnorm.mixt(n=1000, mus=mus, Sigmas=Sigmas, props=props)
msize <- round(151^2*0.05)
kms.nmixt.part <- kms.part(x=x, min.clust.size=msize)
plot(kms.nmixt.part, asp=1, xlim=c(-3,3), ylim=c(-3,3))}

ks

Kernel Smoothing

v1.12.0
GPL-2 | GPL-3
Authors
Tarn Duong [aut, cre], Matt Wand [ctb], Jose Chacon [ctb], Artur Gramacki [ctb]
Initial release
2021-02-06

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.