conditioning.Rd
Conditioning is easy only if the compositional model is decomposable. Then, it is enough to reorder it in a way that the conditional variable appears among arguments of the first probability distribution in the generating sequence and create a degenerated probability distribution over the variable
with value value
conditioning(model, variable, value)
model | Compositional model |
---|---|
variable | Name of discrete random variable |
value | Value of discrete random variable |
change original model in its input
#> Error in conditioning.Model(m, variable = "T", value = 1): Model is not decomposable. Conditioning is not possible.mDecomposable <- toDecomposable(m) dTable(toDistribution(marginalize(mDecomposable, variables = c("W"), keep = TRUE, new = TRUE)))#> W MUDIM.frequency #> 1: 2 0.62528 #> 2: 1 0.37472conditioning(mDecomposable, variable = "T", value = 1) marginalize(mDecomposable, variables = "W", keep = TRUE, new = FALSE) dTable(toDistribution(mDecomposable))#> W MUDIM.frequency #> 1: 2 0.7984 #> 2: 1 0.2016