Hello, all. I just had my vnc session terminated. Does anyone remember
how I go about reconstructing my session, and where I type "nice +10"
once I do? Thanks in advance...
Ryan
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
By the joint density, I mean P(Y, lambda|gamma, mu), which is equal to
P(Y|lambda)P(lambda|gamma, mu) by the law of conditional probability.
P(Y|lambda) is the poisson distribution and P(lambda|gamma,mu) is the
gamma distribution. You need to write down this equation in your answer,
and in your computer program you have to evaluate this density function at
different values of Y and lambda. The goal is to obtain P(Y|gamma, mu) by
the grid method, which is equal to \int_0^{\infty} p(Y, lambda|gamma, mu)
d lambda. Compare your numerical approximation with the true marginal
density which appears on page 53 of the lecture notes.
Kosuke
---------- Forwarded message ----------
Date: Wed, 26 Feb 2003 11:07:12 -0500 (EST)
To: Kosuke Imai <kimai(a)fas.harvard.edu>
Subject: Re: [gov2001-l] Problem 4
when you say joint density, do you mean we pick a lamda from the gamma
function and then pick y from the poisson with that lamda. that gives us
one column in the matrix. is this right?
On Wed, 26 Feb 2003, Kosuke Imai wrote:
> 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
>
does anyone know how to do it?
I think it's sth like:
gozzila ???
any idea?
yongwook
-----------------------------
Yongwook Ryu
PhD Student
Department of Government
Harvard University
Tel:617-493-3397
Email: yryu(a)fas.harvard.edu
-----------------------------
Guys,
How do the "shape" and "scale" parameters work for rgamma? I want to use
rgamma() to get my lamdas for the poisson distribution in question 4.
Thanks,
Olivia.
If I have an m x n matrix and want to sum over the columns onto each row in
the matrix I know I can do this one row at a time, but I don't have time for
this--I got shit to do. So I'd like to do this for the whole matrix at once.
Anyone know how to do that?
John.
This is a multi-part message in MIME format.
------=_NextPart_000_059D_01C2DD32.82DF49D0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
When I try to make my graphs into postscript files using the =
postscript() command in R, they are coming out sideways... does anyone =
know how to fix that?
-Ryan
------=_NextPart_000_059D_01C2DD32.82DF49D0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>When I try to make my graphs into =
postscript files=20
using the postscript() command in R, they are coming out sideways... =
does anyone=20
know how to fix that?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>-Ryan</FONT></DIV></BODY></HTML>
------=_NextPart_000_059D_01C2DD32.82DF49D0--
Hello all,
Can anyone tell me how to extract a row or a column from a matrix? For
instance, if I had a 10*4 matrix and wanted to create a vector containing
only the 10 elements from the second column, what command(s) would I use?
Thanks,
Adam
does anyone know how to tansfer histograms from R to Latex? What are the
commands that i have to enter?
Gov 2001 will be keeping me company through the night.
cheers,
yongwook
-----------------------------
Yongwook Ryu
PhD Student
Department of Government
Harvard University
Tel:617-493-3397
Email: yryu(a)fas.harvard.edu
-----------------------------
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.
On the beta binomial distribution, are there boundaries for
gamma and mu in the alternative parametization? For example, I
plugged in something greater than 1 for gamma, and I got a
negative beta...and NAs for my beta distribution of pies. 8(
Thanks, Olivia.