Hi Thanks for the reminder. Actually I want to analyse whether present value of variable A is Granger caused by lag values of B and test linear hypothesis "B1,B2,B3,B4,B5=0". Therefore, to get robust standard error NeweyWest estimates are applied. Saba
On Saturday, 19 December 2015, 23:26, Achim Zeileis <achim.zeil...@uibk.ac.at> wrote: 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. > Saba > > > On Saturday, 19 December 2015, 15:06, Achim Zeileis > <achim.zeil...@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]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.