I have an array that I want to use Ljung Box Test on. In Matlab, there is lbqtest function that works on array.
I want to know how I can do this in Julia.
nz = 1250
z =randn(nz,1)# randomly generated z distributed N[0,1]
sig=0.20*sqrt(1/252); #defining the trade day volatility
#of logarithmic change from annualized volatility 20-percent
cv = zeros(nz,1)
ep = zeros(nz,1)
G = 0.75
#weight on past conditional variance
A = 0.20
#weight on innovation
cv[1] = sig^2
ep[1] = 0
kappa = sig*sig*(1-(A+G)); #unconditional variance kappa/(1-(A+G))
for j = 2:nz #for loop creating conditional variance process
cv[j] = kappa + G*cv[j-1] + A*(ep[j-1]^2)
ep[j] = sqrt(cv[j])*z[j] #process innovation
end
mcv = exp.(ep)
mcv[1] = P0
Pcv = cumprod(mcv)
xcv = log(Pcv[2:end])-log(Pcv[1:end-1])
using HypothesisTests
LjungBoxTest(xcv) # does not work