| prune | R Documentation |
prune() never removes anything from an ackwards object – it only
annotates factors with pruned/prune_reason flags in x$prune$nodes
(flag-only, never removes; the object keeps every level). Because it is a
separate, cheap step from extraction, you can re-prune with new thresholds
without re-running ackwards():
x <- ackwards(bfi25, k_max = 6, engine = "esem") # expensive
x |> prune("redundant") # cheap, repeatable
x |> prune("redundant", redundancy_r = 0.95) # no re-extraction
prune() is an S3 generic (rather than a plain function) so it coexists
with the prune generics already defined by recursive-partitioning
packages (e.g. rpart::prune) regardless of package load order.
prune(x, ...)
## S3 method for class 'ackwards'
prune(
x,
rules = "none",
manual = NULL,
redundancy_r = 0.9,
redundancy_phi = NULL,
redundancy_criterion = c("direct", "adjacent"),
min_items = 3L,
orphan_r = 0.5,
...
)
x |
An |
... |
Reserved for future methods/arguments. |
rules |
Character vector controlling which auto-rules run. Default
|
manual |
Character vector of factor labels (e.g. |
redundancy_r |
Scalar in |
redundancy_phi |
Scalar in
|
redundancy_criterion |
How redundancy chains are traced. One of:
|
min_items |
Minimum number of items for which a factor must be the
primary loader (highest |
orphan_r |
Threshold for the |
Reading x$prune$chains under redundancy_criterion = "direct". The
r_to_prev and phi_to_prev columns report the adjacent-level
correlation and congruence between consecutive chain members (for continuity
of display), but chain membership is decided by the direct (skip-level)
correlation to the chain's deepest factor. A direct chain can therefore
legitimately contain a link whose r_to_prev is below redundancy_r – the
stronger direct link is what justified it. The endpoint_r column gives the
direct root-to-leaf correlation as an at-a-glance cross-check. Under
redundancy_criterion = "adjacent", r_to_prev is the criterion and always
meets redundancy_r.
x, with $prune populated (replacing any prior pruning).
Forbes, M. K. (2023). Improving hierarchical models of individual differences: An extension of Goldberg's bass-ackward method. Psychological Methods. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1037/met0000546")}
Lorenzo-Seva, U., & ten Berge, J. M. F. (2006). Tucker's congruence coefficient as a meaningful index of factor similarity. Methodology, 2(2), 57–64. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1027/1614-2241.2.2.57")}
ackwards(), tidy.ackwards() (what = "nodes"),
autoplot.ackwards() (drop_pruned)
# sim16 has a planted redundant chain + overextraction artifact at k = 5,
# so the prune rules always have a finding to show (and no ordinal warning).
x <- ackwards(sim16, k_max = 5)
xp <- prune(x, "redundant")
xp$prune$nodes
# Re-prune with a new threshold -- no re-extraction needed
prune(x, "redundant", redundancy_r = 0.95)
# Manual pruning: standalone, or mixed with an auto rule
prune(x, manual = "m4f2")
prune(x, "redundant", manual = "m4f2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.