# Re: st: RE: RE: probability question

 From dr kardos laszlo To statalist@hsphsun2.harvard.edu Subject Re: st: RE: RE: probability question Date Thu, 29 Oct 2009 11:41:38 +0100

```hi all,

```
this also works out as the number of ways you can pick 4 out of 116 (non-hat rainy days) times n.o.w you can pick 3 out of 4 (hat-wearing rainy days) divided by n.o.w you can pick 7 out of 120 (all possibilities):
```
. di comb(116,4)*comb(4,3)/comb(120,7)
.00048146

laszlo

Richard Goldstein wrote:
```
```thank you -- that's quite interesting and means I did not think things
through sufficiently when I replied to Paul -- sorry about that

Edgar Munoz wrote:
```
```I like this approach using tabi as a calculator for this.

r(p_exact) is P(n11 >= 3), the p-value in the Fisher's exact test

if we calculate P(n11 >= 4), we can obtain P(n11 = 3) by difference

. tabi 4 0 \ 3 113, exact

|          col
row |         1          2 |     Total
-----------+----------------------+----------
```
1 | 4 0 | 4 2 | 3 113 | 116 -----------+----------------------+---------- Total | 7 113 | 120
```           Fisher's exact =                 0.000
1-sided Fisher's exact =                 0.000

. return list

scalars:
r(p1_exact) =  4.26072210718e-06
r(p_exact) =  4.26072210718e-06
r(c) =  2
r(r) =  2
r(N) =  120

|  p3exact     p3plus     p4plus |
|--------------------------------|
1. | .0004815   .0004857   4.26e-06 |

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Visintainer PhD,
Paul
Sent: Wednesday, October 28, 2009 7:49 AM
To: 'statalist@hsphsun2.harvard.edu'
Subject: st: RE: probability question

I'm probably thinking of this too simplistically, but wouldn't this just be
a Fisher's exact test?

. tabi 3 1 \ 4 112, exact   /* where col = rain and row = hat */

|          col
row |         1          2 |     Total
-----------+----------------------+----------
```
1 | 3 1 | 4 2 | 4 112 | 116 -----------+----------------------+---------- Total | 7 113 | 120
```           Fisher's exact =                 0.000
1-sided Fisher's exact =                 0.000

. return list

scalars:
r(p1_exact) =  .0004857223202188
r(p_exact) =  .0004857223202188
r(c) =  2
r(r) =  2
r(N) =  120

___________________________________
Paul F. Visintainer, PhD

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Richard Goldstein
Sent: Wednesday, October 28, 2009 8:38 AM
To: statalist
Subject: st: probability question

it's been a long time since I thought about questions like this, but, as
a lead-in to a study, a client has asked the following question which he
thinks he understands and says is related to where he wants to go:

during a consecutive period of 120 days, if it rains on 7 days and my
client wears a hat on 4 days (these are independent of any knowledge of
the weather), what is the probability that it will rain on 3 of the days
on which he is wearing a hat?

my client swears that this is not a homework problem for him or his wife
or one of their kids!

Rich
```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```