Estimates the stability of centrality measures in a network using subset sampling without replacement. It allows for dropping varying proportions of cases and calculates correlations between the original centralities and those computed using sampled subsets.
estimate_cs(
x,
loops,
normalize,
invert,
measures,
iter,
method,
drop_prop,
threshold,
certainty,
progressbar = NULL,
detailed = NULL,
actor = NULL,
edges = FALSE
)estimate_centrality_stability(
x,
loops,
normalize,
invert,
measures,
iter,
method,
drop_prop,
threshold,
certainty,
progressbar = NULL,
detailed = NULL,
actor = NULL,
edges = FALSE
)
# S3 method for tna
estimate_cs(
x,
loops = FALSE,
normalize = FALSE,
invert = TRUE,
measures = c("InStrength", "OutStrength", "Betweenness"),
iter = 1000,
method = "pearson",
drop_prop = seq(0.1, 0.9, by = 0.1),
threshold = 0.7,
certainty = 0.95,
progressbar = FALSE,
detailed = NULL,
actor = NULL,
edges = FALSE
)
# S3 method for tna
estimate_centrality_stability(
x,
loops = FALSE,
normalize = FALSE,
invert = TRUE,
measures = c("InStrength", "OutStrength", "Betweenness"),
iter = 1000,
method = "pearson",
drop_prop = seq(0.1, 0.9, by = 0.1),
threshold = 0.7,
certainty = 0.95,
progressbar = FALSE,
detailed = NULL,
actor = NULL,
edges = FALSE
)
# S3 method for group_tna
estimate_cs(
x,
loops = FALSE,
normalize = FALSE,
invert = TRUE,
measures = c("InStrength", "OutStrength", "Betweenness"),
iter = 1000,
method = "pearson",
drop_prop = seq(0.1, 0.9, by = 0.1),
threshold = 0.7,
certainty = 0.95,
progressbar = FALSE,
detailed = NULL,
actor = NULL,
edges = FALSE
)
# S3 method for group_tna
estimate_centrality_stability(
x,
loops = FALSE,
normalize = FALSE,
invert = TRUE,
measures = c("InStrength", "OutStrength", "Betweenness"),
iter = 1000,
method = "pearson",
drop_prop = seq(0.1, 0.9, by = 0.1),
threshold = 0.7,
certainty = 0.95,
progressbar = FALSE,
detailed = NULL,
actor = NULL,
edges = FALSE
)
A tna_stability object which is a list with an element for each
measure (and an element Edges when edges = TRUE) with the following
elements:
cs_coefficient: The centrality stability (CS) coefficient
of the measure.
correlations: A matrix of correlations between the original
centrality and the resampled centralities, with one row per resample
(iter rows) and one column per drop proportion.
The drop proportions and the correlation threshold are stored in the
attributes drop_prop and threshold. Use summary.tna_stability() for
the CS-coefficients as a table.
If x is a group_tna object, a group_tna_stability object is returned
instead, which is a list of tna_stability objects.
A tna or a group_tna object representing the temporal network
analysis data. The object should be created from a sequence data object.
Grouped models with scaled edge weights, and their networks, are not
resampled (an error of class tna_error_scaling).
A logical value indicating whether to include loops in the
network when computing the centrality measures. The default is FALSE.
A logical value indicating whether to normalize
the centrality measures. The default is FALSE.
A logical value indicating whether the weights should be
inverted for distance-based measures. The default is TRUE.
A character vector of centrality measures to estimate.
The default measures are "InStrength", "OutStrength",
and "Betweenness". See centralities() for a list of available
centrality measures.
An integer specifying the number of resamples to draw.
The default is 1000.
A character string indicating the correlation coefficient
type. The default is "pearson". See stats::cor() for details.
A numeric vector specifying the proportions of
cases to drop in each sampling iteration. Default is a sequence from 0.1
to 0.9 in increments of 0.1.
A numeric value specifying the correlation threshold for
calculating the CS-coefficient. The default is 0.7.
A numeric value specifying the desired level of certainty
for the CS-coefficient. Default is 0.95. The certainty is the share of
all subsamples whose correlation reaches threshold; a subsample in
which the correlation is undefined (the measure is constant in it)
counts as one that does not reach it.
A logical value. If TRUE, a progress bar is
displayed. Defaults to FALSE.
Deprecated. This argument is ignored and will be removed in a future version.
An optional actor identifier for sequences nested in actors:
a character string naming a non-sequence column of the data the model
was built from, or a vector with one identifier per sequence (per
sequence of the data the grouped model was built from, for a group_tna
object). When given, drop_prop is the proportion of actors dropped,
and each actor's sequences are dropped together. The default NULL
drops single sequences.
A logical value. If TRUE, the stability of the edge
weights is also estimated and returned as the element Edges. The
default is FALSE.
The function works by repeatedly resampling the data, dropping varying proportions of cases, and calculating centrality measures on the subsets. The correlation between the original centralities and the resampled centralities is calculated for each drop proportion. The stability of each centrality measure is then summarized using a centrality stability (CS) coefficient, which represents the proportion of dropped cases at which the correlations drop below a given threshold (default 0.7).
With edges = TRUE, the stability of the edge weights is estimated in the
same way: in each subsample the network is estimated again and its edge
weights are correlated with the edge weights of the original network
(Epskamp et al., 2018). Only the edges present in the original network
are compared, self-loops included. An edge that is absent from the
original data cannot appear in a subsample, so including the absent edges
would add pairs of zeros that always agree and inflate the correlation.
The loops, normalize, and invert arguments do not affect the edge
weights.
The results can be visualized by plotting the output object showing the stability of the centrality measures across different drop proportions, along with confidence intervals. The CS-coefficients are displayed in the subtitle.
Epskamp, S., Borsboom, D., & Fried, E. I. (2018). Estimating psychological networks and their accuracy: A tutorial paper. Behavior Research Methods, 50(1), 195--212. tools:::Rd_expr_doi("10.3758/s13428-017-0862-1")
Validation functions
bootstrap(),
deprune(),
markov_order(),
permutation_test(),
permutation_test.group_tna(),
plot.group_tna_bootstrap(),
plot.group_tna_permutation(),
plot.group_tna_stability(),
plot.tna_bootstrap(),
plot.tna_markov_order(),
plot.tna_permutation(),
plot.tna_reliability(),
plot.tna_stability(),
print.group_tna_bootstrap(),
print.group_tna_permutation(),
print.group_tna_stability(),
print.summary.group_tna_bootstrap(),
print.summary.tna_bootstrap(),
print.summary.tna_markov_order(),
print.tna_bootstrap(),
print.tna_markov_order(),
print.tna_permutation(),
print.tna_reliability(),
print.tna_stability(),
prune(),
pruning_details(),
reliability(),
reprune(),
summary.group_tna_bootstrap(),
summary.tna_bootstrap(),
summary.tna_markov_order(),
summary.tna_permutation(),
summary.tna_reliability(),
summary.tna_stability()
# A small subset and few iterations
estimate_cs(
tna(head(group_regulation, 200)),
drop_prop = c(0.3, 0.6),
measures = "InStrength",
iter = 5
)
# \donttest{
model <- tna(group_regulation)
# Small number of iterations and drop proportions for CRAN
estimate_cs(
model,
drop_prop = seq(0.3, 0.9, by = 0.2),
measures = c("InStrength", "OutStrength"),
iter = 10
)
# Stability of the edge weights alongside the centralities
estimate_cs(
model,
drop_prop = seq(0.3, 0.9, by = 0.2),
measures = "InStrength",
iter = 10,
edges = TRUE
)
# }
Run the code above in your browser using DataLab