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

Re: RE: st: bootstrap weighted mean


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: RE: st: bootstrap weighted mean
Date   Thu, 13 Jan 2005 09:45:10 -0600

Scott Merryman <[email protected]> is concerned about performing a weighted
bootstrap:

> My concern is that is seems too easy to get around the weight
> restriction in -bootstrap- and therefore must be wrong. 
> 
> Searching through the Statalist achieves I came across a posting by Jeff
> Pitblado ( http://www.stata.com/statalist/archive/2004-03/msg00894.html ) on
> using a very similar trick to get -statsby- to accept weights.  At the end,
> he cautions, 
> 
> 	"As a final note, let me just warn against using this trick with -
> bootstrap-,-permute-, and -jknife-.  The result will most definitely 	not
> be what you would expect."
> 
> I guess I don't understand bootstrapping well enough to understand why this
> trick does not work as expected.

If we are talking about "aweights", then I am willing to relax this warning
for -bootstrap- but am not so sure for -jknife- and -permute-.

However, do not try this trick with "fweights", you will definitely get the
wrong standard error estimates.  I've included the contents of a simple
do-file that illustrates why you do not want to use this trick with
-bootstrap-.  If you run this example, you will notice that the standard error
estimates are 2 or more times that of the estimates from an appropriate
analysis.  This implications for this example extent to -jknife- and -permute-
also.

The -bootstrap- and -jknife- commands need new features in order to handle
"pweights" (and "iweights") correctly.

My "final note" was an attempt to encourage Stata users to do their homework
before using this trick in order to make sure they will get what they expect.

***** BEGIN:
cscript
version 8.2

program mysum
	version 8.2
	syntax varname [if] [in] [, Weight(string) * ]
	if "`weight'" != "" {
		local wt [fw=`weight']
	}
	summarize `varlist' `if' `in' `wt', `options'
end

set seed 1234
sysuse auto, clear
ci turn [fw=3]
bootstrap "mysum turn, w(3)" r(mean), reps(1000) nowarn
expand 3
bootstrap "sum turn" r(mean), reps(1000) nowarn

set seed 1234
sysuse auto, clear
ci turn [fw=trunk]
bootstrap "mysum turn, w(trunk)" r(mean), reps(1000) nowarn
expand trunk
bootstrap "sum turn" r(mean), reps(1000) nowarn
***** END:

--Jeff
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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