Hello
I've been trying to get to the results of Newey West estimator with a formula but I didn´t succeed so far.I had a look in the manual (guide II) but it is confusing.
The exercise I' m dealing with is as follows
Lag specification  none
Kernell  Bartlett
Bandwith  Newey fixed
Truncate integer  Not selected
Can you please tell me witch formula is under the calculations in Eviews?
Is there any kind of document that can help?
Tks for your time
João Pereira
Newey  West covariance formula
Moderators: EViews Gareth, EViews Moderator

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12375
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Newey  West covariance formula
In what context are you calculating a NeweyWest covariance?
Follow us on Twitter @IHSEViews

 Posts: 14
 Joined: Thu Jan 03, 2013 10:56 am
Re: Newey  West covariance formula
I´m just trying to see witch is the correct formula behind the calculation because the formulas I got didn't match.
So I started with a very simple case with only 4 obs ( consumption(cons) depending on salary(sal) )
cons sal
100 500
150 600
200 600
180 500
The outputs are OLS = cons c sal
β1=35 β2=0,35
var(β)= 67862,5 122,375 covariance and variance matrix
122,375 0,2225
Accepting the default options (that are in my first post) ,the Newey West estimator according to Eviews is 35.412,50 56,6250
56,6250 0,091250
And mty goal is to check those values with the formula.
Of course I´m doing simething wrong,perhaps the lagged errors(u) are wrongly considered (see bellow)
cons n sal u4 SST u3 u 2 u1
100 1 500 40 3306,25 0 0 0
150 1 600 25 56,25 40 0 0
200 1 600 25 1806,25 25  40 0
180 1 500 40 506,25 25 25 40
In terms of bandwith Eviews tells that it is 2, but considering int[4*(4/100)^(2/9)] I get 1
Next step I made diagonal matrix with the product of errors in all combinations [(u4u4) (u4u3) (u4u2) (u4u1) (u3u2) (u3u1) (u2u1) ]
and four X lagged matrix like that
X4 X3 X2 X1
1 500 0 0 0 0 0 0
1 600 1 600 0 0 0 0
1 600 1 600 1 600 0 0
1 500 1 500 1 500 1 500
And I made the product of X's with uu's based on the formula and considering the weight 1 j(b+1) where b is bandwith ( I considered 1 (?)) and added to (XX')uu
Finally ((XX')^1 *T*Result* (XX')^1 should give the new covariance matrix (NW)
Sorry this is a little bit tedious and it was easier for me to send you the excel sheet with the calculations but I don´t know if it's possible .If so I'll very pleased to send it. Anyway I hope to have given an idea about my problem. As you know we have a better understanding about whatwe are doing if we understand the rational behind of calculation instead of only clicking some buttons.
Thks for your time
João Pereira
So I started with a very simple case with only 4 obs ( consumption(cons) depending on salary(sal) )
cons sal
100 500
150 600
200 600
180 500
The outputs are OLS = cons c sal
β1=35 β2=0,35
var(β)= 67862,5 122,375 covariance and variance matrix
122,375 0,2225
Accepting the default options (that are in my first post) ,the Newey West estimator according to Eviews is 35.412,50 56,6250
56,6250 0,091250
And mty goal is to check those values with the formula.
Of course I´m doing simething wrong,perhaps the lagged errors(u) are wrongly considered (see bellow)
cons n sal u4 SST u3 u 2 u1
100 1 500 40 3306,25 0 0 0
150 1 600 25 56,25 40 0 0
200 1 600 25 1806,25 25  40 0
180 1 500 40 506,25 25 25 40
In terms of bandwith Eviews tells that it is 2, but considering int[4*(4/100)^(2/9)] I get 1
Next step I made diagonal matrix with the product of errors in all combinations [(u4u4) (u4u3) (u4u2) (u4u1) (u3u2) (u3u1) (u2u1) ]
and four X lagged matrix like that
X4 X3 X2 X1
1 500 0 0 0 0 0 0
1 600 1 600 0 0 0 0
1 600 1 600 1 600 0 0
1 500 1 500 1 500 1 500
And I made the product of X's with uu's based on the formula and considering the weight 1 j(b+1) where b is bandwith ( I considered 1 (?)) and added to (XX')uu
Finally ((XX')^1 *T*Result* (XX')^1 should give the new covariance matrix (NW)
Sorry this is a little bit tedious and it was easier for me to send you the excel sheet with the calculations but I don´t know if it's possible .If so I'll very pleased to send it. Anyway I hope to have given an idea about my problem. As you know we have a better understanding about whatwe are doing if we understand the rational behind of calculation instead of only clicking some buttons.
Thks for your time
João Pereira

 Posts: 14
 Joined: Thu Jan 03, 2013 10:56 am
Re: Newey  West covariance formula
Hi
I´ve just send you a post and I notice that it's very badly formatted.The problem is that I don´t know how to do it.
I appologize for that
Tks
Joao Pereira
I´ve just send you a post and I notice that it's very badly formatted.The problem is that I don´t know how to do it.
I appologize for that
Tks
Joao Pereira

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12375
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Newey  West covariance formula
Which version of EViews are you using?
Follow us on Twitter @IHSEViews

 Posts: 14
 Joined: Thu Jan 03, 2013 10:56 am
Re: Newey  West covariance formula
I'm using Eviews 7
Can I send my calculations in Excel to Help?
João Pereira
Can I send my calculations in Excel to Help?
João Pereira

 Posts: 14
 Joined: Thu Jan 03, 2013 10:56 am
Re: Newey  West covariance formula
Hi
Just to help I attached an excel sheet with the example I've been trying to work out
Regards
João Pereira
Just to help I attached an excel sheet with the example I've been trying to work out
Regards
João Pereira
 Attachments

 EviewsForum.xlsx
 (1.48 MiB) Downloaded 509 times

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 12375
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Newey  West covariance formula
I'm not sure calculating NW standard errors in Excel is a good idea  you really need a proper matrix language, I would have thought. I couldn't make much sense of your Excel spreadsheet. However, I will note that Appendix E, of User Guide II does a pretty good job of describing all the issues involved with HAC estimation. With the exception of defining what the Newey West Fixed bandwidth estimator is, which for the Bartlett kernel is m=floor(4*(T/100)^2/9), where m is described in the first paragraph of page 779 of the PDF version of User Guide II.
Follow us on Twitter @IHSEViews

 EViews Developer
 Posts: 2622
 Joined: Wed Oct 15, 2008 9:17 am
Re: Newey  West covariance formula
One comment. I haven't looked carefully at the computations, but I will note that you're going to need to compute the longrun variance of Xi*ui so you're going to want the moments of that. My quick glance suggests that you are computing (sum X_t X_{tj}' * sum u_t u_{tj}') to feed into the kernel which isn't the same as sum X_t X_{tj}' u_t u_{tj}.
But it may be that I'm not understanding the steps that you are taking.
But it may be that I'm not understanding the steps that you are taking.
Newey  West covariance formula for KPSS
Dear Gareth
Wrote at some time that " which for the Bartlett kernel is m=floor(4*(T/100)^2/9), where m is described in the first paragraph of page 779 of the PDF version of User Guide II".
I can get that to match the output attached. Here T is 59 and the auto bandwidth is 6, but floor(4*(59/100)^2/9) = 4.
I'm aware that one gets 4, when runnning regression, do you mind explaining how you select it for the KPSS test. I look
through the manuals ... couldn't find it?
Kind regards, Asger Lunde
Wrote at some time that " which for the Bartlett kernel is m=floor(4*(T/100)^2/9), where m is described in the first paragraph of page 779 of the PDF version of User Guide II".
I can get that to match the output attached. Here T is 59 and the auto bandwidth is 6, but floor(4*(59/100)^2/9) = 4.
I'm aware that one gets 4, when runnning regression, do you mind explaining how you select it for the KPSS test. I look
through the manuals ... couldn't find it?
Kind regards, Asger Lunde
 Attachments

 Kpss test screen shot
 Snap1.png (31.91 KiB) Viewed 10735 times

 EViews Developer
 Posts: 2622
 Joined: Wed Oct 15, 2008 9:17 am
Re: Newey  West covariance formula
Note that the formula you quote for the bandwidth is for the fixed NeweyWest, not the automatic selection method as used in your computation and as described in some detail in the Appendix on longrun variance computation.
Return to “General Information and Tips and Tricks”
Who is online
Users browsing this forum: No registered users and 2 guests