ResIN_igraph {ResIN} | R Documentation |
ResIN_igraph
Description
Performs Response Item-Network analysis (ResIN) and exports the results as an igraph
object.
Usage
ResIN_igraph(
df,
node_vars = NULL,
cor_method = "auto",
weights = NULL,
method_wCorr = "Polychoric",
remove_negative = TRUE,
igraph_arglist = NULL,
EBICglasso = FALSE,
EBICglasso_arglist = NULL,
cluster = TRUE,
seed = 42
)
Arguments
df |
A data-frame object containing the raw data. |
node_vars |
An optional character string detailing the attitude item columns to be selected for ResIN analysis (i.e. the subset of attitude variables in df). |
cor_method |
Which correlation method should be used? Defaults to "auto" which applies the |
weights |
An optional continuous vector of survey weights. Should have the same length as number of observations in df. If weights are provided, weighted correlation matrix will be estimated with the |
method_wCorr |
If weights are supplied, which method for weighted correlations should be used? Defaults to |
remove_negative |
Should all negative correlations be removed? Defaults to TRUE (highly recommended). Setting to FALSE makes it impossible to estimate a force-directed network layout. Function will use igraph::layout_nicely instead. |
igraph_arglist |
An optional argument list feeding additional instructions to |
EBICglasso |
Should a sparse, Gaussian-LASSO ResIN network be estimated? Defaults to FALSE. If set to TRUE, |
EBICglasso_arglist |
An argument list feeding additional instructions to the |
cluster |
Optional, should community detection be performed on item response network? Defaults to FALSE. If set to TRUE, performs "cluster_leading_eigen" function from the igraph package and stores results in plotting_frame. |
seed |
Random seed for force-directed algorithm. |
Value
A list object containing the igraph
output object, a numeric vector detailing which item responses belong to which item (same_items
), and optionally a matrix detailing community membership of different item nodes (clustering
).
References
Csardi G, Nepusz T (2006). “The igraph software package for complex network research.” InterJournal, Complex Systems, 1695. https://igraph.org.
Examples
## Load the 12-item simulated Likert-type ResIN toy dataset
data(lik_data)
## Run the function:
ResIN_igraph <- ResIN_igraph(lik_data)
## Plot and/or investigate as you wish:
igraph::plot.igraph(ResIN_igraph$igraph_obj)