Statalist


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

Re: st: Block bootstrapping in quantile regression


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Block bootstrapping in quantile regression
Date   Mon, 16 Nov 2009 21:05:52 -0500

clear all
program iqr, eclass
version 10.1
 if replay() {
  syntax [anything] [, Level(real 95) ]
  eret di, level(`level')
  }
 else {
 qui {
syntax [varlist] [, Q1(real .25) Q2(real 0.75) Level(real 95) *]
gettoken depv vl:varlist
tempname b1 b2 beta
qreg `depv' `vl', quantile(`q1') `options'
matrix `b1'=e(b)
tempvar e1 e2
g `e1'=e(sample)
qreg `depv' `vl', quantile(`q2') `options'
g `e2'=e(sample)&`e1'
count if `e2'
loc N=r(N)
matrix `b2'=e(b)
matrix `beta'=`b2'-`b1'
ereturn post `beta', dep(`depv') e(`e2') obs(`N')
eret local cmd="iqr"
 }
eret di, level(`level')
 }
end
sysuse nlsw88
egen c=group(ind occ), label
drop if mi(c)
bs, rep(20) cl(c) seed(4):iqr wage age grade


2009/11/16 Jorge Eduardo Pérez Pérez <[email protected]>:
> Hi everybody
>
> I'm trying to estimate an interquantile range regression with
> block-bootstrapped standard errors. I've a dataset of cities and
> months and i'm trying to estimate a differences in differences model,
> so i need the bootstraped s.e's to take into account the
> within-cluster correlation. Computation of the regressions using iqreg
> is VERY slow, so I tried something like
>
> program myqreg, eclass
> version 11
> syntax varlist  [, `options' Q1(real .25) Q2(real 0.75)]
> gettoken depv vl : varlist
> tempname b1 b2 beta
> qui qreg `depv' `vl', quantile(`q1')
> matrix `b1'=e(b)
> qui qreg `depv' `vl', quantile(`q2')
> matrix `b2'=e(b)
> matrix `beta'=`b2'-`b1'
> ereturn post `beta'
> end
>
> glo seed=4020
> bootstrap _b , rep(200) cluster(city) idcluster(icity) seed($seed):
> myqreg lwage _Iciudad* _Iañomes* treatment
>
> However, it doesn't seem to work. Every bootstrap replication fails.
>
> Any suggestions? Thank you !

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index