From: Drew Saunders on
"Anna Paulsen" <Pekingduck82(a)gmail.com> wrote in message <hoispg$s30$1(a)fred.mathworks.com>...
> Hi Wayne,
>
> dunno if you'll still see this - I got so caught up I forgot to answer your latest message to say thanks. The code did work successfully in the end, mainly due to your hints, so thanks!
>
> -anna
>
> PS @Oleg Thanks for the suggestion - I did look at it briefly, but in the end I was short on time and it was too much to take in. I've saved it for next time though.
>
>
> >
> > Hi Anna, how about replacing the if statement with
> >
> > if k == 1 && isequal(X,ones(T,1))
> >
> > Wayne
> > wayne


FYI, I've tried to use this code, and I think there is an error in the formula for the NW variance matrix. In particular, I think the formula contains one too many Ts in the denominator. A quick test: setting nlags=0 and X=ones(T,1) should give you (approximately) the sample variance matrix of e. (Precisely, T/(T-k) times the sample variance matrix.) It does not, I think.

Cheers,
Drew