Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect "parentheses unbalanced" error #275

Open
bholtdwyer opened this issue Sep 6, 2023 · 5 comments
Open

Incorrect "parentheses unbalanced" error #275

bholtdwyer opened this issue Sep 6, 2023 · 5 comments
Assignees

Comments

@bholtdwyer
Copy link

bholtdwyer commented Sep 6, 2023

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.

@bholtdwyer
Copy link
Author

bholtdwyer commented Sep 6, 2023

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?"

@sergiocorreia
Copy link
Owner

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

@bholtdwyer
Copy link
Author

bholtdwyer commented Sep 7, 2023 via email

@tanushreebhan
Copy link

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.

@maswiebe
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants