FixedEffects / FixedEffectModels.jl

Fast Estimation of Linear Models with IV and High Dimensional Categorical Variables
Other
225 stars 46 forks source link

Next release please! For Stata front-end #242

Closed droodman closed 1 year ago

droodman commented 1 year ago

I can't tell whether the repo is in a state that would allow a new release to be pushed out. I am writing a Stata program reghdfejl, that has nearly the same syntax as reghdfe but uses FixedEffectModels.jl as the back end for speed.

It would be nice to have access to the dof_fes return value, because that is normally returned by reghdfe too. I see dof_res has been added in the last few weeks, since the last release.

Thanks.

matthieugomez commented 1 year ago

Sure, I will release a new version in the coming days. Out of curiosity, do you have a github repository for this command?

droodman commented 1 year ago

Great. https://github.com/droodman/reghdfejl Just posted. :-) Comments/issues welcome. I haven't thoroughly tested yet.

This is my second Stata package using Julia as a back-end. The other is boottest, which optionally calls Julia.

Some tests on Saturday revealed that the run time is now dominated by transferring the regressors between Stata and Python (as a bridge to Julia) and then transferring the sample marker back. I'm learning now to bypass Python by writing a C plug-in for Stata that uses the Julia C API. Maybe I'll have that going in a few days. It could run much faster.

In reghdfejl.ado, you'll see references to the fields of the returned result object, such as with m.esample. It seems to me this should be unnecessary, i.e., that all results should be accessible by wrapper functions, even if they are not part of the StatsBase standard. Requiring the user to access the fields directly violates data abstraction and could break user code in the future if the internal representation of results changes. Fields that I think currently can't be accessed via wrapper functions include esample, F, iterations, converged, r2_within, nclusters, ...

The main gap I see is there is nothing comparable to the DOF table that reghdfe displays after the main results. Are those return results easy are hard to add? (Also Root MSE is missing, pending access to the return result dof_fes.)

Maybe I should copy ivreghdfe and make it a wrapper for ivreg2 for IV models, just using FixedEffectModels.jl to partial out the FE.

matthieugomez commented 1 year ago

Great! I tagged a new version: https://github.com/JuliaRegistries/General/pull/88397 Yes, feel free to add wrapper funciton in a pull request. (I thing esample is Stataspeak so it should be renamed + converged feels too broad so maybe has_converged is better).

droodman commented 1 year ago

Thank you. Except I couldn't install it:

(@v1.9) pkg> up FixedEffectModels
    Updating registry at `C:\Users\drood\.julia\registries\General.toml`
ERROR: Unsatisfiable requirements detected for package KernelAbstractions [63c18a36]:
 KernelAbstractions [63c18a36] log:
 ├─possible versions are: 0.1.0-0.9.8 or uninstalled
 └─restricted to versions 0.9.7 by an explicit requirement — no versions left