[R] simulation-binomial
hello, i want to do a binomial simulation, by taking 200 var. from one group (x) and 300 from another (y). the prob. for disease=.6 in both groups. x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if the person is from group x - the probability to find the disease, assuming the person is sick, is .95, if he is from group Y its .80. i want to know the joint probability: p(the person has the disease and tested sick)=P(D+,T+). my problem is how to write the conditional prob. Thanks for your help, also reference on this subject (binomial simulation) would be great. Sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulation-binomial
That depends on what you meant by writing the conditional probability. Bayes rule says that the probability of testing positive when one has the disease is calculated as follows: Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+) is that what you mean? Kyle H. Ambert Department of Behavioral Neuroscience Oregon Health Science University On 8/8/07, sigalit mangut-leiba [EMAIL PROTECTED] wrote: hello, i want to do a binomial simulation, by taking 200 var. from one group (x) and 300 from another (y). the prob. for disease=.6 in both groups. x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if the person is from group x - the probability to find the disease, assuming the person is sick, is .95, if he is from group Y its .80. i want to know the joint probability: p(the person has the disease and tested sick)=P(D+,T+). my problem is how to write the conditional prob. Thanks for your help, also reference on this subject (binomial simulation) would be great. Sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulation-binomial
I have the probability: P(T+ / D+) i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have those probabilities. i dont know how to write this in R. something like this: (say p2 is the conditional prob. and p1 is the joint prob.) p2 - p1/.6 x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if (x) p2==0.95 if (y) p2==0.80 i don't know how to write the if condition. thank you for your reply, sigalit. On 8/8/07, Kyle Henderson [EMAIL PROTECTED] wrote: That depends on what you meant by writing the conditional probability. Bayes rule says that the probability of testing positive when one has the disease is calculated as follows: Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+) is that what you mean? Kyle H. Ambert Department of Behavioral Neuroscience Oregon Health Science University On 8/8/07, sigalit mangut-leiba [EMAIL PROTECTED] wrote: hello, i want to do a binomial simulation, by taking 200 var. from one group (x) and 300 from another (y). the prob. for disease=.6 in both groups. x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if the person is from group x - the probability to find the disease, assuming the person is sick, is .95, if he is from group Y its .80. i want to know the joint probability: p(the person has the disease and tested sick)=P(D+,T+). my problem is how to write the conditional prob. Thanks for your help, also reference on this subject (binomial simulation) would be great. Sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulation-binomial
Does this do what you want? x2 - rbinom( 200, 1, ifelse(x, .95, p1/.6) ) y2 - rbinom( 300, 1, ifelse(y, .8, p1/.6) ) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sigalit mangut-leiba Sent: Wednesday, August 08, 2007 11:18 AM To: r-help Subject: Re: [R] simulation-binomial I have the probability: P(T+ / D+) i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have those probabilities. i dont know how to write this in R. something like this: (say p2 is the conditional prob. and p1 is the joint prob.) p2 - p1/.6 x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if (x) p2==0.95 if (y) p2==0.80 i don't know how to write the if condition. thank you for your reply, sigalit. On 8/8/07, Kyle Henderson [EMAIL PROTECTED] wrote: That depends on what you meant by writing the conditional probability. Bayes rule says that the probability of testing positive when one has the disease is calculated as follows: Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+) is that what you mean? Kyle H. Ambert Department of Behavioral Neuroscience Oregon Health Science University On 8/8/07, sigalit mangut-leiba [EMAIL PROTECTED] wrote: hello, i want to do a binomial simulation, by taking 200 var. from one group (x) and 300 from another (y). the prob. for disease=.6 in both groups. x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if the person is from group x - the probability to find the disease, assuming the person is sick, is .95, if he is from group Y its .80. i want to know the joint probability: p(the person has the disease and tested sick)=P(D+,T+). my problem is how to write the conditional prob. Thanks for your help, also reference on this subject (binomial simulation) would be great. Sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org /posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] simulation-binomial
i will use that, thank you. sigalit. On 8/8/07, Greg Snow [EMAIL PROTECTED] wrote: Does this do what you want? x2 - rbinom( 200, 1, ifelse(x, .95, p1/.6) ) y2 - rbinom( 300, 1, ifelse(y, .8, p1/.6) ) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of sigalit mangut-leiba Sent: Wednesday, August 08, 2007 11:18 AM To: r-help Subject: Re: [R] simulation-binomial I have the probability: P(T+ / D+) i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have those probabilities. i dont know how to write this in R. something like this: (say p2 is the conditional prob. and p1 is the joint prob.) p2 - p1/.6 x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if (x) p2==0.95 if (y) p2==0.80 i don't know how to write the if condition. thank you for your reply, sigalit. On 8/8/07, Kyle Henderson [EMAIL PROTECTED] wrote: That depends on what you meant by writing the conditional probability. Bayes rule says that the probability of testing positive when one has the disease is calculated as follows: Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+) is that what you mean? Kyle H. Ambert Department of Behavioral Neuroscience Oregon Health Science University On 8/8/07, sigalit mangut-leiba [EMAIL PROTECTED] wrote: hello, i want to do a binomial simulation, by taking 200 var. from one group (x) and 300 from another (y). the prob. for disease=.6 in both groups. x - rbinom(200, 1, .6) y - rbinom(300, 1, .6) if the person is from group x - the probability to find the disease, assuming the person is sick, is .95, if he is from group Y its .80. i want to know the joint probability: p(the person has the disease and tested sick)=P(D+,T+). my problem is how to write the conditional prob. Thanks for your help, also reference on this subject (binomial simulation) would be great. Sigalit. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org /posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.