Skip to content

Commit

Permalink
tweak reghdfe call; fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocorreia committed Mar 1, 2021
1 parent 55bb40e commit 348bf41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ivreghdfe.ado
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ program define ivreg211, eclass byable(recall) sortpreserve
loc small small
loc noconstant noconstant
loc nopartialsmall
loc reghdfe_options `"absorb(`absorb') `options' nopartialout"' // (nopartialout implies keepmata)
loc reghdfe_options `"absorb(`absorb') `options' nopartialout varlist_is_touse"' // (nopartialout implies keepmata)

if ("`residuals2'" != "") {
cap drop _reghdfe_resid // destructive!
Expand Down Expand Up @@ -399,7 +399,7 @@ program define ivreg211, eclass byable(recall) sortpreserve
* Create HDFE object and update touse
if (`"`absorb'"' != "") {
if (`"`cluster'"' != "") loc reghdfe_options `"`reghdfe_options' vce(cluster `cluster')"'
reghdfe `touse', varlist_is_touse `reghdfe_options' // create HDFE object
reghdfe `touse', `reghdfe_options' // create HDFE object
}

********************************************************************************
Expand Down
9 changes: 5 additions & 4 deletions test.do
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ noi cscript "ivreg2 with absorb()" adofile reghdfe
storedresults save benchmark e()

ivreghdfe price weight, absorb(turn) keepsingletons
assert e(N) == 73
assert e(df_m)==1
loc excluded ///
macro: cmd cmdline ivreg2cmd insts inexog partial partial1 partialcons df_m predict ///
Expand All @@ -45,7 +46,7 @@ noi cscript "ivreg2 with absorb()" adofile reghdfe
loc excluded ///
macro: cmd cmdline vce indepvars title title2 footnote estat_cmd predict marginsnotok ///
scalar: rank ic N_hdfe_extended redundant tss tss_within mss ll_0 r2_a_within sumweights ///
r2_a r2_within r2 report_constant
r2_a r2_within r2 report_constant converged
storedresults compare benchmark e(), tol(1e-12) exclude(`excluded')
storedresults drop benchmark
// why does mss differs??
Expand Down Expand Up @@ -79,7 +80,7 @@ noi cscript "ivreg2 with absorb()" adofile reghdfe
loc excluded ///
macro: cmd cmdline vce indepvars title title2 footnote estat_cmd predict title3 marginsnotok ///
scalar: rank ic N_hdfe_extended redundant tss tss_within mss ll_0 r2_a_within sumweights ///
r2_a r2_within r2 rmse N_clustervars report_constant F ///
r2_a r2_within r2 rmse N_clustervars report_constant F converged ///
matrix: V
storedresults compare benchmark e(), tol(1e-12) exclude(`excluded')
storedresults drop benchmark
Expand All @@ -99,7 +100,7 @@ noi cscript "ivreg2 with absorb()" adofile reghdfe
loc excluded ///
macro: cmd cmdline vce indepvars title title2 footnote estat_cmd predict title3 marginsnotok ///
scalar: rank ic N_hdfe_extended redundant tss tss_within mss ll_0 r2_a_within sumweights ///
r2_a r2_within r2 rmse N_clustervars report_constant F matrix: V
r2_a r2_within r2 rmse N_clustervars report_constant F converged matrix: V
storedresults compare benchmark e(), tol(1e-12) exclude(`excluded')
storedresults drop benchmark
// why does mss and rmse differ?
Expand All @@ -121,7 +122,7 @@ noi cscript "ivreg2 with absorb()" adofile reghdfe
instruments endogvars vcesuite dofadjustments subcmd ivreg2cmd marginsok marginsnotok ///
scalar: rank ic N_hdfe_extended redundant tss tss_within mss ll_0 r2_a_within sumweights ///
r2_a r2_within r2 rmse N_clustervars partial_ct df_m savestages r2u r2c G1 M1_nested ///
M1_exact K1 M1 unclustered_df_r partialcons M_due_to_nested mobility report_constant
M1_exact K1 M1 unclustered_df_r partialcons M_due_to_nested mobility report_constant converged
storedresults compare benchmark e(), tol(1e-12) exclude(`excluded')
storedresults drop benchmark
// why does mss and rmse differ?
Expand Down

0 comments on commit 348bf41

Please sign in to comment.