Hi,
there is some old code by Jack that implements a specific data-based
bandwidth choice for the typical estimation of the long-run
(co)variance. It is primarily meant for a quadratic kernel. I'm
including the hansl function at the end.
My question is: Is that choice somehow already implemented in gretl
through some "set" option? I know I can choose the quadratic kernel via
"set hac_kernel qs", and its bandwidth via "set qs_bandwidth
<something>". But is there something built-in that sets the bandwidth to
what the function below returns?
If not, would it make sense to add that option?
thanks
sven
--------
function matrix c_bandw (const matrix vhat)
# procedure that computes the automatic bandwidth based on AR(1)
# approximation for each vector of the matrix vhat. Each are given
# equal weigths of 1.
nt = rows(vhat)
matrix vt = vhat[2:nt, ]
matrix vlag = vhat[1:nt-1, ]
matrix b = sumc(vt .* vlag) ./ sumc(vlag.^2)
matrix tmp = (1 - b) .^ 4
matrix res = vt - vlag .* b
matrix sig = sdc(res) .^ 2
matrix a2n = sumr( (2 .* b .* sig) .^2 ./ tmp )
matrix a2d = sumr( sig .* sig ./ tmp )
matrix a2 = sumr(a2n) / sumr(a2d)
return 1.3221 * (a2 * nt) .^ 0.2
end function