Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Re: Bootstrap error message


From   "Alistair Windsor (U of M)" <[email protected]>
To   [email protected]
Subject   st: Re: Bootstrap error message
Date   Sat, 14 May 2011 23:52:48 -0500

Dear All,

A follow up on how to avoid my mysterious error message and also how to avoid bootstrap from rejecting runs with different variables dropped for collinearity (if such is a good idea). The solution is to insert

ereturn clear

into the program before returning to the bootstrap. This prevents any of it's "helpful" checks from throwing an exception.

If one allows the regressions to drop different variables when computing the pscore then one probably should return the number of observations to the boostrap. One can use the reject option to eliminate runs where the number of propensity scores computed is lower than it should be.

Alistair


On 5/11/11 9:50 AM, Alistair Windsor wrote:
Dear Statalisters,

I am using a propensity score matching scheme to evaluate an education
intervention. Students self select into the intervention so some effort
needs to be taken to eliminate the selection bias in the data.

I am aware of the Imbens result on the lack of asymptotic validity for
bootstrapping for matching schemes and I am trying some propensity score
reweighting schemes as well but thusfar the propensity score matching
scheme does the best job of eliminating observed difference and seems to
be the least sensitive to specification. In addition it is easy to explain.

My problem concerns the fact that when I run my bootstrap command over
my matching scheme in a case where there is classification with no
students in it I get an error message

e(b) not found

and the bootstrap aborts. Altering the code so that it should adapt to
empty classifications has not helped. The relevant code in enclosed in a
capture block. It all ran fine until I turned it into a program and
bootstrapped it. Can anyone see my mistake?

Many thanks in advance,

Alistair

My program is as follows:

capture program drop difference
program define difference, rclass
local intervention `1'
local controls female i.race i.major freshgpa nfreshgpa
local outcomes retained gpa

qui: gen float weight = .
foreach measure of local outcomes {
qui: gen att_`measure' = .
}

forvalues y = 1/2 {
qui: levelsof classification if `intervention'==1 & yr==`y',
local(classifications)
foreach c of local classifications {
capture {
qui: xi: psmatch2 `intervention' `controls' ///
if yr == `y' & classification == "`c'", ///
outcome(`outcomes') noreplacement descending common quietly nowarning
qui: replace weight = _weight if yr == `y' & classification == "`c'"
foreach measure of local outcomes {
qui: replace att_`measure' = r(att_`measure') if yr == `y' & ///
classification == "`c'" & `intervention' & weight == 1
}
}
}
}
sum att_gpa if `intervention' == 1 & weight == 1, meanonly
return scalar gpa_diff = r(mean)
sum att_retained if `intervention' == 1 & weight == 1, meanonly
return scalar retained_diff = r(mean)
qui: drop weight
foreach measure of local outcomes {
qui: drop att_`measure'
}

end

The main body of the loop

foreach intervention of local interventions {

log using ...

qui: drop if mstem & `intervention' == 0

bootstrap r(gpa_diff) r(retained_diff), seed(6784431)
strata(`intervention' yr) reps(15) nodrop : difference `intervention'

log close

pause

restore, preserve // This restores the data set to where it was before I
dropped students.

}

It took a while for me to discover the nodrop option. The code is a
bastardized mix of Stata 10 and 11. Apologies.


--
--
Alistair Windsor
380 Dunn Hall           Ph: 901-678-4431
University of Memphis   Fax: 901-678-2480
Memphis, TN 38152-3240
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index