View source: R/random_contexts.R
| randomize_context | R Documentation |
Modifies the incidence matrix of a formal context to create a random variation while preserving certain statistical properties. This is essential for statistical significance testing in FCA (e.g., "is this concept structure random?").
randomize_context(fc, method = "swap", iterations = NULL)
fc |
( |
method |
(character) The randomization strategy:
|
iterations |
(integer) Number of swap/rewire operations to perform.
Default is |
A new FormalContext object with the randomized incidence.
data(planets)
fc <- FormalContext$new(planets)
# 1. Edge Swapping (Preserves degree distribution)
# Useful for null-model testing
fc_rand_swap <- randomize_context(fc, method = "swap")
# Verify marginals are preserved
colSums(fc$incidence())
colSums(fc_rand_swap$incidence())
# 2. Rewiring (Preserves only density)
fc_rand_rewire <- randomize_context(fc, method = "rewire")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.