beta dist is continuous, so it will be an approximation. however, in the
case of binomial, it is exact since we know that y takes the values of
0,...,N.
Kosuke
On Tue, 25 Feb 2003, John Bright wrote:
I should say the example below is more appropriate for
the beta
distribution, since it is bound with values in the range [0,1]. Thanks.
On 2/25/03 9:39 AM, "Kosuke Imai" <kimai(a)fas.harvard.edu> wrote:
This works in the case of binomial because Y
takes a finite range of
discrete values. You could think of this as an inverse CDF method.
Kosuke
On Tue, 25 Feb 2003, John Bright wrote:
Gary presented two methods for drawing random
numbers from any given
probability distribution in class yesterday. I am using a different method
and I want to make sure this is OK and if there are limitations to what I am
doing.
I believe I am essentially doing a version of the discretization method.
That is, I define a vector Y of possible draws from the distribution--for
example, with the binomial it will be something like Y<-(0:100)/100 (I'm not
sure if there is an easier way to make a vector of elements
[0,.01,.02,...1]). Then, I create a vector D of normalized weights
(sum(D)=1) (I think it is equivalent to the discretized probability
distribution) for each possible draw from the distribution. I then use
sample() to draw from Y as weighted by D.
I think the following is the "bridge" between what I am doing above and
Gary's discretization method: It seems like sample() is doing the equivalent
of mapping my discretized probability distribution to [0,1] and then drawing
a random number from [0,1] and subsequently returning the draw indexed by
that random number from [0,1].
Does this make sense?
Thanks,
John.
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l