p = csvread('index.csv', 1, 0);
y=diff(log(p))*100;
y=y-mean(y);
%% We multiply returns by 100 and de-mean them
tarch(y,1,0,0); % ARCH(1)
tarch(y,4,0,0); % ARCH(4)
tarch(y,4,0,1); % GARCH(4,1)
tarch(y,1,0,1); % GARCH(1,1)
tarch(y,1,0,1,'STUDENTST'); % t-GARCH(1,1)
using CSV, Statistics, DataFrames;
p = CSV.read("index.csv",DataFrame)
y = diff(log.(p[:,1]))*100
y = y .- mean(y)
using ARCHModels;
## ARCH(1)
arch1 = fit(ARCH{1}, y; meanspec = NoIntercept);
println("ARCH(1) model:", "\n", arch1)
## ARCH(4)
arch4 = fit(ARCH{4}, y; meanspec = NoIntercept);
println("ARCH(4) model:", "\n", arch4)
## Note: Order of GARCH arguments here is reversed
## First argument: lags for sigma, second argument: lags for returns squared
## GARCH(4,1)
garch4_1 = fit(GARCH{1,4}, y; meanspec = NoIntercept);
println("GARCH(4,1) model:", "\n", garch4_1)
## GARCH(1,1)
garch1_1 = fit(GARCH{1,1}, y; meanspec = NoIntercept);
println("GARCH(1,1) model:", "\n", garch1_1)
## tGARCH(1,1)
tgarch1_1 = fit(GARCH{1,1}, y; meanspec = NoIntercept, dist = StdT);
println("tGARCH(1,1) model:", "\n", tgarch1_1)
aparch(y,1,1,1); % APARCH(1,1)
aparch(y,2,2,1); % APARCH(2,1)
aparch(y,1,1,1,'STUDENTST'); % t-APARCH(1,1)
leverage_garch1_1 = fit(TGARCH{1, 1,1}, y; meanspec = NoIntercept);
println("GARCH(1,1) with leverage effects model:", "\n", leverage_garch1_1)
## There is no package for apARCH estimation in Julia at present