It seems that if we have an ixj matrix where joint density is evaluated
at the ith value of Y and the jth value of lambda, we should scoop over
*rows*, not columns, to get the marginal Y density:
E.g. if i have 10 values of Y, and 20 values of lambda (10x20 matrix),
the marginal density of Y should have 10 values, not 20 - i.e. summing
all lambda values for a given Y value would be summing over rows, right?
Stan
---------------
You are right that gamma is a continuous distribution. So, you have to
discretize it by creating a sequence of values for an appropriate range
of
lambda. Then, you can create a matrix (in R) where its i,j element
represents the joint density evaluated at the ith value of Y and the jth
value of lambda. Now, if you sum over the column (or "scoop" to use
Gary's
word), you will obtain the marginal density of Y. Is that clear now?
Kosuke
On Wed, 26 Feb 2003, Olivia Lau wrote:
I think that the confusion is this: If lambda is
distributed
according to the gamma (continuous) distribution, how can we
"construct a matrix"? Do you really want us to construct an
actual matrix (in R), for which (I think) we would need to
evaluate the poisson distribution at specific values of lambda,
or do you just want us to do it theoretically and integrate to
get the marginal density over some range of y?
Am I still lost?
Thanks, Olivia.
----- Original Message -----
From: "Kosuke Imai" <kimai(a)fas.harvard.edu>
To: <gov2001-l(a)fas.harvard.edu>
Sent: Wednesday, February 26, 2003 9:57 AM
Subject: [gov2001-l] Problem 4
A number of people have asked questions about
problem 4 last
night. Here
is a basic idea. You want to evaluate the
"joint" density with
different
values of y and lambda where y is poisson and
lambda is gamma.
This is the
joint density function, so you are not drawing
random
variables from any
distribution. you are simply evaluating the
height of the
density. To do
this, you need to create a matrix where its row
and column
represents y
and labmda, respectively. Then, to integrate out
lambda, you
want to sum
over the column. After normalizing it, this gives
you the
marginal
density of negative binomial.
Kosuke
_______________________________________________
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
_______________________________________________
gov2001-l mailing list
gov2001-l(a)fas.harvard.edu
http://www.fas.harvard.edu/mailman/listinfo/gov2001-l