% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/method_cluster.R
\name{method_cluster}
\alias{method_cluster}
\alias{cluster_hierarchical}
\alias{cluster_cosine}
\alias{cluster_concor}
\title{Methods for equivalence clustering}
\usage{
cluster_hierarchical(motif, distance)

cluster_cosine(motif, distance)

cluster_concor(.data, motif)
}
\arguments{
\item{motif}{A matrix returned by a \verb{node_x_*()} function.}

\item{distance}{Character string indicating which distance metric
to pass on to \code{stats::dist}.
By default \code{"euclidean"}, but other options include
\code{"maximum"}, \code{"manhattan"}, \code{"canberra"}, \code{"binary"}, and \code{"minkowski"}.
Fewer, identifiable letters, e.g. \code{"e"} for Euclidean, is sufficient.}

\item{.data}{A network object of class \code{mnet}, \code{igraph}, \code{tbl_graph}, \code{network}, or similar.
For more information on the standard coercion possible,
see \code{\link[manynet:as_tidygraph]{manynet::as_tidygraph()}}.}
}
\value{
A hierarchical clustering object created by \code{stats::hclust()},
with an additional \code{distances} attribute containing the distance matrix
used for clustering.
}
\description{
These functions are used to cluster some motif census object:
\itemize{
\item \code{cluster_hierarchical()} returns a hierarchical clustering object
created by \code{stats::hclust()}.
\item \code{cluster_concor()} returns a hierarchical clustering object
created from a convergence of correlations procedure (CONCOR).
\item \code{cluster_cosine()} returns a hierarchical clustering object
created by \code{stats::hclust()} on cosine dissimilarities,
rather than correlations, as created by \code{to_cosine()}.
}

These functions are not intended to be called directly,
but are called within \code{node_in_equivalence()} and related functions.
They are exported and listed here to provide more detailed documentation.
}
\section{Hierarchical clustering}{

This method uses \code{stats::hclust()} to create a hierarchical clustering object
from a distance matrix created from the correlations between nodes' profiles
in the given motif census.
First a matrix of Pearson correlation coefficients between each pair of
nodes' profiles in the given motif census is created.
Then a distance matrix is created by subtracting these correlations from \code{1},
and this is given to \code{stats::hclust()} to enable dendrogram construction etc.
}

\section{Cosine similarity}{

This method is similar to the hierarchical clustering method,
but uses cosine similarity rather than correlation as the clustering basis.
First a matrix of cosine similarities between each pair of nodes' profiles
in the given census is created.
Then a distance matrix is created by subtracting these similarities from \code{1},
and this is given to \code{stats::hclust} to enable dendrogram construction etc.
}

\section{CONCOR}{

First a matrix of Pearson correlation coefficients between each pair of
nodes' profiles in the given motif census is created.
Then, again, we find the correlations of this square, symmetric matrix,
and continue to do this iteratively until each entry is either \code{1} or \code{-1}.
These values are used to split the data into two partitions,
with members either holding the values \code{1} or \code{-1}.
This procedure from census to convergence is then repeated within each block,
allowing further partitions to be found.
Unlike UCINET, partitions are continued until there are single members in
each partition.
Then a distance matrix is constructed from records of in which partition phase
nodes were separated,
and this is given to \code{stats::hclust()} so that dendrograms etc can be returned.
}

\references{
\subsection{On CONCOR clustering}{

Breiger, Ronald L., Scott A. Boorman, and Phipps Arabie. 1975.
"An Algorithm for Clustering Relational Data with Applications to
Social Network Analysis and Comparison with Multidimensional Scaling".
\emph{Journal of Mathematical Psychology}, 12: 328-83.
\doi{10.1016/0022-2496(75)90028-0}.
}
}
