Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: problems with bootstrap

From   "Nick Cox" <>
To   <>
Subject   st: RE: problems with bootstrap
Date   Tue, 25 Nov 2003 18:00:34 -0000

> Im currently trying to simulate both means and medians
> using bootstrap in
> Stata version 7.  I need to generate a distribution of
> simulated means and
> medians.  I am trying to generate these for a variable
> called -ployalty- which
> has a range of 0-1.  The cluster variable, -clstr-, has a
> range of 1-5.  In
> short, I am trying to generate means and medians using one
> observation from
> each cluster.
> Here is the code that I used to try to simulate the means:
> bs  "summarize ployal" "r(mean)", reps (100) cluster
> (clster) saving (genmean)
> However, the new file genmean.dta has the same value, .745,
> for all 100 of the
> observations.  What am I doing wrong?

I can't reproduce this with

bs "summarize mpg" "r(mean)", reps(100) cluster(rep78) saving(genmean)

Something to do with the cluster variable?

> Also, when I try to run the simulation for medians using
> the following code:
> bs  "summarize ployal" "r(mean)", reps (100) cluster
> (clster) saving (genmed)
> The only value returned is no value, i.e. .  Any thoughts
> on what Iím doing wrong here?

I assume r(mean) is a typo here.

To get a median out of -summarize-, you must specify
the -detail- option.

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index