From 348bf41ad667bafc1fb3aa0f4ade72f040808351 Mon Sep 17 00:00:00 2001 From: Sergio Correia Date: Mon, 1 Mar 2021 02:45:26 -0500 Subject: [PATCH] tweak reghdfe call; fix tests --- src/ivreghdfe.ado | 4 ++-- test.do | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ivreghdfe.ado b/src/ivreghdfe.ado index cdb4111..43fc509 100644 --- a/src/ivreghdfe.ado +++ b/src/ivreghdfe.ado @@ -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! @@ -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 } ******************************************************************************** diff --git a/test.do b/test.do index e62e2cf..d9ba68c 100644 --- a/test.do +++ b/test.do @@ -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 /// @@ -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?? @@ -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 @@ -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? @@ -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?