\name{NodeInformation}
\alias{NodeInformation}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
Mutual information between each node and the rest of the network
}
\description{
Computes, for each node of a (tractable) Ising model, the mutual information
\eqn{I(\text{node}; \text{rest of network})} between that node and all remaining
nodes. This quantifies how much knowing the state of a single node reduces the
uncertainty (Shannon entropy) about the joint state of the remaining nodes.
}
\usage{
NodeInformation(graph, thresholds, beta = 1, base = 2,
          responses = c(0L, 1L), delta = 0)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{graph}{
Weights matrix
}
  \item{thresholds}{
Thresholds vector
}
  \item{beta}{
Inverse temperature
}
  \item{base}{
Base of the logarithm
}
  \item{responses}{
Vector of outcome responses.
}
  \item{delta}{
Optional per-node quadratic (Blume-Capel) term added to the Hamiltonian as \code{delta_i * s_i^2}; a single value (recycled over nodes) or one value per node. The default \code{0} corresponds to the ordinary Ising model. See \code{\link{BlumeCapelSampler}}.
}
}
\details{
For each node \eqn{i} the returned value is computed via \code{\link{IsingEntropy}}
as the entropy of the rest of the network with node \eqn{i} marginalised out,
minus the entropy of the rest of the network conditional on node \eqn{i}:
\deqn{I_i = H(\text{rest}) - H(\text{rest} \mid \text{node}_i).}
This is the standard decomposition of the mutual information
\eqn{I(\text{node}_i; \text{rest})}. As mutual information it is non-negative
(up to numerical error). The computation is only tractable for small networks
(roughly up to 10 nodes), since it enumerates the full state space via
\code{\link{IsingLikelihood}}.
}
\value{
A numeric vector of length \code{ncol(graph)}, giving the mutual information (in
units set by \code{base}) between each node and the remaining nodes of the
network.
}
\author{
Sacha Epskamp <mail@sachaepskamp.com>
}

\seealso{
\code{\link{IsingEntropy}}
}
\examples{
# Small 3-node network:
N <- 3
graph <- matrix(0, N, N)
graph[upper.tri(graph)] <- c(0.5, 0.2, 0.8)
graph <- graph + t(graph)
thresholds <- rep(0, N)

# Mutual information of each node with the rest of the network:
NodeInformation(graph, thresholds)
}
