Statalist The Stata Listserver


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

st: RE: Simple Question - Sampling from a Binomial distribution


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Simple Question - Sampling from a Binomial distribution
Date   Thu, 10 May 2007 18:08:50 +0200

--- [email protected] wrote:
> My simple question is as follows:
> Suppose I have two variables called "n" and "p" (2 observations each), say:
> n        p
> 452        0.25
> 125        0.62
> 
> In this respect, my objective is to generate a third variable called, "c" as:
>
> c ~ binomial (p�i�, n[i]), where i = 1,and 2(rows). The result
> would look like this:
> 
> n        p        c
> 452        0.25        c1
> 125        0.62        c5
> 
> where:
> c1 ~ bin (0.25, 452)
> c5 ~ bin (0.62, 125)
> 
> Hence, is there a straighforward way to obtain these results with a simple
> command? I will be extremely grateful for any help again.

Nick and I had trouble posting my answer to statalist, so I answered 
Tiago privately. I've written a more general answer and put it on my 
website:

http://home.fsw.vu.nl/m.buis/wp/discrete.html


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------



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