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]

Re: st: poisson and bootstrap with clustered data


From   Austin Nichols <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: poisson and bootstrap with clustered data
Date   Tue, 4 Feb 2014 15:54:30 -0500

Aviva Litovitz < [email protected] >:

I maintain that the bootstrapped coefficients on dummies assigned to
different groups of obs make no sense in estimating the variability of
a mean for a particular set of obs: across all years for one company
for example, where other companies' fixed effects are being used to
estimate that variability.  Combining twice as many obs under one
panel id would underestimate the SE in one resampled instance, but we
are not using the SE in each resample, just the distribution of
estimates.  Putting twice or five times as much data into one panel FE
is not a problem but putting different panels into the estimate for
one panel is a problem--if we cared about SE on FE, which we do not!

I do not find your example reproducible:

webuse psidextract, clear
xtreg lwage exp, i(id) fe vce(bootstrap, seed(111))
xi:bs, cl(id) seed(111) idcluster(nid): reg lwage exp i.nid

The last does not run in my copies of Stata, but why not just wrap the
estimation in an e-class -program- to save the one coef you need?

webuse psidextract, clear
tsset, clear
cap prog drop fereg
program fereg, eclass
version 10
if replay() {
 syntax [anything] [, EForm(string) Level(real 95) ]
 eret di, eform(`eform') level(`level')
 }
else {
 syntax [varlist] [, EForm(string) Level(real 95) ]
 tab nid, g(d_)
 reg lwage `varlist' d_*
 drop d_*
 tempvar s
 g byte `s'=e(sample)
 mat B=e(b)
 mat b=B[1,1]
 mat coln b=`varlist'
 mat V=e(V)
 mat v=V[1,1]
 mat coln v=`varlist'
 mat rown v=`varlist'
 eret post b v, e(`s')
 eret local cmd "fereg"
 eret local properties "b V"
 eret di, eform(`eform') level(`level')
}
end
bs, cl(id) seed(111) idcluster(nid): fereg exp
xtreg lwage exp, i(id) fe vce(bootstrap, seed(111))


On Tue, Feb 4, 2014 at 2:58 PM, Litovitz, Aviva <[email protected]> wrote:
> Austin Nichols suggested I might be having problems running the following command because I am basing the FE on the "newid" generated by the bootstrap:
>         . xi: bootstrap, reps(2) cluster(person_id) idcluster(newid) noisily: poisson pub_count loggrantp07 i.newid
>
> I don't have problems with this formulation when I run a linear model, so I'm not sure that's the problem.
>
> For example, I get identical results from the following two commands, with the first being the linear equivalent of the command line above:
>         . xi: bootstrap, seed(111) cluster(person_id) idcluster(newid): reg pub_count loggrantp07 i.newid
>         . xtreg pub_count loggrantp07, i(person_id) fe vce(bootstrap, seed(111))
>
> Does anybody have any idea why it wouldn't work for the poisson model and what I might try?
>
> Any help is greatly appreciated!
> Aviva
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Litovitz, Aviva
> Sent: Monday, February 03, 2014 12:31 PM
> To: '[email protected]'
> Subject: RE: st: poisson and bootstrap with clustered data
>
> Thanks Austin.  I'm not using -xtpoisson- because I'm trying to figure out why your -ivpois- command isn't working for me when I try to bootstrap clusters, and I'm guessing the problems might be related.
>
> Unfortunately I get similar errors when I generate dummies based on i.person_id.  I can look into suppressing the FE estimates, but I want to make sure I'm not doing something wrong.
>
> Also, if I understand correctly, the bootstrap treats each draw of a cluster as a separate and distinct cluster.  So wouldn't I want them to have different fixed effect dummies?  Say I group together two draws of the same cluster.  If I estimate the FE for these two draws together aren't I saying I have 2x the data for this cluster than I actually do?
>
> Thanks for your help and your patience!
> Aviva
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Austin Nichols
> Sent: Monday, February 03, 2014 11:53 AM
> To: [email protected]
> Subject: Re: st: poisson and bootstrap with clustered data
>
> Aviva Litovitz < [email protected] >:
>
> You should probably get errors for any of those, since what is the meaning of combining coefficients on a newly created id across multiple resampled datasets? I.e. if you pick the 5th case in a bsample and none of the first 4 cases, it will be measured in _Inewid1, but if you pick the 4th case and none of the first 3 cases, it will be measured in _Inewid1, and then you are trying to aggregate those fixed effects for different units in one coef, which means the variance of those estimates should be dramatically overstated by the bootstrap. You could just use i.person_id instead of i.newid, since the same persons will give the same FE. But why not just use xtpoisson?  Or you can wrap your estimation in an e-class -program- and just save the coefs of interest (i.e. suppress the FE).
>
> On Mon, Feb 3, 2014 at 2:21 PM, Litovitz, Aviva <[email protected]> wrote:
>> Statalist,
>>
>> I am trying to use the -bootstrap- command with a poisson model and clustered data in Stata 10.  I am trying to get the bootstrap process to work because the goal is to apply -bootstrap- to the -ivpois- command (add-in module by Austin Nichols).  I am running into bootstrap failures in both cases and I'm guessing they may be related.
>>
>> The following is my command for estimation with -poisson-:
>>         . xi: bootstrap, reps(2) cluster(person_id) idcluster(newid)
>> noisily: poisson pub_count loggrantp07 i.newid
>>
>> My errors look like this:
>>         captured error in [pub_count]_b[_Inewid_6], posting missing value
>>         captured error in [pub_count]_b[_Inewid_11], posting missing value
>>         captured error in [pub_count]_b[_Inewid_12], posting missing value....
>> With each run there are errors with some but not all of the _Inewid_* and the values change from run to run.
>>
>> I obtain estimates if I leave out the i.newid dummies, if I leave out the cluster component of the bootstrap, or if I run -poisson- using -vce- instead of -bootstrap-:
>>         . xi: poisson pub_count loggrantp07 i.person_id, vce(cluster
>> person_id)
>>
>> Thanks for your time and any tips are greatly appreciated!
>> Aviva

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index