% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/build_network.R
\name{predictability}
\alias{predictability}
\alias{predictability.netobject}
\alias{predictability.netobject_ml}
\alias{predictability.netobject_group}
\title{Compute Node Predictability}
\usage{
predictability(object, ...)

\method{predictability}{netobject}(object, data = NULL, ...)

\method{predictability}{netobject_ml}(object, ...)

\method{predictability}{netobject_group}(object, ...)
}
\arguments{
\item{object}{A \code{netobject} or \code{netobject_ml} object.}

\item{...}{Additional arguments (ignored).}

\item{data}{Optional data frame of the original variables used to estimate
the network. Required for \code{method = "cor"} (multiple-R\eqn{^2} regression
of each node on its neighbours); ignored for the precision-matrix path used
by \code{glasso}/\code{pcor}, which has no need of the raw data.}
}
\value{
For \code{netobject}: a named numeric vector of R\eqn{^2} values
(one per node, between 0 and 1).

For \code{netobject_ml}: a list with elements \code{$between} and
\code{$within}, each a named numeric vector.

A named numeric vector of predictability values per node.

A list with \code{within} and \code{between} predictability vectors.

A named list of per-group predictability vectors.
}
\description{
Computes the proportion of variance explained (R\eqn{^2}) for each node in
the network, following Haslbeck & Waldorp (2018).

For \code{method = "glasso"} or \code{"pcor"}, predictability is computed
analytically from the precision matrix:
\deqn{R^2_j = 1 - 1 / \Omega_{jj}}
where \eqn{\Omega} is the precision (inverse correlation) matrix.

For \code{method = "cor"}, predictability is the multiple R\eqn{^2} from
regressing each node on its network neighbors (nodes with non-zero edges).
}
\examples{
set.seed(42)
mat <- matrix(rnorm(60), ncol = 4)
colnames(mat) <- LETTERS[1:4]
net <- build_network(as.data.frame(mat), method = "glasso")
predictability(net)

}
\references{
Haslbeck, J. M. B., & Waldorp, L. J. (2018). How well do network models
predict observations? On the importance of predictability in network models.
\emph{Behavior Research Methods}, 50(2), 853--861.
\doi{10.3758/s13428-017-0910-x}
}
