Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Illustrate SRS in a graph


From   Richard Moverare <richard.moverare@gmail.com>
To   statalist <statalist@hsphsun2.harvard.edu>
Subject   st: Illustrate SRS in a graph
Date   Thu, 16 Sep 2010 23:43:41 +0200

Dear all,

I would like to illustrate the uncertainty of a SRS (without
replacement) by first creating a dataset with one variable that
identifies a number of different groups in the population (N), e.g.
415 units in group A, 634 units in group B, on so forth. Then I would
like to draw a number of samples from that population, e.g. 20
different samples and get estimates for the proportion of the
population belonging to group A, B, ..., and the confidence interval
(95 percent) for those estimates. And finally I would like to, in a
graph, illustrate the true population proportion and the 20 different
samples with their confidence intervals. This in order to illustrate
the uncertainty but also that the confidence interval sometimes do not
include the true population value.

I have done the first step by using -set obs- to set the population
size and using _n to divide that population into a number of groups,
but I think it should be possible to do this in a better way. I have
done the second step for a single sample using -sample- but I have not
found a good solution for getting a number of samples and proportion
estimates into a single dataset.

Does anyone of you done anything similar or know of somewhere this is
done? Or can you help me in some way, or just point in some direction?

Any help would be greatly appreciated,
All the best,
Richard Moverare
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index