Woops. Sorry, Professor Feller!
. set obs 50
. gen i = _n
. gen double p = 1 - 1/365
. replace p = p[_n - 1] * (1 - _n / 365) in 2/l
. replace p = 1 - p
. scatter p i
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 25 May 2004 17:56
> To: [email protected]
> Subject: st: RE: product function
>
>
> You don't need a built-in. This is one way of doing it.
>
> . set obs 50
> . gen i = _n
> . gen double p = 1 - 1/365
> . replace p = p[_n - 1] * (1 - _n / 365) in 2/l
> . scatter p i
>
> Nick
> [email protected]
>
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]]On Behalf Of
> Dimitriy V.
> > Masterov
> > Sent: 25 May 2004 17:43
> > To: [email protected]
> > Subject: st: product function
> >
> >
> > 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.
> >
> > DVM
> >
> >
> > ______________________________________________________________
> > _________________
> > Dimitriy V. Masterov
> >
> > Work:
> > Center for Social Program Evaluation
> > 1155 East 60th St. Room 038
> > Chicago, IL 60637
> > Work: (773)256-6005
> > Fax: (773)256-6313
> >
> > Home:
> > 1312 East 53rd St., Apt.309
> > Chicago, IL 60615
> > Mobile: (773)220-2760
> >
> >
> > *
> > * 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/
> >
>
> *
> * 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/
>
*
* 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/