r2_distribution {SEset} | R Documentation |
Compute Controllability Distribution in the SE-set
Description
A function used to analyse the SEset results. For each member of the SE-set, calculate the proportion of explained variance in each child node, when predicted by all of its parent nodes
Usage
r2_distribution(SEmatrix, cormat, names = NULL, indices = NULL)
Arguments
SEmatrix |
An |
cormat |
A |
names |
optional character vector containing dimension names |
indices |
option vector of matrix indices, indicating which variables to compute the R^2 distribution for |
Value
Returns an n \times p
matrix of R^2
values.
For each member of the SE-set, this represents the variance explained in node X_i
by it's parents
in that weighted DAG.
References
Ryan O, Bringmann LF, Schuurman NK (upcoming). “The challenge of generating causal hypotheses using network models.” in preperation. Haslbeck JM, Waldorp LJ (2018). “How well do network models predict observations? On the importance of predictability in network models.” Behavior Research Methods, 50(2), 853–861.
See Also
network_to_SEset, find_parents
Examples
# first estimate the precision matrix
data(riskcor)
omega <- (qgraph::EBICglasso(riskcor, n = 69, returnAllResults = TRUE))$optwi
# qgraph method estimates a non-symmetric omega matrix, but uses forceSymmetric to create
# a symmetric matrix (see qgraph:::EBICglassoCore line 65)
omega <- as.matrix(Matrix::forceSymmetric(omega)) # returns the precision matrix
SEmatrix <- network_to_SEset(omega, digits=3)
r2set <- r2_distribution(SEmatrix, cormat = riskcor, names = NULL, indices = c(1,3,4,5,6))
# Plot results
apply(r2set,2,hist)
# For ggplot format, execute
# r2set <- tidyr::gather(r2set)