sergiocorreia / reghdfe

Linear, IV and GMM Regressions With Any Number of Fixed Effects
http://scorreia.com/software/reghdfe/
MIT License
214 stars 56 forks source link

[BUG] Version 6.12.0 breaks ivreghdfe with "last estimates not found" #283

Open droodman opened 10 months ago

droodman commented 10 months ago

ivreghdfe is crashing on me unless I revert to reghdfe version 5.9.0. I think the "last estimates not found" error I'm getting traces to a reghdfe, requirements call. See log below.

. net install reghdfe, from(https://raw.github.com/sergiocorreia/reghdfe/5.9.0/src) replace
checking reghdfe consistency and verifying not already installed...

the following files will be replaced:
    C:\Users\Administrator\ado\plus\r\reghdfe.ado
    C:\Users\Administrator\ado\plus\r\reghdfe_parse.ado
    C:\Users\Administrator\ado\plus\r\reghdfe.mata
    C:\Users\Administrator\ado\plus\r\reghdfe.sthlp

installing into C:\Users\Administrator\ado\plus\...
installation complete.

. ivreghdfe part (yeduc = t2) t1 _Isvy* [pw=wt] if inrange(age74,19-5,19+5) &  female!=1 & yeduc>=9, small cluster(id) a(age)
(existing lftools.mlib compiled with Stata ???; need to recompile for Stata 18)
(compiling lftools.mlib for Stata 18)
(library saved in C:\Users\Administrator\ado\plus/l/lftools.mlib)
(existing lreghdfe.mlib compiled with Stata ???; need to recompile for Stata 18)
(compiling lreghdfe.mlib for Stata 18)
(library saved in C:\Users\Administrator\ado\plus/l/lreghdfe.mlib)
(sum of wgt is     1.3702e+05)
Warning - collinearities detected
Vars dropped:       _Isvy_2 _Isvy_3 _Isvy_4 _Isvy_5 _Isvy_6 _Isvy_7 _Isvy_9
                    _Isvy_10 _Isvy_11 _Isvy_13 _Isvy_15 _Isvy_17 _Isvy_19
                    _Isvy_20 _Isvy_21 _Isvy_22 _Isvy_23 _Isvy_24 _Isvy_25
                    _Isvy_26 _Isvy_27 _Isvy_28 _Isvy_30 _Isvy_32 _Isvy_34
                    _Isvy_36 _Isvy_37 _Isvy_38 _Isvy_39 _Isvy_40 _Isvy_41
                    _Isvy_42 _Isvy_43 _Isvy_44
--Break-- _[NB: this is working fine, so I stopped it]_
r(1);

. net install reghdfe, from(https://raw.github.com/sergiocorreia/reghdfe/6.12.0/src) replace
checking reghdfe consistency and verifying not already installed...

the following files will be replaced:
    C:\Users\Administrator\ado\plus\r\reghdfe.ado
    C:\Users\Administrator\ado\plus\r\reghdfe.mata
    C:\Users\Administrator\ado\plus\r\reghdfe.sthlp

installing into C:\Users\Administrator\ado\plus\...
installation complete.

. ivreghdfe part (yeduc = t2) t1 _Isvy* [pw=wt] if inrange(age74,19-5,19+5) &  female!=1 & yeduc>=9, small cluster(id) a(age)
last estimates not found
r(301);

. which ivreghdfe
C:\Users\Administrator\ado\plus\i\ivreghdfe.ado
*! ivreghdfe 1.0.0  07jul2018
*! this just adds absorb() to this code:
*! ivreg2 4.1.10  9Feb2016
*! authors cfb & mes
*! see end of file for version comments
sergiocorreia commented 10 months ago

Hi David,

This should be fixed if you upgrade to the latest version of ivreghdfe (1.1.3)

Let me know if that's not the case.

Best, S

droodman commented 10 months ago

Ah thank you. In case useful for others, I installed this new version with:

net install ivreghdfe, replace from(https://raw.github.com/sergiocorreia/ivreghdfe/1.1.3/src)
yixin-mei commented 6 months ago

Hi, I recently encountered a similar issue when I tried to bootstrap the ivreghdfe. The error is still there even after I reinstalled all the related packages. The following is an example. How to deal with the error? Is it a crash tracing to reghdfe? Btw, I am using Stata/MP 16.0. Thanks!

sysuse auto.dta, clear

bootstrap, reps(100) seed(123): ivreghdfe mpg (weight = trunk), a(i.foreign) (running ivreghdfe on estimation sample)

Bootstrap replications (100) ----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5 .................................................. 50 .................................................. 100 last estimates not found r(301);

end of do-file

r(301);

droodman commented 6 months ago

@yixin-mei I suggest you try reghdfejl. It has built-in support for bootstrapping with parallel processing, so it is very fast (except on first use). It accepts the ivreghdfe IV syntax. So you could do something like

reghdfejl mpg (weight = trunk), a(foreign) bs(reps(1000) seed(42) procs(6))

"reghdfejl"requires the "julia" package; both are available through the ssc install command. It also requires Julia, which is free. After installing the "julia" package, type "help jl" to find instructions for installing Julia.

yixin-mei commented 6 months ago

@yixin-mei I suggest you try reghdfejl. It has built-in support for bootstrapping with parallel processing, so it is very fast (except on first use). It accepts the ivreghdfe IV syntax. So you could do something like

reghdfejl mpg (weight = trunk), a(foreign) bs(reps(1000) seed(42) procs(6))

"reghdfejl"requires the "julia" package; both are available through the ssc install command. It also requires Julia, which is free. After installing the "julia" package, type "help jl" to find instructions for installing Julia.

Thank you for the advice! I've checked out the github page of reghdfejl. Unluckily, it seems that the package does not support weak identification diagnostics, which is necessary in my analysis. I am wondering why the standard bootstrap procedure will break for ivreghdfe but works fine for reghdfe. Does anyone have ideas about how to deal with the error when bootstrapping ivreghdfe?

droodman commented 6 months ago

reghdfejl does now report the K-P F statistic....