
Convert Tiered Knowledge to Forbidden Knowledge
Source:R/knowledge-verbs.R
convert_tiers_to_forbidden.RdConverts tier assignments into forbidden edges, and drops tiers in the output.
See also
Other knowledge functions:
+.Knowledge(),
add_exogenous(),
add_tier(),
add_to_tier(),
add_vars(),
as_bnlearn_knowledge(),
as_pcalg_constraints(),
as_tetrad_knowledge(),
deparse_knowledge(),
forbid_edge(),
get_tiers(),
knowledge(),
knowledge_to_caugi(),
remove_edge(),
remove_tiers(),
remove_vars(),
reorder_tiers(),
reposition_tier(),
require_edge(),
seq_tiers(),
unfreeze()
Examples
kn <- knowledge(
tpc_example,
tier(
child ~ starts_with("child"),
youth ~ starts_with("youth"),
old ~ starts_with("old")
)
)
kn_converted <- convert_tiers_to_forbidden(kn)
print(kn_converted)
#>
#> ── Knowledge object ────────────────────────────────────────────────────────────
#>
#> ── Variables ──
#>
#> var tier
#> <chr> <chr>
#> 1 child_x1 NA
#> 2 child_x2 NA
#> 3 youth_x3 NA
#> 4 youth_x4 NA
#> 5 oldage_x5 NA
#> 6 oldage_x6 NA
#> ── Edges ──
#>
#> ✖ oldage_x5 → child_x1
#> ✖ oldage_x5 → child_x2
#> ✖ oldage_x5 → youth_x3
#> ✖ oldage_x5 → youth_x4
#> ✖ oldage_x6 → child_x1
#> ✖ oldage_x6 → child_x2
#> ✖ oldage_x6 → youth_x3
#> ✖ oldage_x6 → youth_x4
#> ✖ youth_x3 → child_x1
#> ✖ youth_x3 → child_x2
#> ✖ youth_x4 → child_x1
#> ✖ youth_x4 → child_x2
plot(kn_converted)