1
$\begingroup$

Following my previous question (How to create a dataset with conditional probability?), now I want to create a dataset in R containing the information about TWO symptoms, and 1 disease.

Symptoms $S_1$ and $S_2$ and independent and conditional independent, so $P(S_1|S_2)=P(S_1)$ and $P(S_2|S_1)=P(S_2)$.

Suppose we have the following data:

$P(D)=0.003$

$P(S_1)=0.005$

$P(S_2)=0.008$

$P(S_1|D)=0.3$

$P(S_2|D)=0.25$

Following the method that Henry used to solve my previous question, I think that we have to complete this table:

                                     Disease
                                     Yes       No

             |  Symptom1 Yes   |     a         b
Symptom2 Yes |                 |
             |           No    |     c         d
-------------|-----------------|------------------
             |  Symptom1 Yes   |     e         f
Symptom2 No  |                 | 
             |           No    |     g         h

What I'd like to calculate, from the dataset, is the value of $P(D|S_1 and S_2)$. Also I need to calculate the probability of each event, in order to run some simulations.

I tried to find the value for a...h, but I didn't find enough relationship to solve the 8-parameter system.

What I know is:

$P(D)=0.003 \rightarrow$ a + c + e + g = 0.003

$P(S_1)=0.005 \rightarrow$ a + b + e + f = 0.005

$P(S_2)=0.008 \rightarrow$ a + b + c + d = 0.008

$P(S_1|D)=0.3 \rightarrow$ (a + e) / (a + c + e + g) = 0.3

$P(S_2|D)=0.25 \rightarrow$ (a + c) / (a + c + e + g) = 0.25

and a + b + c + d + e + f + g + h = 1

So, my question is: are my data sufficient to create a dataset in R, which simulate a real population? The approach I tried was useful in the case of only 1 symptom (How to create a dataset with conditional probability?), as Henry explained. Is it good for the case of two symptoms? Or n-symptoms? Does it exists another approach to simulate this data?

$\endgroup$
2
  • $\begingroup$ You will always need some information on the simultaneity of the 2 symptoms, i.e. at least P(S1 & S2). $\endgroup$
    – Nick Sabbe
    Commented Sep 5, 2011 at 7:51
  • $\begingroup$ @nicksabbe since the 2 symptoms are independent, we know that $P(S_1 and S_2)=P(S_1)P(S_2)$ (the probability of having both symptoms in the general population [with and without disease] is 0.005 x 0.008). And also I know that $P(S_1, S_2|D) = P(S_1|D)P(S_2|D)$ (the probability of having both symptoms in the diseased population is 0.3 x 0.25). And this does not add more information to my problem (I think)... $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 8:54

2 Answers 2

1
$\begingroup$

You have (with our trusty old friend Bayes): $$P(D | S1 \& S2) = (P(D \& S1 \& S2)) / (P(S1 \& S2)) = (P(S1 \& S2 | D) P(D)) / (P(S1 \& S2))$$ Given independence and conditional independence of S1 and S2, you know all the parts on the right hand side, so you can calculate the probability you were interested in.

$\endgroup$
5
  • $\begingroup$ This is absolutely correct, so vote up for the answer. But my problem is not to calculate $P(D|S_1,S_2)=\frac{P(S_1|D)P(S_2|D)P(D)}{P(S_1)P(S_2)}$, but to create a dataset (a lot of datasets, using the "sample" function in R), in order to perform some simulation. To do this, I need the probability of every event, using something like the method Henry used here: stats.stackexchange.com/questions/15141/… or a better approach to this kind of problem. $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 9:15
  • $\begingroup$ Ah. My bad. I just sort of read 'I want to calculate...' in your question. Well, for the rest, you can find $a$ as $P(S1 \& S2 \& D)$, and similarly for the others. Using Bayes again on these forms (and doing some lifting on the negations) should enable you to calculate them all. $\endgroup$
    – Nick Sabbe
    Commented Sep 5, 2011 at 10:08
  • $\begingroup$ I tried to solve the problem, using the 6 relationship written in the question, and (7) $a=P(S_1)P(S_2)P(D)$, (8) $h=P(-S_1)P(-S_2)P(-D)$. And also I tried with that six relationship plus: (7) $a=P(S_1)P(S_2)P(D)$, (8) $P(S_1|S_2)=P(S_1)$. Running some simulations, also changing the values of the parameters, sometimes I obtain negative probability! There's something wrong, but I really don't know what! $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 14:24
  • $\begingroup$ Surely, $a = P(S1&S2&D) != P(S1)P(S2)P(D)$ ?? Otherwise, occurrence of the symptoms is independent on disease status. $\endgroup$
    – Nick Sabbe
    Commented Sep 5, 2011 at 14:49
  • $\begingroup$ Damn probability, you're right! btw I thought for a long about the problem of how express a in terms of my problem's data, with no result. Probably I'm missing some theory, or maybe it is simply no possible. Any suggestion? Thanks for the big help! $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 19:40
1
$\begingroup$

Your question has six equations for eight unknowns, so in theory you need two more such as those additional properties you mention:

  • From independence: $\Pr(S_1 \text{ and } S_2) = \Pr(S_1) \Pr(S_2)$ so $a + b =0.00004$

  • From conditional independence $\Pr(S_1 \text{ and } S_2 | D) = \Pr(S_1|D) \Pr(S_2|D)$ so $a/(a+c+e+g) = 0.075$

and then use the technique in the previous answer for your sample.

If my calculations are correct then there is a slight problem as you already know $a+c+e+g=0.003$ so these give $a=0.000225$ and thus $b=-0.000185$ so $b$, which should be $\Pr(S_1 \text{ and } S_2 | \text{not } D)$, is not actually a probability.

$\endgroup$
3
  • $\begingroup$ Thanks for the answer Henry. As you noted, this appears like a paradox. The values of the parameters are chosen by me, but I think it's quite reasonably that a disease has a prevalence of 3/1000, and that symptoms S1 and S2 are present in the whole population with a prevalence of 5/1000 and 8/1000; also the presence of D1 and S2 in the disease (30% and 25%) are common values of many (really) diseases: I tried to be adherent to the reality, when I chose those data. So I really don't figured out why we obtain a negative probability (it also happened sometimes randomly changing the parameters)... $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 20:08
  • $\begingroup$ @Tommaso: The problem may come from assuming independence and conditional independence between the symptoms, which if related to the disease is unlikely. $\endgroup$
    – Henry
    Commented Sep 5, 2011 at 20:10
  • $\begingroup$ sure, it's unlikely, but it can happen. I don't think this is the problem, 'cause my data are invented, parameters can be changed (why numbers do not obey to our assumptions?!). BTW do you think that if we do not assume the independence and the conditional independence, the problem can be solved? How? We need again two more properties, to find the eight unknowns. $\endgroup$
    – Tommaso
    Commented Sep 5, 2011 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.