# Bayesian Network - unclear homework example

I am not sure if it is me or the example:

A doctor gives a patient a drug dependent on their age and gender. The patient has a probability to recover depending on whether s/he receives the drug, how old s/he is and which gender the patient has. Additionally it is known that age and gender are conditional independent if nothing else is known from the patient.

i) Draw the Bayesian Network which describes the situation.

ii) How does the factorized probability distribution look like?

iii) Write down the formula to compute the probability that a patient recovers given that you know if s/he gets the drug. Write down the formula using only probabilities which are part of the factorized probability distribution.

I think I could handle task ii) and iii) if someone would show me how the network looks like.

What is not clear to me is the give fact that "A doctor gives a patient a drug dependent on their age and gender" and "patient has a probability to recover depending on whether s/he receives the drug, how old s/he is and which gender the patient has".

Could someone help me with that?

• Sounds like "the doctor may use patient's age and gender to decide with what probability to give the patient the drug" and "the chances of the patient recovering may depend on whether they received the drug, their age, and their gender". Does this maybe help? Nov 12, 2013 at 1:10

i) Let $R$ represent the patient recovering, $D$ represent the drug being administered, $A$ represent the patient's age, and $G$ represent the patient's gender. Lastly $X\rightarrow Y$ means that there's an arrow from $X$ to $Y$ in the Bayesian network. Now let's break down the problem.

A doctor gives a patient a drug dependent on their age and gender.

This translates to $A\rightarrow D$ and $G\rightarrow D$.

The patient has a probability to recover depending on whether s/he receives the drug, how old s/he is and which gender the patient has.

This translates to $D\rightarrow R$, $A\rightarrow R$, and $G\rightarrow R$.

Additionally it is known that age and gender are conditional independent if nothing else is known from the patient.

This doesn't add any new arrows and translates to $P(A,G)=P(A)P(G)$. However, if we knew $D$ and let's say $A$, we might be able to infer insight on the value of $G$ (and maybe infer $A$ if we knew $G$ and $D$). Same story is we replace $D$ with $R$.

ii) This isn't the only way to factorize the joint distribution (there's a more elegant way that uses the conditional independence of $A$ and $G$), but this way will help us with part iii), \begin{align*} P(A,G,R,D) &=P(A|G,R,D)P(G,R,D) \\\ &=P(A|G,R,D)P(G|R,D)P(R,D) \\\ &=P(A|G,R,D)P(G|R,D)P(R|D)P(D) \\\ \end{align*} On the other hand, they may be looking for a form which conforms more clearly to the arrow relations like, \begin{align*} P(R,D,A,G) &=P(R|D,A,G)P(D,A,G) \\\ &=P(R|D,A,G)P(D|A,G)P(A,G) \\\ &=P(R|D,A,G)P(D|A,G)P(A)P(G) \\\ \end{align*}

iii) Using the fully factored form in the first part of ii) we can solve for $P(R|D)$, $$P(R|D) = \frac{P(A,G,R,D)}{P(A|G,R,D)P(G|R,D)P(D)}$$

• Hi and thank you for your answer! That is how I interpreted the exercise too. Good to know someone else does this too! I now struggle a little bit with iii). Do I have to show $P(R|D) = \frac{P(A,G,D,R)}{P(D)}$? I am able to show that $P(R|D) = \int_A \int_G P(R,A,G|D) dAdG =\int_A \int_G \frac{P(A,G,D,R)}{P(D)} dAdG = P(R|D)$ but is that correct? Thank you for any help! Nov 12, 2013 at 10:11
• No problem. It's good practice for me too. I've expanded on what I said earlier and just did all three parts. Also, note that for your comment $P(R|D)\neq \frac{P(A,G,D,R)}{P(D)}$ but instead $P(R|D)=\frac{P(R,D)}{P(D)}$. Oh and if you like my answer, feel free to upvote it as well :) Nov 12, 2013 at 18:26
• Thank you Christian for your help! I think I get it now :) I'd like to upvote your answer but I have to wait until I own 15 reputation points :) Nov 12, 2013 at 22:10
• No worries. Glad I can help. If you find any mistakes later, let me know so that I can fix it and others can use the correct answer. Nov 13, 2013 at 5:12