[Gmm-commits] r114 - in pkg/gmm: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 22 22:34:16 CEST 2017


Author: chaussep
Date: 2017-08-22 22:34:16 +0200 (Tue, 22 Aug 2017)
New Revision: 114

Modified:
   pkg/gmm/NEWS
   pkg/gmm/R/getModel.R
   pkg/gmm/R/gmm.R
Log:
Specified that an Intercept is present for the bw selection-- see NEWS

Modified: pkg/gmm/NEWS
===================================================================
--- pkg/gmm/NEWS	2017-08-15 15:56:33 UTC (rev 113)
+++ pkg/gmm/NEWS	2017-08-22 20:34:16 UTC (rev 114)
@@ -3,6 +3,9 @@
 o Fixed a bug with iterative GMM from the previous version
 o Added the option onlyCoefficients=FALSE to gmm() and gel(). If set to TRUE, no covariance matrix is computed. Only the coefficients
   objective and the lambdas (for gel only) are returned.
+o In previous versions, the HAC weighting matrix for linear models was computed without specifying that the first column of the
+  instrument matrix was a column of ones (with its name being "(Intercept)"). It makes a difference when computing the bandwidth with
+  bwNeweyWest. The new version, takes it into account. It is not possible to obtain the same sandwich covariance matrix with gmm and OLS.
 
 Changes in version 1.6-1
 

Modified: pkg/gmm/R/getModel.R
===================================================================
--- pkg/gmm/R/getModel.R	2017-08-15 15:56:33 UTC (rev 113)
+++ pkg/gmm/R/getModel.R	2017-08-22 20:34:16 UTC (rev 114)
@@ -217,6 +217,7 @@
                 attr(object$x, "k") <- object$x$k
                 attr(object$x, "q") <- object$x$ny*object$x$nh
                 attr(object$x, "n") <- NROW(object$x$x)
+                attr(object$x, "namesgt") <- object$namesgt
             } else {
                 attr(object$x,"ModelType") <- "nonlinear"
                 attr(object$x, "momentfct") <- object$g

Modified: pkg/gmm/R/gmm.R
===================================================================
--- pkg/gmm/R/gmm.R	2017-08-15 15:56:33 UTC (rev 113)
+++ pkg/gmm/R/gmm.R	2017-08-22 20:34:16 UTC (rev 114)
@@ -514,6 +514,8 @@
                 attr(w, "inv") <- FALSE
             } else {
                 gt <- .momentFct(tet,dat)
+                if (!is.null(attr(dat, "namesgt")))
+                    colnames(gt) <- attr(dat, "namesgt")
                 if(attr(dat, "weight")$centeredVcov)
                     gt <- scale(gt, scale=FALSE)
                 n <- NROW(gt)



More information about the Gmm-commits mailing list