Hi everyone,
So far I did not succeed in moving my empirical workflow to Julia:
Data cleaning (Query.jl/DataFrames.jl
) → Regression (GLM.jl
) → Custom Standard Errors (CovarianceMatrices.jl
) ??? Latex-Regressiontable (RegressionTables.jl
)
The step that I fail at is to use standard custom errors (e.g. HAC) for my regression tables. Being able export tables only using iid standard errors is not really useful. So far I have not seen a solution to this problem in Julia.
What I would do in R is
# Return regression
regression_model <- lm(Y~ X1+ X2, data = data)
regression_model_2 <- lm(Y~ X1+ X3, data = data)
notes = c("\\parbox[t]{7cm}{" I am using custom standard errors"})
se_new = sqrt(diag(vcovHC(regression_model )))
se_new_2 = sqrt(diag(vcovHC(regression_model_2 )))
stargazer(regression_model, regression_model_2
out = paste("RegressionTable" ,spec, ".tex", sep=""), title="Regression",
se = list(se_new, se_new_2))
Is there any way to do the same in Julia? Maybe people use different packages, that I am not aware of.
Thank you very much!
Unfortunately, it looks like RegressionTables.jl doesn’t have tis functionality. I think you would have to dev
RegressionTables.jl
and modify this line to add that ability.
This is definitely frustrating, and shows what features julia is lacking compared to R right not.
Another reason clustering (and specification of errors in general) should be in the model-fitting process and not after.
HAC for my regression tables
It looks like you do linear regressions. If so, this notebook, aimed at teaching financial econometrics shows how to do White’s and Newey-West.
6 Likes
OP can implement the variance-covariance matrix easily using CovarianceMatrices.jl
. the problem is that when printing them to a latex table they have to let RegressionTables.jl
know to use the variance-covariance matrix they provided.
4 Likes
It does not sound like something awefully difficult to do. Is anyone interested to have a look together with me?
I filed an issue here. If the package author thinks its a good thing to add it shouldn’t be too hard to make a PR.
Thank you, it might be an option to include the necessary functionality in CovarianceMatrices.jl
, there is an issue here.
1 Like