s-broda / ARCHModels.jl

A Julia package for estimating ARMA-GARCH models.
https://juliaeconometrics.wordpress.com/
Other
90 stars 18 forks source link

Using lagged x variables in regression #74

Open azev77 opened 3 years ago

azev77 commented 3 years ago

I wanna write a blog post along the lines of "which variables are harder to forecast"...

auto_arma works great:

using FredData;
f = Fred("Personal api_key");  
#
d = get_data(f, "GDP");     y=d.df[:,4]
d = get_data(f, "PCEC");    c=d.df[:,4]
d = get_data(f, "GPDI");    i=d.df[:,4]
d = get_data(f, "GCE");     g=d.df[:,4]
d = get_data(f, "NETEXP");  nx=d.df[:,4]
[filter!(x -> ! isnan(x), dd) for dd in [y, c, i, g, nx]]; # REMOVE NaN

using ARCHModels;
auto_arma(df, ic) = selectmodel(ARCH{0}, df, meanspec=ARMA, criterion=ic, minlags=0, maxlags=3);
#
sc_aic=[]
for dd in [y, c, i, g, nx]
    a=auto_arma(dd, aic)
    push!(sc_aic,(a.spec,a.meanspec,aic(a),bic(a),a))
end
sc_aic

Is there a convenient way to include controls together with ARMA? y_{t+1} = \mu + \rho_y * y_t + \rho_c * c_t +\rho_i1 * i_{t-1} + \epsilon_{t+1}

s-broda commented 3 years ago

Not at the moment, I'm afraid.