[Gmm-commits] r102 - pkg/gmm/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 26 21:49:59 CEST 2017


Author: chaussep
Date: 2017-05-26 21:49:59 +0200 (Fri, 26 May 2017)
New Revision: 102

Modified:
   pkg/gmm/R/ategel.R
Log:
fixed ATEgel with single covariate

Modified: pkg/gmm/R/ategel.R
===================================================================
--- pkg/gmm/R/ategel.R	2017-05-19 20:51:09 UTC (rev 101)
+++ pkg/gmm/R/ategel.R	2017-05-26 19:49:59 UTC (rev 102)
@@ -52,7 +52,7 @@
             {
                 if (attr(dat, "momType") == "balSample")
                     {
-                        momB <- scale(x[,-(1:(k+1))], scale=FALSE)
+                        momB <- scale(x[,-(1:(k+1)),drop=FALSE], scale=FALSE)
                         gt <- cbind(gt, momB)
                     }
                 if (attr(dat, "momType") == "ATT")
@@ -88,7 +88,7 @@
         G11 <- lapply(1:k, function(i) -colSums(pt*Z[,i]*tau*Z))
         G[1:k, 1:k] <- do.call(rbind, G11)
         G[(k+1):(2*k-1), (k+1):(2*k-1)] <- -sum(pt)*diag(k-1)
-        uK <- colSums(pt*x[,-(1:(k+1))])
+        uK <- colSums(pt*x[,-(1:(k+1)),drop=FALSE])
         G[(2*k):q, (k+1):(2*k-1)] <- -kronecker(diag(k-1), uK)
         if (attr(dat, "momType") != "bal" | !is.null(attr(dat, "popMom")))
             G <- rbind(G, matrix(0, dat$nh, 2*k-1))
@@ -121,7 +121,7 @@
         rho2 <- .rho(x=gt, lamb=lam, derive=1, type=object$type)
         Z <- object$dat$x[,2:(k+1)]
         ZT <- c(Z%*%theta[1:k])
-        X <- object$dat$x[,-(1:(k+1))]
+        X <- object$dat$x[,-(1:(k+1)), drop=FALSE]
         family <- attr(object$dat, "family")
         momType <- attr(object$dat, "momType")
         popMom <-  attr(object$dat, "popMom")



More information about the Gmm-commits mailing list