A square symmetric matrix giving either the number of connections between two nodes (for Poisson
objective function) or the weighted connections (between 0 and 1) between each pair of nodes.
clustering
A vector with element per node containing the cluster assignments for each node. If a single cluster
decomposition is desired, an alternative is to set nClusters=1 (see below).
nClusters
If the user wishes to input trivial clustering to calculate a "pure propensity"
decomposition, this variable can be set to 1. Any other non-NULL value is considered invalid;
use clusters to specify a non-trivial clustering.
objectiveFunction
Specifies the objective function for the Cluster and Propensity-based
Approximation. Valid choices are (unique abbreviations of) "Poisson" and "L2norm".
dropUnassigned
Logical: should unassigned nodes be excluded from the clustering? Unassigned nodes
can be present in initial clustering or blocks (if given), and internal pre-partitioning and initial
clustering can also lead to unassigned nodes. If dropUnassigned is TRUE, these nodes are
excluded from the calls to propensityClustering.
Otherwise these nodes will be assigned to the nearest
cluster within each block and be clustered using propensityClustering in each block.
unassignedLabel
Label in input clustering that is reserved for
unassigned objects. For clusterings with numeric lables this is typically (but not always) 0. Note that this
must a valid value - missing value NA will not work.
unassignedMethod
If dropUnassigned is FALSE, this argument sepcifies the method
to assign unassigned objects to the nearest cluster. Valid values are (unique abbreviations) of "average",
"single", and "complete". In analogy with hierarchical clustering, each node will be assigned to the cluster
with which it has the highest average, maximum, and minimum adjacency, respectively.
accelerated
Logical: should an accelerated algorithm be used? In general the accelerated method is
preferable.
parallel
Logical: should parallel calculation be used? At present the parallel calculation is not
fully implemented and the function falls back to standard accelerated calculation, with a warning.
Details
If a single cluster is specified, the approximation is known as "Pure Propensity".
If unassigned nodes are present in the clustering and they are dropped before the CPBA calculation, their
propensities, mean values and tail p-values are returned as NA.
Value
Returns the following list of items.
Propensity
Gives the propensities (or conformities) of each node.
IntermodularAdjacency
Gives the intermodular adjacencies or the conformities between clusters.
Factorizability
Gives the factorizability of the data.
L2Norm or Loglik
The L2 Norm (for L2 norm objective function) or the log-likelihood (for Poisson
objetive function).
ExpectedAdjancency
A distance structure representing the lower triangle of the symmetric matrix of estimated
values of the adjacency matrix using the Propensity and IntermodularAdjacency.
If the Poisson updates are used,
the returned values are the estimate means of the distribution.
EdgePvalues
A distance structure representing the lower triangle of the symmetric matrix of
the tail probabilities under the Poisson distribution.
Author(s)
John Michael Ranola, Peter Langfelder, Steve Horvath, Kenneth Lange
References
Ranola et. al. (2010) A Poisson Model for Random Multigraphs. Bioinformatics 26(16):2004-2001.
Ranola JM, Langfelder P, Lange K, Horvath S (2013) Cluster and propensity based approximation of a network.
BMC Bioinformatics, in press.
See Also
propensityClustering
Examples
nNodes=50
nClusters=5
#We would like to use L2Norm instead of Loglikelihood
objective = "L2norm"
ADJ<-matrix(runif(nNodes*nNodes),ncol=nNodes)
for(i in 1:(length(ADJ[1,])-1)){
for(j in i:length(ADJ[,1])){
ADJ[i,j]=ADJ[j,i]
}
}
for(i in 1:length(ADJ[1,])) ADJ[i,i]=0
Results<-propensityClustering(
adjacency = ADJ,
objectiveFunction = objective,
initialClusters = NULL,
nClusters = nClusters,
fastUpdates = FALSE)
Results2<-CPBADecomposition(adjacency = ADJ, clustering = Results$Clustering,
objectiveFunction = objective)
Results3<-propensityClustering( adjacency = ADJ,
objectiveFunction = objective,
initialClusters = NULL,
nClusters = nClusters,
fastUpdates = TRUE)
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(PropClust)
Loading required package: flashClust
Attaching package: 'flashClust'
The following object is masked from 'package:stats':
hclust
Loading required package: dynamicTreeCut
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PropClust/CPBADecomposition.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CPBADecomposition
> ### Title: Cluster and Propensity-based Approximation decomposition for
> ### adajcency matrixes.
> ### Aliases: CPBADecomposition
> ### Keywords: misc
>
> ### ** Examples
>
>
> nNodes=50
> nClusters=5
> #We would like to use L2Norm instead of Loglikelihood
> objective = "L2norm"
>
> ADJ<-matrix(runif(nNodes*nNodes),ncol=nNodes)
> for(i in 1:(length(ADJ[1,])-1)){
+ for(j in i:length(ADJ[,1])){
+ ADJ[i,j]=ADJ[j,i]
+ }
+ }
>
> for(i in 1:length(ADJ[1,])) ADJ[i,i]=0
>
> Results<-propensityClustering(
+ adjacency = ADJ,
+ objectiveFunction = objective,
+ initialClusters = NULL,
+ nClusters = nClusters,
+ fastUpdates = FALSE)
..determining blocks..
..running propensityClustering in each block with non-trivial clustering..
..running propensityClustering in block 1
CLUSTERS QUICK INITIALIZED
CLUSTER ITERATION
[1] 1
..running final propensity decomposition..
..done (propensityClustering).
>
> Results2<-CPBADecomposition(adjacency = ADJ, clustering = Results$Clustering,
+ objectiveFunction = objective)
>
> Results3<-propensityClustering( adjacency = ADJ,
+ objectiveFunction = objective,
+ initialClusters = NULL,
+ nClusters = nClusters,
+ fastUpdates = TRUE)
..determining blocks..
..running propensityClustering in each block with non-trivial clustering..
..running propensityClustering in block 1
CLUSTERS QUICK1 INITIALIZED
ITERATIONS:
[1] 3
..running final propensity decomposition..
..done (propensityClustering).
>
>
>
>
>
>
> dev.off()
null device
1
>