% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/measure_heterogeneity.R
\name{measure_assort_node}
\alias{measure_assort_node}
\alias{node_by_heterophily}
\alias{node_by_homophily}
\title{Measures of nodes assortativity}
\usage{
node_by_heterophily(.data, attribute)

node_by_homophily(
  .data,
  attribute,
  assortativity = c("ie", "ei", "yule", "geary")
)
}
\arguments{
\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()}}.}

\item{attribute}{Name of a nodal attribute, mark, measure, or membership vector.}

\item{assortativity}{Which method to use for \verb{*_homophily()}.
Either "ie" (negative E-I index), "ei" (E-I index),
"yule" (Yule's Q), or "geary" (Geary's C).
Default is "ie".
The E-I index is the number of ties between (or \emph{external}) nodes
grouped in some mutually exclusive categories
minus the number of ties within (or \emph{internal}) these groups
divided by the total number of ties.
This value can range from 1 to -1,
where 1 indicates ties only between categories/groups and -1 ties only within categories/groups.

Yule's Q is a measure of association for two binary variables, calculated as:
\deqn{Q = \frac{ad - bc}{ad + bc}}
where \eqn{a} is the number of ties between nodes in the same category,
\eqn{b} is the number of ties between nodes in different categories,
\eqn{c} is the number of non-ties between nodes in the same category,
and \eqn{d} is the number of non-ties between nodes in different categories.
This value can range from -1 to 1, where 1 indicates perfect association
(all ties are between nodes in the same category), -1 indicates perfect disassociation
(all ties are between nodes in different categories), and 0 indicates no association.

Geary's C is a measure of spatial autocorrelation, calculated as:
\deqn{C = \frac{(n - 1) \sum
\limits_{i=1}^n \sum\limits_{j=1}^n w_{ij} (x_i - x_j)^2}{2W \sum\limits_{i=1}^n (x_i - \bar{x})^2}}
where \eqn{n} is the number of nodes, \eqn{
w_{ij}} is the weight of the tie between nodes \eqn{i} and \eqn{j},
\eqn{x_i} is the attribute value of node \eqn{i},
\eqn{\bar{x}} is the mean attribute value across all nodes, and \eqn{W} is the sum of all tie weights.
This value can range from 0 to 2, where values less than 1
indicate positive autocorrelation (similar values are more likely to be connected),
values greater than 1 indicate negative autocorrelation (dissimilar values are more likely
to be connected), and a value of 1 indicates no autocorrelation.
If an incompatible method is chosen for the attribute type,
a suitable alternative will be used instead with a message.}
}
\value{
A \code{node_measure} numeric vector the length of the nodes in the network,
providing the scores for each node.
If the network is labelled,
then the scores will be labelled with the nodes' names.
}
\description{
These functions offer ways to measure nodes' assortativity in a network:
\itemize{
\item \code{node_by_heterophily()} measures each node's embeddedness within groups
of nodes with the same attribute.
\item \code{node_by_homophily()} measures each node's embeddedness within groups
of nodes with the same attribute, using a variety of methods.
}
}
\examples{
marvel_friends <- to_unsigned(to_uniplex(fict_marvel, "relationship"), "positive")
node_by_heterophily(marvel_friends, "Gender")
node_by_heterophily(marvel_friends, "Attractive")
}
\seealso{
Other diversity:
\code{\link{measure_assort_net}},
\code{\link{measure_diverse_net}},
\code{\link{measure_diverse_node}}

Other measures:
\code{\link{measure_assort_net}},
\code{\link{measure_breadth}},
\code{\link{measure_broker_node}},
\code{\link{measure_broker_tie}},
\code{\link{measure_brokerage}},
\code{\link{measure_central_between}},
\code{\link{measure_central_close}},
\code{\link{measure_central_degree}},
\code{\link{measure_central_eigen}},
\code{\link{measure_centralities_between}},
\code{\link{measure_centralities_close}},
\code{\link{measure_centralities_degree}},
\code{\link{measure_centralities_eigen}},
\code{\link{measure_closure}},
\code{\link{measure_closure_node}},
\code{\link{measure_cohesion}},
\code{\link{measure_core}},
\code{\link{measure_diffusion_infection}},
\code{\link{measure_diffusion_net}},
\code{\link{measure_diffusion_node}},
\code{\link{measure_diverse_net}},
\code{\link{measure_diverse_node}},
\code{\link{measure_features}},
\code{\link{measure_fragmentation}},
\code{\link{measure_hierarchy}},
\code{\link{measure_periods}}

Other nodal:
\code{\link{mark_core}},
\code{\link{mark_degree}},
\code{\link{mark_diff}},
\code{\link{mark_nodes}},
\code{\link{mark_select_node}},
\code{\link{measure_broker_node}},
\code{\link{measure_brokerage}},
\code{\link{measure_central_between}},
\code{\link{measure_central_close}},
\code{\link{measure_central_degree}},
\code{\link{measure_central_eigen}},
\code{\link{measure_closure_node}},
\code{\link{measure_core}},
\code{\link{measure_diffusion_node}},
\code{\link{measure_diverse_node}},
\code{\link{member_brokerage}},
\code{\link{member_cliques}},
\code{\link{member_community}},
\code{\link{member_community_hier}},
\code{\link{member_community_non}},
\code{\link{member_components}},
\code{\link{member_core}},
\code{\link{member_diffusion}},
\code{\link{member_equivalence}},
\code{\link{motif_brokerage_node}},
\code{\link{motif_exposure}},
\code{\link{motif_node}},
\code{\link{motif_path}}
}
\concept{diversity}
\concept{measures}
\concept{nodal}
