Statalist


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

R: st: probability mass function for a binomial distribution


From   "Carlo Lazzaro" <[email protected]>
To   <[email protected]>
Subject   R: st: probability mass function for a binomial distribution
Date   Sun, 29 Jun 2008 19:10:44 +0200

Dear Nick,
thanks a lot for making it simpler than I was figured out it to be.

I agree with you about the theoretical endless row of defined functions
which may be included in a statistical package: a reasonable compromise
between users'neeeds and their statistical background is the way to go for
delivering an effective and efficient software.

Kind Regards,

Carlo

-----Messaggio originale-----
Da: [email protected]
[mailto:[email protected]] Per conto di Nick Cox
Inviato: domenica 29 giugno 2008 17.27
A: [email protected]
Oggetto: RE: st: probability mass function for a binomial distribution

What is available as a defined function shows up a trade-off problem. It
wouldn't be difficult to define a thousand functions, but then some
people might complain about the complexity of the list and the
difficulty of finding a solution. 

Otherwise put, I guess the answer to Carlo's question is that Stata
users -- unlike spreadsheet users, it seems --- are paid the compliment
of knowing enough statistics to work this out from first principles: 

gen double bmp = p^k * (1 - p)^(20 - k) * comb(20, k)

Note in passing two other details: 

I prefer to use -double-s here. 

Putting constants into variables isn't necessary:  

gen double bmp = 0.2^k * 0.8^(20 - k) * comb(20, k)

In cases like this the advantage of a canned function over a one-line
solution using another canned function would be pretty small. 

Nick
[email protected] 

[previous message deleted to avoid Buffer overrun warning]



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



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