build_pcor() estimates a partial correlation network: an undirected
graph of variables in which each edge is the correlation of two variables
after the others are held constant, read from the inverse of the
correlation matrix. It is build_network() with method = "pcor", with
no regularisation.
Unregularised partial correlations are noisy when there are many
variables for the number of observations, and they cannot be estimated
when the correlation matrix is singular (more variables than
observations, or collinear ones): that raises an error, and a
near-singular matrix a warning. build_glasso() estimates a sparse
network in those cases. Check the stability of the edges with
bootstrap_network().
Arguments
- data
The variables: a data frame with one row per observation and one column per variable, or a square symmetric correlation or covariance matrix, which needs the sample size in
params(as inparams = list(n = 250)). Non-numeric columns are set aside; a frame of two or more character or factor columns and fewer than two numeric ones is read as sequences and turned into per-row state counts first. A column namedridis set aside; columns with non-syntactic names, all-missing and constant columns, and rows with a missing value are dropped, each with a message; fewer than 2 variables or 3 complete rows raise an error.- actor
The id column naming whose observation each row is (a person). With
level, the decomposition groups by it; without, it is set aside, not modelled. DefaultNULL.- level
Multilevel decomposition, with
actor:"between"estimates the network of person means,"within"the network of deviations from them, and"both"returns the two as anetobject_ml. DefaultNULL(no decomposition).- ...
Further arguments for
build_network(), such asparams(cor_method,n),threshold,scalingorgroup.methodcannot be given: it is always"pcor"(error of classnestimate_bad_input).
Value
A netobject (a netobject_group with group, a netobject_ml
with level = "both"), exactly as build_network() returns it: print
it for an overview, read the edges with extract_edges(), and draw it
with cograph::splot().
Examples
data(srl_strategies)
net <- build_pcor(srl_strategies)