Tag Info

New answers tagged

0

I think that this code solves your problems. In your case h0 is zero while lag can be set equal to 6 (or 5) function y=NWtest(ret,lag,h0) T=size(ret,1); vv=var(ret); for l=1:1:lag cc=cov(ret(1:end-l),ret(l+1:end)); vv=vv+2*(1-l/lag)*cc(1,2); end y=(mean(ret)-h0)/sqrt(vv)*sqrt(T); end



Top 50 recent answers are included