bclust: Bayesian agglomerative clustering for high dimensional data...

Description Usage Arguments Details Value References See Also Examples

Description

The function clusters data saved in a matrix using an additive linear model with disappearing random effects. The model has built-in spike-and-slab components which quantifies important variables for clustering and can be extracted using the imp function.

Usage

1
2
bclust(x,rep.id=1:nrow(x),effect.family="gaussian",
var.select=TRUE,transformed.par,labels=NULL)

Arguments

x

A numeric matrix, with clustering individuals in rows and variables in columns.

rep.id

A vector consisting of positive integer elements having the same length as the number of rows of x. This vector identifies replicates of a clustering type such that the total number of clustering types is max(rep.id). If nothing is declared the function presupposes that the data are unreplicated, that is each row of x is a clustering type.

effect.family

Distribution family of the disappearing random components. The choices are "gaussian" or "alaplace" allowing Gaussian or asymmetric Laplace family, respectively.

var.select

A logical value, TRUE for fitting models that define spike-and-slab distribution in variable level and allows Bayesian variable selection.

transformed.par

The transformed model parameters in a vector. The length of the vector depends on the chosen model and the availability of variable selection. The log transformation is supposed to be applied for the variance parameters, the identity for the mean, and the logit for the proportions. The function loglikelihood can be used to estimate them from the data.

labels

A vector of strings referring to the labels of clustering types. The length of the vector should match to max(rep.id). The first element corresponds to the label of the type having the smallest integer value in rep.id, the second element refers to the label of the type having the second smallest integer in rep.id, and so on.

Details

The function calls internal C functions depending on the chosen model. The C-stack of the system may overflow if you have a large dataset. You may need to adjust the stack before running R using your operation system command line. If you use Linux, open a console and type >ulimit -s unlimited and then run R in the same console. The Microsoft Windows users don't need to increase the stack size.

We assumed a Bayesian linear model for clustering being

y_{vctr}=m+h_{vct}+d_{v}*g_{vc}*t_{vc}+e_{vctr}

where y_{vctr} is the available data on variable v, cluster c, clustering type t, and replicate r; h_{vct} is the between-type error, t_{vc} is the disappearing random component controlled by the Bernoulli variables d_{v} with success probability q and g_{vc} with success probability p; and e_{vctr} is the between-replicate error. The types inside a cluster share the same t_{vc}, but may arise with a different h_{vct}. For more details see Vahid Partovi Nia and Anthony C. Davison (2012)

Value

data

The data matrix, reordered according to rep.id.

repno

The number of replicates of the values of rep.id

merge

The merge matrix, in hclust object format.

height

A monotone vector referring to the height of the constructed tree.

logposterior

The log posterior for each merge.

clust.number

The number of clusters for each merge.

cut

The value of the height corresponding to the maximum of the log posterior in agglomerative path.

transformed.par

The transformed values of the model parameters. The log transformation is applied for the variance parameters, the identity for the mean, and the logit for the proportions.

labels

The labels associated to each clustering type.

effect.family

The distribution assigned to the disappearing random effect in the function arguments.

var.select

The variable selection chosen in the function arguments.

References

Vahid Partovi Nia and Anthony C. Davison (2012). High-Dimensional Bayesian Clustering with Variable Selection: The R Package bclust. Journal of Statistical Software, 47(5), 1-22. URL http://www.jstatsoft.org/v47/i05/

See Also

loglikelihood, meancss, imp.

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
data(gaelle)

# unreplicated clustering
gaelle.bclust<-bclust(x=gaelle,
transformed.par=c(-1.84,-0.99,1.63,0.08,-0.16,-1.68)) 
par(mfrow=c(2,1))
plot(as.dendrogram(gaelle.bclust))
abline(h=gaelle.bclust$cut)
plot(gaelle.bclust$clust.number,gaelle.bclust$logposterior,
xlab="Number of clusters",ylab="Log posterior",type="b")
abline(h=max(gaelle.bclust$logposterior))

#replicated clustering
gaelle.id<-rep(1:14,c(3,rep(4,13))) 
# first 3 rows replication of ColWT 
# 4 replications for the others

gaelle.lab<-c("ColWT","d172","d263","isa2",
"sex4","dpe2","mex1","sex3","pgm","sex1",
"WsWT","tpt","RLDWT","ke103")

gaelle.bclust<-bclust(gaelle,rep.id=gaelle.id,labels=gaelle.lab,
transformed.par=c(-1.84,-0.99,1.63,0.08,-0.16,-1.68))
plot(as.dendrogram(gaelle.bclust))
abline(h=gaelle.bclust$cut)
plot(gaelle.bclust$clust.number,gaelle.bclust$logposterior,
xlab="Number of clusters",ylab="Log posterior",type="b")
abline(h=max(gaelle.bclust$logposterior))

Example output

2/55
3/55
4/55
5/55
6/55
7/55
8/55
9/55
10/55
11/55
12/55
13/55
14/55
15/55
16/55
17/55
18/55
19/55
20/55
21/55
22/55
23/55
24/55
25/55
26/55
27/55
28/55
29/55
30/55
31/55
32/55
33/55
34/55
35/55
36/55
37/55
38/55
39/55
40/55
41/55
42/55
43/55
44/55
45/55
46/55
47/55
48/55
49/55
50/55
51/55
52/55
53/55
54/55
55/55
2/14
3/14
4/14
5/14
6/14
7/14
8/14
9/14
10/14
11/14
12/14
13/14
14/14

bclust documentation built on May 2, 2019, 3:01 a.m.

Related to bclust in bclust...