Menu ▾ ▴

#340 Two-way clustering: --cluster with named series gives one-way clustering on the second variable.

v1.0_(example)
closed-fixed
nobody
None
5
5 days ago
5 days ago
No

gretl 2026d, Windows 11 Pro 64-bit.

The User's Guide, section 22.5 ("Panel data specifics", p. 218), says two things about panel data:

  • two comma-separated cluster variables can be given with --cluster for two-way clustering;
  • named series that identify unit and time can be used instead of $unit and $time.

In 2026d only the exact form --cluster=$unit,$time clusters two ways. If either name in the pair is a series (firm,year, $unit,year, firm,$time), the standard errors are those of one-way clustering on the second variable. ols on panel data does the same. Nothing warns the user:

  • the output still says "Standard errors clustered by firm and year";
  • the F test keeps the two-way denominator df, F(2, 9).

The attached cluster-named-series.inp uses grunfeld, where firm equals $unit and year equals 1934 + $time in every row:

open grunfeld
panel invest const value kstock --pooled --cluster=$unit,$time
panel invest const value kstock --pooled --cluster=firm,year
panel invest const value kstock --pooled --cluster=year

Standard errors of const, value and kstock:

--cluster=$unit,$time     19.71668032   0.01639515   0.07954319   (two-way)
--cluster=firm,year       10.27288943   0.00790949   0.03867233
--cluster=$unit,year      10.27288943   0.00790949   0.03867233
--cluster=firm,$time      10.27288943   0.00790949   0.03867233
ols --cluster=firm,year   10.27288943   0.00790949   0.03867233
--cluster=year            10.27288943   0.00790949   0.03867233   (one-way by year)

Expected: all the two-way forms give the first line. Three one-way fits, V(firm) + V(year) − V(firm × year), each with gretl's own factor, give it to every digit (19.71668032, 0.01639515, 0.07954319). So only the parsing of the named pair seems to be at fault. On cross-sectional data a pair is refused, as the guide says.

1 Attachments

Discussion

  • Allin Cottrell

    Allin Cottrell - 5 days ago

    Thanks for the report. We're working on it.

     
  • Allin Cottrell

    Allin Cottrell - 5 days ago
    • status: open --> closed-fixed
     
  • Allin Cottrell

    Allin Cottrell - 5 days ago

    This problem is now fixed in git.

     

Log in to post a comment.