Last data update: 2014.03.03

R: Plot soft clusters from Modal Clustering output
soft.hmacR Documentation

Plot soft clusters from Modal Clustering output

Description

Plot clusters for two dimensional data with colors representing the posterior probability of belonging to clusters. Additionally boundary points between the clusters, with specified thresholds are also

Usage

soft.hmac(hmacobj,n.cluster=NULL,level=NULL,boundlevel=0.4,plot=TRUE)

Arguments

hmacobj

The output of HMAC analysis. An object of class 'hmac'.

level

The specified level of HMAC output

n.cluster

The specified number of clusters. If neither level nor n.cluster is specified, soft clustering output is shown for each level.

boundlevel

Posterior probability threshold. Points having posterior probability below boundlevel are assigned as boundary points and colored in gray. Default value is 0.4.

plot

Get the two dimensional plot of the clusters with different colors. Default value is TRUE, which returns the two dimensional plot on the current graphics device; plot=FALSE returns the posterior probability of each observation.

Value

Returns the list that contains the posterior probability of each observation and boundary points at specified level if plot=FALSE

Author(s)

Surajit Ray and Yansong Cheng

References

Li. J, Ray. S, Lindsay. B. G, "A nonparametric statistical approach to clustering via mode identification," Journal of Machine Learning Research , 8(8):1687-1723, 2007.

Lindsay, B.G., Markatou M., Ray, S., Yang, K., Chen, S.C. "Quadratic distances on probabilities: the foundations," The Annals of Statistics Vol. 36, No. 2, page 983–1006, 2008.

See Also

phmac for front end of using modal clustering and also for parallel implementation of modal clustering hard.hmac for hard clustering at specified levels.

Examples

data(logcta20.hmac)
#logcta20.hmac is the output of phmac(logcta20,npart=1)

soft.hmac(logcta20.hmac,n.cluster=3)

#return the posterior probability of each observation and boundary points.
postprob=soft.hmac(hmacobj=logcta20.hmac,n.cluster=3,plot=FALSE) 

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Modalclust)
Loading required package: mvtnorm
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: class
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Modalclust/soft.HMAC.Rd_%03d_medium.png", width=480, height=480)
> ### Name: soft.hmac
> ### Title: Plot soft clusters from Modal Clustering output
> ### Aliases: soft.hmac
> ### Keywords: cluster, hierarchical, nested, modal
> 
> ### ** Examples
> 
> data(logcta20.hmac)
> #logcta20.hmac is the output of phmac(logcta20,npart=1)
> 
> soft.hmac(logcta20.hmac,n.cluster=3)
The level at which there are 3 clusters is 4 
> 
> #return the posterior probability of each observation and boundary points.
> postprob=soft.hmac(hmacobj=logcta20.hmac,n.cluster=3,plot=FALSE) 
The level at which there are 3 clusters is 4 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>