[R] error in vcovNW
Achim.Zeileis at uibk.ac.at
Sat Dec 19 11:26:25 CET 2015
On Sat, 19 Dec 2015, Saba Sehrish wrote:
> Thank you. The issue is resolved by scaling the data in millions.
That solves the numerical problem but the second issue (inappropriateness
of the Newey-West estimator for an autoregressive model) persists.
> 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
> > 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 =
> > 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
More information about the R-help