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

st: bootstrap weighted mean


From   [email protected]
To   [email protected]
Subject   st: bootstrap weighted mean
Date   Tue, 11 Jan 2005 11:15:57 -0600

I know that Stata's -bootstrap- command will not calculate a bootstrap weighted mean:

. bootstrap "sum loss_ratio [aw= premium]" r(mean), rep(100)
weights not allowed


However, is it possible to get around this by making repeated calls to -bsample-?
Will the following -simulate- program work or is it committing a sin and only 
returning garbage?

program bst_mean, rclass
	syntax varlist ,[ weight(string)]
	preserve
	bsample
	sum `varlist'  [`weight']
        return scalar mean = r(mean)
	restore
end

simulate "bst_mean loss_ratio, weight(aw =premium)" mean= r(mean), rep(100)

Thank you,
Scott


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