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)]
	sum `varlist'  [`weight']
        return scalar mean = r(mean)

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

Thank you,

*   For searches and help try:

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