[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Roger Newson <roger.newson@kcl.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: product function |

Date |
Tue, 25 May 2004 18:06:01 +0100 |

At 11:43 25/05/04 -0500, Dimitriy V. Masterov wrote:

I would like to plot the probability that two people share a birthday as a function of the number of people in the room n. The formula is 1-product((366-i)/365,i,1,n) In TeX, it would be 1-\dprod\limits_{i=1}^{n}\frac{366-i}{365}. If I have a variable n={1,...,50}, how can I define the product within Stata? There does not seem to be math function that can do this.

One way might be to calculate logs and then to use the -sum()- function. Roger -- Roger Newson Lecturer in Medical Statistics Department of Public Health Sciences King's College London 5th Floor, Capital House 42 Weston Street London SE1 3QD United Kingdom Tel: 020 7848 6648 International +44 20 7848 6648 Fax: 020 7848 6620 International +44 20 7848 6620 or 020 7848 6605 International +44 20 7848 6605 Email: roger.newson@kcl.ac.uk Website: http://www.kcl-phs.org.uk/rogernewson Opinions expressed are those of the author, not the institution. * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: Re: multiple )))brackets, is there a more efficient way?***From:*David Kantor <dkantor@jhu.edu>

**st: product function***From:*"Dimitriy V. Masterov" <dvmaster@lily.src.uchicago.edu>

- Prev by Date:
**st: RE: product function** - Next by Date:
**st: RE: RE: product function** - Previous by thread:
**st: product function** - Next by thread:
**st: RE: common prefix to all variables** - Index(es):

© Copyright 1996–2014 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |