Yes, you are correct. What we want for Problem 3 is to see how well SSLN
and CLT hold in finite samples. For Prob 3b, we are interested in how well
sample mean can approximate true mean in different sample sizes. So, you
want many simulations with different sample sizes: use a graph if you can.
Kosuke
---------- Forwarded message ----------
Date: Mon, 24 Feb 2003 21:53:59 -0500
To: kimai(a)fas.harvard.edu
Subject: Re: [gov2001-l] CLT (fwd)
Hi Kosuke,
One more question re: the binomial now that I've written my code & it seems
to work OK. I may be using the wrong verbiage, but I want to make sure
that, at a minimum, I have the concepts down. Is the following correct?:
A single random draw from the binomial distribution will return, for N
trials and given a probability pi, the number of successes for that random
draw. So, for each draw, there are N trials.
An experiment (or simulation, or whatever it should be called) simulates
multiple draws (N trials each) from the binomial. So, for instance, I
might run three experiments, one of which simulates 10 draws of N trials,
the second of which simulates 50 draws of N trials, and the third of which
simulates 100 draws of N trials (with N being held constant across the
three experiments). If I conduct enough of these experiments, I can test
to see whether the SLLN holds.
So, in other words, it is my understanding that an experiment consists of
multiple draws, that a draw consists of multiple trials, and that, to test
the SLLN, we should be conducting several different experiments (such that
each successive experiment consists of more draws than the one before, but
with the number of trials being held constant across draws/experiments).
To do this, I've used two loops in my code. This all seems logical to me,
and my output looks right, but I wanted to make sure that I'm thinking
about this correctly before I finish it.
Thanks.
if z is a vector, yes. but if z is a scalar, it's just a normal dist.
remember, you need to let z vary for each draw.
Kosuke
> I am confused. Doesn't the following line draw 1000 numbers from the T
> distribution:
>
> y <- rnorm(1000, mean = 0, sd = sqrt(1/z))
>
that's one way. you could also use a quantile-quantile plot.
Kosuke
---------- Forwarded message ----------
Date: Mon, 24 Feb 2003 18:45:58 -0500
From: Ryan Davies <rdavies(a)fas.harvard.edu>
To: Kosuke Imai <kimai(a)fas.harvard.edu>
Subject: CLT
How do we verify that we're getting the CLT in 3a? Should we plot a
histogram vs. the standard normal distribution or something?
-Ryan
Hello, all.
Does anyone know how to paste a string of text WITHIN a figure's label?
For example, to paste the number n within the quotation marks of the plot
argument {main = "Here's main label number n"}?
Thanks!
Ryan
------------------------------------------
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
you don't need rbinom in 2a. sorry. it was my typo.
Kosuke
---------- Forwarded message ----------
Date: Sun, 23 Feb 2003 22:16:34 -0500
From: Ryan Davies <rdavies(a)fas.harvard.edu>
To: Kosuke Imai <kimai(a)fas.harvard.edu>
Subject: Re: [gov2001-l] 2c question
Yeah, but I'm not sure where we'd use rbinom in 2a.
----- Original Message -----
From: "Kosuke Imai" <kimai(a)fas.harvard.edu>
To: "Ryan Davies" <rdavies(a)fas.harvard.edu>
Sent: Sunday, February 23, 2003 10:12 PM
Subject: Re: [gov2001-l] 2c question
> you can use dbinom but not rbinom. of course, if you have already written
> your own dbinom, that's fine too: it's just one line function. you also
> cannot use rt. is that clear?
>
> Kosuke
>
> On Sun, 23 Feb 2003, Ryan Davies wrote:
>
> > Do you mean that we can't use dbinom() either, for 2a?
> >
> > -Ryan
> >
> > ----- Original Message -----
> > From: "Kosuke Imai" <kimai(a)fas.harvard.edu>
> > To: "Phillip Y. Lipscy" <lipscy(a)fas.harvard.edu>
> > Cc: "Gov 2001" <gov2001-l(a)fas.harvard.edu>
> > Sent: Sunday, February 23, 2003 8:41 PM
> > Subject: Re: [gov2001-l] 2c question
> >
> >
> > > Here are some clarification as to what built-in functions you can and
> > > cannot use. basically, you shouldn't use rbinom and rt.
> > >
> > > 2a. write your own function. don't use rbinom
> > >
> > > 2b. don't use dbeta.
> > >
> > > 2c. you can use rbeta and the function you wrote in 2a. don't use
rbinom
> > >
> > > 3a. write your own function. don't use rt
> > >
> > > 3b. you can use the function you wrote in 2a. don't use rbinom
> > >
> > > Kosuke
> > >
> > > On Sun, 23 Feb 2003, Phillip Y. Lipscy wrote:
> > >
> > > > We're running into trouble with taking draws from the beta
distribution
> > on 2c.
> > > > Our function for 2b gives us nice looking curves, but when alpha &
beta
> > < 1,
> > > > the curve goes to infinity at the extremes. So when we take draws
from
> > the
> > > > beta distribution, how are we to weigh the probability of those
infinite
> > > > extremes? rbeta() seems to give a result consistent with the shape
of
> > the
> > > > curves - i.e.
> > > >
> > > > for (alpha & beta = really small) --> returns 0 and 1s
> > > > for (alpha & beta = really big) --> returns values very close to 0.5
> > > >
> > > > Or, basically, is there a forumla for the probability mass function
for
> > a beta
> > > > distribution?
> > > >
> > > > Thanks,
> > > > Phillip
> > > >
> > > > -------------------------------------------------
> > > > Phillip Y. Lipscy
> > > > Perkins Hall Room #129
> > > > 35 Oxford Street
> > > > Cambridge, MA 02138
> > > > (617)493-4893 DORM
> > > > (617)851-8220 CELL
> > > > lipscy(a)fas.harvard.edu
> > > > http://www.people.fas.harvard.edu/~lipscy/
> > > >
> > > > First Year Student, Ph.D. Program
> > > > Harvard University, FAS, Department of Government
> > > > -------------------------------------------------
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > >
> >
>
you can use dbinom but not rbinom. of course, if you have already written
your own dbinom, that's fine too: it's just one line function. you also
cannot use rt. is that clear?
Kosuke
On Sun, 23 Feb 2003, Ryan Davies wrote:
> Do you mean that we can't use dbinom() either, for 2a?
>
> -Ryan
>
> ----- Original Message -----
> From: "Kosuke Imai" <kimai(a)fas.harvard.edu>
> To: "Phillip Y. Lipscy" <lipscy(a)fas.harvard.edu>
> Cc: "Gov 2001" <gov2001-l(a)fas.harvard.edu>
> Sent: Sunday, February 23, 2003 8:41 PM
> Subject: Re: [gov2001-l] 2c question
>
>
> > Here are some clarification as to what built-in functions you can and
> > cannot use. basically, you shouldn't use rbinom and rt.
> >
> > 2a. write your own function. don't use rbinom
> >
> > 2b. don't use dbeta.
> >
> > 2c. you can use rbeta and the function you wrote in 2a. don't use rbinom
> >
> > 3a. write your own function. don't use rt
> >
> > 3b. you can use the function you wrote in 2a. don't use rbinom
> >
> > Kosuke
> >
> > On Sun, 23 Feb 2003, Phillip Y. Lipscy wrote:
> >
> > > We're running into trouble with taking draws from the beta distribution
> on 2c.
> > > Our function for 2b gives us nice looking curves, but when alpha & beta
> < 1,
> > > the curve goes to infinity at the extremes. So when we take draws from
> the
> > > beta distribution, how are we to weigh the probability of those infinite
> > > extremes? rbeta() seems to give a result consistent with the shape of
> the
> > > curves - i.e.
> > >
> > > for (alpha & beta = really small) --> returns 0 and 1s
> > > for (alpha & beta = really big) --> returns values very close to 0.5
> > >
> > > Or, basically, is there a forumla for the probability mass function for
> a beta
> > > distribution?
> > >
> > > Thanks,
> > > Phillip
> > >
> > > -------------------------------------------------
> > > Phillip Y. Lipscy
> > > Perkins Hall Room #129
> > > 35 Oxford Street
> > > Cambridge, MA 02138
> > > (617)493-4893 DORM
> > > (617)851-8220 CELL
> > > lipscy(a)fas.harvard.edu
> > > http://www.people.fas.harvard.edu/~lipscy/
> > >
> > > First Year Student, Ph.D. Program
> > > Harvard University, FAS, Department of Government
> > > -------------------------------------------------
> > >
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > 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
> >
>
So, is the idea that pi is different for each of the N Bernoulli variables
that constitute one draw from the beta-binomial, or that pi is different
for each draw (i.e. the same for the Bernoullis in a given draw but
different across the draws).
Thanks,
Nirmala
Kosuke,
I'm confused.
This is how I thought one sampled/drew from the beta-binomial distribution:
First, I thought the wording would be "take N (i.i.d.) draws from the
beta-binomial distribution with parameters mu and gamma". To do this, I
thought you "take" N Bernoulli draws with pi changing with each draw. Pi
changes by sampling from the beta distribution. So, for each Bernoulli trial
(with varying pi), you get either a 0 or 1 as the outcome. Therefore, to get
the result of taking N draws from the beta-binomial distribution, you add up
your N 0's or 1's from each Bernoulli trial. Thus, the result of N
beta-binomial draws will be somewhere between 0 and N.
This is what I thought, but I have found that not to be the only
interpretation of how the beta-binomial distribution works.
Can you help clear up this confusion.
Thanks,
John.
>===== Original Message From Kosuke Imai <kimai(a)fas.harvard.edu> =====
>Don't confuse random variables with their density functions. a beta random
>variable ranges between 0 and 1, while a beta density function can take a
>value that is greater than 1.
>
>Kosuke
>
>On Sun, 23 Feb 2003 dhopkins(a)fas.harvard.edu wrote:
>
>> Dear All,
>>
>> In the first stage of a beta binomial, we select a Pi_j from a beta
binomial
>> distribution, having set our parameters (gamma and mu, although they could
be
>> alternately specified as alpha and beta). But what confuses me is the fact
>> that many beta distributions have values of P(y) that are larger than 1,
>> meaning they cannot be a probability. How, then, can we select a
probability
>> from the beta distribution--should we use P(y) to weight the probability
with
>> which we will select a value between 0 and 1?
>>
>> Best,
>> Dan
>>
>>
>>
>> _______________________________________________
>> 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
don't use rbinom throughout this assignment. we want you to get a good
sense of how hierarchical modeling can be done using two distributions.
Kosuke
On Sun, 23 Feb 2003, Chester Lee wrote:
> For 2a, what people need to write is dbinom, not rbinom...
> So I wrote my function for dbinom and drew the pmf. Didn't need to
> write rbinom...
>
> So can I just use rbinom for 2c?
>
>
>
>
> On Sunday, February 23, 2003, at 08:41 PM, Kosuke Imai wrote:
>
> > Here are some clarification as to what built-in functions you can and
> > cannot use. basically, you shouldn't use rbinom and rt.
> >
> > 2a. write your own function. don't use rbinom
> >
> > 2b. don't use dbeta.
> >
> > 2c. you can use rbeta and the function you wrote in 2a. don't use
> > rbinom
> >
> > 3a. write your own function. don't use rt
> >
> > 3b. you can use the function you wrote in 2a. don't use rbinom
> >
> > Kosuke
> >
> > On Sun, 23 Feb 2003, Phillip Y. Lipscy wrote:
> >
> >> We're running into trouble with taking draws from the beta
> >> distribution on 2c.
> >> Our function for 2b gives us nice looking curves, but when alpha &
> >> beta < 1,
> >> the curve goes to infinity at the extremes. So when we take draws
> >> from the
> >> beta distribution, how are we to weigh the probability of those
> >> infinite
> >> extremes? rbeta() seems to give a result consistent with the shape
> >> of the
> >> curves - i.e.
> >>
> >> for (alpha & beta = really small) --> returns 0 and 1s
> >> for (alpha & beta = really big) --> returns values very close to 0.5
> >>
> >> Or, basically, is there a forumla for the probability mass function
> >> for a beta
> >> distribution?
> >>
> >> Thanks,
> >> Phillip
> >>
> >> -------------------------------------------------
> >> Phillip Y. Lipscy
> >> Perkins Hall Room #129
> >> 35 Oxford Street
> >> Cambridge, MA 02138
> >> (617)493-4893 DORM
> >> (617)851-8220 CELL
> >> lipscy(a)fas.harvard.edu
> >> http://www.people.fas.harvard.edu/~lipscy/
> >>
> >> First Year Student, Ph.D. Program
> >> Harvard University, FAS, Department of Government
> >> -------------------------------------------------
> >>
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> 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
>
Dear All,
In the first stage of a beta binomial, we select a Pi_j from a beta binomial
distribution, having set our parameters (gamma and mu, although they could be
alternately specified as alpha and beta). But what confuses me is the fact
that many beta distributions have values of P(y) that are larger than 1,
meaning they cannot be a probability. How, then, can we select a probability
from the beta distribution--should we use P(y) to weight the probability with
which we will select a value between 0 and 1?
Best,
Dan