# R: st: probability mass function for a binomial distribution

 From "Carlo Lazzaro" To Subject R: st: probability mass function for a binomial distribution Date Sun, 29 Jun 2008 16:52:02 +0200

```Dear Statalisters,

I have probably found out the answer to my last Friday thread.
I do hope this may be useful for someone else on the list.
However, a little concern remains about the lack among Stata 9.2/SE commands
of an in-built for calculating the (probably too trivial) probability mass
function for a binomial distribution, which is instead available within the
One more time, my grateful thought go out to Steve and Nick (in order of
appearance in my incoming e-mail folder) for pointing me out the importance
of a step-by-step research in dealing with Stata troubles.

Kind Regards and enjoy your Sunday,
Carlo

---------------------------begin example-------------------------
set obs 21
g id=_n-1
g n=20
g k=_n-1
g p=.2
g Binomial=Binomial( n, k, p)
g PMF_Binomial=1- Binomial if id==20
replace PMF_Binomial=Binomial[_n]- Binomial[_n+1] in 1/20
--------------------------end example----------------------------
-----Messaggio originale-----
Da: Carlo Lazzaro [mailto:carlo.lazzaro@tin.it]
Inviato: venerd́ 27 giugno 2008 18.52
A: 'statalist@hsphsun2.harvard.edu'
Oggetto: st: mass probability function for a binomial distribution

Dear Statalisters,
since my previous research in the FAQs was unsuccessful, I would like to
know whether is there a way to obtain the mass probability function for a
binomial distribution (n 20; k=4; p=.2) with Stata 9/2 SE.

Kind Regards,

Carlo

*
*   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/
```