High-dimensional fixed-effect estimation in Stata using Julia.
This package bridges between Stata and the Julia package FixedEffectModels.jl, which is modeled on, but faster than, reghdfe
. It is designed as a slot-in replacement for reghdfe
and ivreghdfe
. It accepts both the standard OLS and 2SLS specification syntaxes. It offers most options and return values of reghdfe
. But since, unlike ivreghdfe
, it is not currently a wrapper for ivreg2
, it does not offer advanced features such as CUE and LIML. It does provide the Kleibergen-Paap F statistic.
- Stata 16 or later.
- The Stata package julia.
- Julia 1.9.4 or later, installed following the instructions obtained via
help jl
in Stata.
Install from SSC with
ssc install reghdfejl
Sometimes SSC will lag behind this repository. To get the latest version from here, do:
net install reghdfejl, replace from(https://raw.github.com/droodman/reghdfejl/v[X.Y.Z])
where "[X.Y.Z]" represents the latest release version number.
Because Julia uses just-in-time compilation, the first time you run reghdfejl
in a Stata session, it is slow. The same goes for the first time you trigger the use of different code within the underlying Julia package, such as by running the first instrumental-variables or GPU-based estimate within a session.
reghdfejl
ignores reghdfe options that affect the best-fit search algorithm, as well as the rarely-used dofadjustments() option. It accepts three novel options:
threads()
lowers the number of CPU threads FixedEffectModels.jl will use.gpu
specifies that a GPU be used for computation (works better on NVIDIA GPUs than Apple Silicon).bs()
a suboption ofvce()
for high-speed bootstrapping with parallel processing.
webuse nlswork
reghdfejl ln_wage grade age ttl_exp tenure not_smsa south, absorb(idcode year)
reghdfejl ln_wage grade age ttl_exp tenure not_smsa south, absorb(idcode year) vce(robust)
reghdfejl ln_wage grade age ttl_exp tenure not_smsa south, absorb(idcode year) vce(cluster idcode) threads(4)
reghdfejl ln_wage grade age ttl_exp tenure (not_smsa = south), absorb(idcode year) vce(cluster idcode year)
reghdfejl ln_wage age ttl_exp tenure not_smsa south, absorb(year occ_code) vce(bs, cluster(occ_code) reps(1000) seed(42) procs(4))