Description Usage Arguments Details Value Examples
CASpecClust
returns the covariate-assisted spectral clustering assignments.
This is a function that implements the methods described in Binkiewicz et.al. (2016).
CASpecClust
takes the adjacency matrix A
, covariate matrix X
,
calculates a similarity matrix and peforms spectral clustering.
1 2 | CASpecClust(A, X = NULL, K = 2, n.alpha = 100, center = FALSE,
method = 3, randStarts = 20)
|
A |
an adjacency matrix of the nodes, n by n |
X |
covariate matrix, n by p. Categorical variables should be re-expressed with dummy variables using one-hot encoding, see vignettes for example. |
K |
number of clusters |
n.alpha |
number of alpha values in the valid range to search. Defaults to 100 |
center |
whether to center the covariates X. Defaults to FALSE |
method |
clustering method. See details |
randStarts |
number of random starts in K-means. Defaults to 20 |
The adjacency matrix and covariate matrices are first converted into sparse format to calculate the graph laplacian:
L_τ = D^{−1/2}_τ A D^{−1/2}_τ
spectral clusterging is performed on a n-by-n "similarity matrix", which is defined according to method used:
regularized spectral clustering:
L_τ
assortative covariate-assisted spectral clustering:
L_τ + α XX^t
covariate-assisted spectral clustering:
L_τ L_τ + α XX^t
The nodes are clustered into K
clusters.
A list of three elememts:
alpha: values of tuning parameter in the valid range
WCSS: within-cluster sum of squares corresponding to the alpha values
cluster: the optimal clustering assignments
1 | See vignettes
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.