# How to find conditional probabilities for simple 4 categories problem?

Imagine you are give the following problem:

• There is a 50% chance of diagnosing an illness correctly as "Known" instead of "Unknown".
• There is a 50% that available treatments "Control" the "Known" illness (and 50% they do not,lets us "Chaos" as a label for out of control)

What are the chances the patient has an "Unknown" illness that is out of control (in “Chaos”)

Initially I thought I could solve it with this code:

cause = CategoricalDistribution[{"Known", "Unknown"}, {1/2, 1/2}]
control = CategoricalDistribution[{"Control", "Chaos"}, {1/2, 1/2}]
Probability[ ca == "Unknown" &&  co == "Chaos" , {ca \[Distributed] cause, co \[Distributed] control} ]


Which results in the answer $$\frac{1}{4}$$ (0.25)

But then I realized that is only if probability of pick a treatment that "Controls" condition is independent of probability of "Known" condition, which feels intuitively wrong.

How can I tell Mathematica that if the illness is "Known" the probability to "Control" it should be higher, say: 60%, and if the illness is “Unknown" the probability to "Control" it is lower (say "40%") ?

• You'd have to define a multivariate CategoricalDistribution, as explained in the corresponding section of the reference page. Mar 2, 2022 at 20:47
• I wonder if I am being hit by this: mathematica.stackexchange.com/questions/240215/… Mar 3, 2022 at 0:33

Turns out that it can be done by using CategoricalDistribution multivariate support. I just have to change the code to be:

causecontrol = CategoricalDistribution[{{"Known", "Unknown"},
{"Control", "Chaos"}}, {{120, 80}, {80, 120}}]


and then:

Probability[
ca == "Unknown" &&  cp == "Chaos"  , {ca, cp} \[Distributed]
causecontrol]


gets me a $$\frac{3}{10}$$ (.3) answer. This made me realize what I am actually trying to get is c=="Unknown" conditional on cp=="Chaos"

Unfortunately while that works in the univariate mode:

Probability[
Conditioned[ca == "Unknown" ,
co == "Chaos" ], {ca \[Distributed] cause,
co \[Distributed] control} ]


Resulting in answer $$\frac{1}{2}$$

It returns an unevaluated expression under multivariate setting:

Probability[
Conditioned[ca == "Unknown" ,
cp == "Chaos"  ] , {ca, cp} \[Distributed] causecontrol]


I tried it on Mathematica Online, and it seems I am being hit by this bug, but other than that, the approach is correct.