Statalist The Stata Listserver


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

st: Simple Question - Sampling from a Binomial distribution


From   [email protected]
To   [email protected]
Subject   st: Simple Question - Sampling from a Binomial distribution
Date   Tue, 8 May 2007 13:59:51 -0300 (BRT)

Dear Statalisters,

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.

Best regards,

Tiago






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