[Vars-commits] r92 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 5 22:46:08 CEST 2013


Author: bpfaff
Date: 2013-06-05 22:46:07 +0200 (Wed, 05 Jun 2013)
New Revision: 92

Modified:
   pkg/R/VARselect.R
Log:
Performance increase by using lm.fit()


Modified: pkg/R/VARselect.R
===================================================================
--- pkg/R/VARselect.R	2013-05-22 21:41:12 UTC (rev 91)
+++ pkg/R/VARselect.R	2013-06-05 20:46:07 UTC (rev 92)
@@ -52,7 +52,7 @@
         ys.lagged <- cbind(ylagged[, c(1:idx[i])], rhs)
         sampletot <- nrow(y)
         nstar <- ncol(ys.lagged)
-        resids <- resid(lm(yendog ~ -1 + ys.lagged))
+        resids <- lm.fit(x=ys.lagged, y=yendog)$residuals
         sigma.det <- det(crossprod(resids)/sample)
         criteria[1, i] <- log(sigma.det) + (2/sample) * (i * K^2 + K * detint)
         criteria[2, i] <- log(sigma.det) + (2 * log(log(sample))/sample) * (i * K^2 + K * detint)



More information about the Vars-commits mailing list