Statalist


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

st: RE: bootstrap sampling and foreach


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: bootstrap sampling and foreach
Date   Thu, 20 Aug 2009 00:09:31 +0200

<>

What is your intent in the second line of the first loop? Are you checking
whether `x' is part of the " analytes_bootstrap "? If so, the returned
result is either 0 or 1...

The second loop would not receive all the results from the first loop, only
the last one. Note that the results displayed by - estat bootstrap, all- are
already there after the -bootstrap- command:


****
clear*
set obs 10000
gen x=rnormal()
	bs r(p95), reps(100): /*
 */su x, d

eret li

mat l e(ci_normal)
mat l e(ci_percentile)
mat l e(ci_bc)
****

If all you want is to store them, you could take it from here without
actually displaying them...

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Gallagher, Kelly,
DOH
Sent: Mittwoch, 19. August 2009 23:46
To: statalist@hsphsun2.harvard.edu
Subject: st: bootstrap sampling and foreach

Hi, all, 

Using -bootstrap-, I'd like to estimate confidence intervals for
percentiles.  Also, given that I'd like to estimate C.I.s for
percentiles for a heap of variables, I'd like to use a foreach loop.

Do you have tips regarding the use of the foreach loop to save a scalar
or matrix of bootstrapped samples (which would then be used with
-estat-)?


foreach x of varlist *_u {
	bootstrap r(p95), reps(1000): summarize `x', detail
    	local analytes_bootstrap: list x in analytes_bootstrap
     	return scalar `x'=`analytes_bootstrap'
 }

foreach x of varlist *_u {
estat bootstrap, all
        }


Thanks!!!
Kelly


Kelly Gwendolyn Gallagher, Ph.D.
Epidemiologist
Environmental Health Epidemiology Bureau
Epidemiology and Response Division
New Mexico Department of Health
1190 St. Francis Dr.
Santa Fe, NM  87502
505.476.3565




Confidentiality Notice: This e-mail, including all attachments is for the
sole use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review, use, disclosure or
distribution is prohibited unless specifically provided under the New Mexico
Inspection of Public Records Act. If you are not the intended recipient,
please contact the sender and destroy all copies of this message. -- This
email has been scanned by the Sybari - Antigen Email System. 




Confidentiality Notice: This e-mail,including all attachments is for the
sole use of the intended recipient(s) and may contain confidential and
privileged information. Any unauthorized review,use,disclosure or
distribution is prohibited unless specifically provided under the New Mexico
Inspection of Public Records Act. If you are not the intended recipient,
please contact the sender and destroy all copies of this message.  -- This
email has been scanned by the MessageLabs Email Security System.

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


*
*   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   |   What's new   |   Site index