Experimental. Bootstraps the item weights of a
build_mcml_pc fit: rows of the raw data are resampled,
the node-level network is re-estimated each time, and the
connectivity-based composite weights are recomputed. Wide intervals
mean the weighting (and therefore the "loadings" macro
network) should not be over-interpreted.
Arguments
- x
An
mcml_pcobject that carries raw data. For theprint()andplot()methods: an object of classpc_loading_stability.- iter
Integer. Bootstrap replicates (default 200; node-level re-estimation makes this heavier than a plain bootstrap).
- ci_level
Numeric. Significance level for percentile CIs (default 0.05).
- seed
Integer or NULL. RNG seed.
- digits
Number of digits to display (default 3).
- ...
In
plot.pc_loading_stability()andprint.pc_loading_stability(): Additional arguments (ignored).
Value
An object of class "pc_loading_stability": a list with
summary (tidy data frame: node, cluster,
weight, boot_mean, boot_sd, ci_lower,
ci_upper, sign_flips - the proportion of replicates
in which the item's sign differed from the observed one),
boot_weights (iter x n_nodes matrix), iter, and
ci_level. Has print and plot methods.
In print.pc_loading_stability(): x, invisibly.
In plot.pc_loading_stability(): A ggplot object.
Methods
plot.pc_loading_stability(): Signed composite weights with bootstrap percentile intervals, faceted by cluster.
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