[R] error in vcovNW

Saba Sehrish sabasehrish at yahoo.com
Sat Dec 19 03:53:57 CET 2015


Thank you. The issue is resolved by scaling the data in millions.
Saba 

    On Saturday, 19 December 2015, 15:06, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
 

 On Sat, 19 Dec 2015, Saba Sehrish via R-help wrote:

> Hi I am using NeweyWest standard errors to correct lm( ) output. For example:
> lm(A~A1+A2+A3+A4+A5+B1+B2+B3+B4+B5)
> vcovNW<-NeweyWest(lm(A~A1+A2+A3+A4+A5+B1+B2+B3+B4+B5))
>
> I am using package(sandwich) for NeweyWest. Now when I run this command, it gives following error:
> Error in solve.default(diag(ncol(umat)) - apply(var.fit$ar, 2:3, sum)) :system is computationally singular: reciprocal condition number = 7.49468e-18
>
> Attached herewith is data for A&B, A1,A2,A3,A4,A5,B1,B2,B3,B4,B5 are 
> simply lag variables. Can you help me removing this error please?

Without trying to replicate the error, there are at least two issues:

(1) You should scale your data to use more reasonable orders of magnitude, 
e.g., in millions. This will help avoiding numerical problems.

(2) More importantly, you should not employ HAC/Newey-West standard errors 
in autoregressive models. If you use an autoregressive specification, you 
should capture all relevant autocorrelations - and then no HAC estimator 
is necessary. Alternatively, one may treat autocorrelation as a nuisance 
parameter and not model it - but instead capture it in HAC standard 
errors. Naturally, the former strategy will typically perform better if 
the autocorrelations are more substantial.

> Saba

  
	[[alternative HTML version deleted]]



More information about the R-help mailing list