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

st: bootstrap within the command

From   Le Wang <[email protected]>
To   [email protected]
Subject   st: bootstrap within the command
Date   Sun, 6 Sep 2009 20:06:59 -0400

Hi there,

Thanks in advance for your time.

I have a question regarding the reproducibility of the results for the
programs with a bootstrap command inside.

To be concrete, I was using Scott Merryman's cqreg2 (below are the
codes copied from

The program calls -bsqreg- to obtain s.e.. However, every time running
the program gives (slightly) different results. Adding "set seed ####"
into the program itself doesn't seem to help. I was wondering what
could we do in this situation. I'd appreciate your help.


*!1.0.0 June 1, 2006 Scott Merryman
program cqreg2
version 9.2
	syntax varlist(min=1) [if] [, Quantile(real 0.5)  ll(real 0) bs
reps(integer  100) save(string) grqreg]

tempvar yhat
tokenize `varlist'
local lhs "`1'"
mac shift
local rhs "`*'"
qui {
qreg `lhs' `rhs' `if', q(`quantile')

predict `yhat'
sum `hat'
tempvar tag
while  r(min) < `ll' {
	keep if  `yhat' >= `ll'
	qui qreg `lhs' `rhs' `if', quantile(`quantile' )
	qui drop `yhat'
	predict `yhat' if e(sample)
	qui sum `yhat' if e(sample)
if "`bs'" == "bs" {
	bsqreg `lhs' `rhs' `if', quantile(`quantile' ) reps(`reps')
else {
if "`grqreg'" != "" {
	grqreg, ci
if "`save'" != "" {
	disp ""
	save "`save'", replace




Le Wang, Ph.D
Assistant Professor
Department of Economics
University of New Hampshire
*   For searches and help try:

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