loading_stability() bootstraps the item weights of a build_mcml_pc()
fit and returns a pc_loading_stability object with each item's observed
signed weight, its bootstrap mean and standard deviation, a percentile
interval and how often its sign flipped. Each replicate resamples the rows
of the raw data with replacement, re-estimates the node-level network
with the fit's estimator (cor, pcor or glasso; any other node-level
method is re-estimated as cor) and correlation type, and reapplies the
fitted weighting scheme, data-dependent and custom weights and the
factor-analysis options included. A fit with a descriptive aggregation
("average", "escoufier", "cancor") has its item-table weights, the
"strength" weights, resampled. Experimental.
Wide intervals mean the weighting should not be over-interpreted. Equal
weights keep their magnitudes in every replicate, so for them only the
sign flips carry information; a sign that flips often marks an item whose
reverse-keying is not settled by the data. Supplied numeric weights are
fixed in magnitude and sign, so their intervals have zero width and
resampling them tells nothing. The intervals describe the weights, not
the macro network: edge-weight intervals for it come from
bootstrap_network() on its macro network.
Arguments
- x
An
mcml_pcobject that carries its raw data; one built from a network without data raises an error, and so does an older saved fit with custom weights, which must be rebuilt withbuild_mcml_pc()to keep its weighting. For theprint()andplot()methods: apc_loading_stabilityobject.- iter
The number of bootstrap replicates, at least 2. Default
200; each replicate re-estimates the node-level network, so this is slower than a plain bootstrap.- ci_level
The tail level of the percentile intervals:
0.05(default) gives 95% intervals.- seed
An integer that makes the resampling reproducible. Default
NULL. The session's own random stream is left as it was.- digits
For the
print()method: the decimal places of the numeric columns. Default3.- ...
- object
For the
summary()method: apc_loading_stabilityobject.
Value
A pc_loading_stability object. print() shows the item table
and summary() returns it;
plot() draws each item's signed weight with its interval, one panel
per cluster. The object's fields:
- summary
A data frame with one row per item:
node,cluster,weight(the observed signed weight),boot_mean,boot_sd,ci_lower,ci_upperandsign_flips(the share of replicates in which the item's sign differed from the observed one).- boot_weights
The
iterx items matrix of resampled signed weights.- iter, ci_level
The settings used.
For the methods: print() returns x invisibly, plot() a
ggplot.
For the summary() method: the item table, a data frame with one
row per item and the columns listed under summary above.
Methods
plot()draws each item's observed signed composite weight with its bootstrap percentile interval, one panel per cluster, with a dashed line at zero.
Examples
set.seed(1)
f <- stats::rnorm(100)
g <- stats::rnorm(100)
df <- data.frame(a1 = f + stats::rnorm(100), a2 = f + stats::rnorm(100),
a3 = f + stats::rnorm(100), b1 = g + stats::rnorm(100),
b2 = g + stats::rnorm(100), b3 = g + stats::rnorm(100))
cl <- list(A = c("a1", "a2", "a3"), B = c("b1", "b2", "b3"))
fit <- build_mcml_pc(df, cl, aggregation = "loadings",
method = "cor")
stability <- loading_stability(fit, iter = 50, seed = 1)
stability
#> Composite-Weight Stability (case bootstrap, experimental)
#> 50 replicates | 95% percentile CIs
#>
#> node cluster weight boot_mean boot_sd ci_lower ci_upper sign_flips
#> a1 A 0.338 0.332 0.021 0.292 0.370 0
#> a2 A 0.336 0.339 0.018 0.308 0.375 0
#> a3 A 0.326 0.329 0.021 0.290 0.367 0
#> b1 B 0.316 0.317 0.022 0.276 0.348 0
#> b2 B 0.350 0.346 0.022 0.310 0.393 0
#> b3 B 0.334 0.337 0.015 0.307 0.360 0