Incorrect "parentheses unbalanced" error
bholtdwyer opened this issue · 5 comments
Before submitting the bug report
Verify that you are using the latest versions of reghdfe and ftools (which reghdfe
). Note that the latest version is usually on Github and not on SSC.
--Currently running version 6.12.3 08aug2023
Verify that your Stata is updated (update query
).
--Done
Bug report
Please complete the following information:
- Stata version: 17.0 Current update level 29 Aug 2023
- OS: Windows 11 Pro
Behavior
- Expected behavior: I expected reghdfe to run an IV regression, with the outcome variable lit_share, controlling for exogenous rainfall and its square, instrumenting for both_irr_share with natl_gwater_depth_inst, and absorbing year and state fixed effects (exogenous).
- Actual behavior: I got a "parentheses unbalanced" error with no unbalanced parentheses.
. reghdfe lit_share rain rain2 (both_irr_share = natl_gwater_depth_inst), absorb(i.year i.stt_factor)
parentheses unbalanced
r(132);
Steps to reproduce the problem
This does not seem to be a problem limited to my dataset, it also happens on the built-in "auto" data
. sysuse auto.dta
(1978 automobile data)
//This is literally the command given in your Quickstart Guide using auto.dta
. reghdfe price weight (length = gear), absorb(turn trunk)
parentheses unbalanced
r(132);
. describe, fullnames
Contains data from C:\Program Files\Stata17\ado\base/a/auto.dta
Observations: 74 1978 automobile data
Variables: 12 13 Apr 2020 17:45
(_dta has notes)
-------------------------------------------------------------------------------------------------------------------------------------------------
Variable Storage Display Value
name type format label Variable label
-------------------------------------------------------------------------------------------------------------------------------------------------
make str18 %-18s Make and model
price int %8.0gc Price
mpg int %8.0g Mileage (mpg)
rep78 int %8.0g Repair record 1978
headroom float %6.1f Headroom (in.)
trunk int %8.0g Trunk space (cu. ft.)
weight int %8.0gc Weight (lbs.)
length int %8.0g Length (in.)
turn int %8.0g Turn circle (ft.)
displacement int %8.0g Displacement (cu. in.)
gear_ratio float %6.2f Gear ratio
foreign byte %8.0g origin Car origin
-------------------------------------------------------------------------------------------------------------------------------------------------
Sorted by: foreign
. reghdfe price (mpg = weight), absorb(i.foreign)
parentheses unbalanced
r(132);
. regress price mpg i.foreign
Source | SS df MS Number of obs = 74
-------------+---------------------------------- F(2, 71) = 14.07
Model | 180261702 2 90130850.8 Prob > F = 0.0000
Residual | 454803695 71 6405685.84 R-squared = 0.2838
-------------+---------------------------------- Adj R-squared = 0.2637
Total | 635065396 73 8699525.97 Root MSE = 2530.9
------------------------------------------------------------------------------
price | Coefficient Std. err. t P>|t| [95% conf. interval]
-------------+----------------------------------------------------------------
mpg | -294.1955 55.69172 -5.28 0.000 -405.2417 -183.1494
|
foreign |
Foreign | 1767.292 700.158 2.52 0.014 371.2169 3163.368
_cons | 11905.42 1158.634 10.28 0.000 9595.164 14215.67
------------------------------------------------------------------------------
It appears that something is causing Stata or reghdfe to incorrectly return a "parentheses unbalanced" error on correctly formatted commands.
It seems that the new command for running IV with this package is now "ivreghdfe". If so, perhaps the quickstart guide should be updated to reflect this. It might also be useful for the users if the package issued a warning such as "this syntax corresponds to the command ivreghdfe rather than reghdfe; are you sure you're using the right command?"
You are correct. The help file has the correct documentation (I think) but maybe part of the website is not up to date?
About the better warning error, that makes a lot of sense; might require some tricks such as running -syntax- twice but it's feasible
When I run the ivreghdfe syntax (as a fix to the parentheses unbalanced problem), I get an error "r(301) last estimates not found". This error shows up even when I use the practice "auto.dta" dataset.
I am running the codes on STATA v.17; and my reghdfe is currently running on 6.12.3 08aug2023 version.
I would prefer to use the instrument variable specification on reghdfe because I have multiple fixed effects and clustered SEs. Any help with fixing this issue will be really appreciated.
I also ran into this problem, due to the quickstart guide being out of date.
https://scorreia.com/software/reghdfe/quickstart.html
I also see that the links for ivreghdfe are broken:
https://www.stata.com/help.cgi?ivreghdfe