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

Re: st: {Spam?} Storing results from replications


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: {Spam?} Storing results from replications
Date   Thu, 01 Sep 2005 14:19:11 -0500

Benoit Laplante <[email protected]> has bootstrap replicate weight
variables and asks how to generate a dataset for use with -bstat-:

> I use data from complex surveys that are distributed with bootstrap weights
> (actually, mean bootstrap weights, but this is not the issue). 
> 
> In need to compute a variance matrix based on the deviation from the
> averaged bootstrap coefficients. Given that I do not know the averaged
> coefficients until I have performed all the relevant replications, I cannot
> accumulate variance. Thus I need to store the elements of the numerous e(b)
> somewhere until I process them with -bstat- or something similar.
> 
> The number of elements of e(b) as well as the column names differ for each
> analysis.
> 
> The number of covariates may reach a few dozens and the number of
> replications may reach 1000. Given the size, appending each e(b) in a matrix
> does not seem to be a workable solution.
> 
> -post- requires expressions enclosed in parentheses. I can extract the
> column names from e(b), but I cannot see how to turn the content of e(b)
> into anything palatable for -post-.

When I first read this email, I wrote an example do-file to illustrate how to
use -post- with some new "undocumented" Stata 9 programmer tools (see -help
_prefix-).  Just before I send the reply out, I decided it would be better if
I just wrote an UNofficial version of -bootstrap- that took replicate weight
variables instead of using -bsample- to generate the bootstrap replicates.

The UNofficial prefix command is -bs4rw-.  Those interested in testing it out
can download it from my user site at stata.com:

	. net from http://www.stata.com/users/jpitblado
	. net d bs4rw
	. net install bs4rw

I've written a short certification script for -bs4rw-.  It merely verifies
that -bs4rw- can reproduce the -e(V)- from -bootstrap- when given the
appropriate replicate weight variables (assuming a given seed).  This
certification script can also be downloaded:

	. net get bs4rw

I've only just started looking into the survey literature regarding the
Bootstrap, so I'm not sure how useful -bs4rw- will be for different methods
that generate bootstrap replicate weight variables.  The idea behind -bs4rw-
is to call the prefixed command using each supplied replicate weight variable,
save the point estimates to a (temporary) data file, then use the standard
formulas (see [R] bootstrap) for computing the variance matrix.

--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