[Gmm-commits] r173 - in pkg: causalGel causalGel/R causalGel/man momentfit momentfit/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 3 21:17:06 CET 2020


Author: chaussep
Date: 2020-11-03 21:17:06 +0100 (Tue, 03 Nov 2020)
New Revision: 173

Modified:
   pkg/causalGel/DESCRIPTION
   pkg/causalGel/R/causalGel.R
   pkg/causalGel/R/causalMethods.R
   pkg/causalGel/man/causalModel.Rd
   pkg/momentfit/DESCRIPTION
   pkg/momentfit/R/momentModel-methods.R
Log:
fixed a bug with vcov of causal models with population moments

Modified: pkg/causalGel/DESCRIPTION
===================================================================
--- pkg/causalGel/DESCRIPTION	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/causalGel/DESCRIPTION	2020-11-03 20:17:06 UTC (rev 173)
@@ -1,12 +1,12 @@
 Package: causalGel
-Version: 0.0-1
-Date: 2020-01-20
+Version: 0.1-0
+Date: 2020-11-03
 Title: Causal Inference using Generalized Empirical
         Likelihood Methods
 Author: Pierre Chausse <pchausse at uwaterloo.ca>
 Maintainer: Pierre Chausse <pchausse at uwaterloo.ca>
 Description: Methods for causal inference in which covariates are balanced using generalized empirical likelihod methods.
-Depends: R (>= 3.0.0), momentfit (>= 0.1.0)
+Depends: R (>= 3.0.0), momentfit (>= 0.1.1)
 Imports: stats, methods
 Suggests: lmtest, knitr, texreg
 Collate: 'allClasses.R' 'causalMethods.R' 'rcausalMethods.R' 'causalGel.R'

Modified: pkg/causalGel/R/causalGel.R
===================================================================
--- pkg/causalGel/R/causalGel.R	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/causalGel/R/causalGel.R	2020-11-03 20:17:06 UTC (rev 173)
@@ -1,7 +1,7 @@
 ## Model builder
 
 causalModel <- function(g, balm, data,theta0=NULL,
-                      momType=c("ACE","ACT","ACC", "uncondBal","fixedMom"),
+                      momType=c("ACE","ACT","ACC", "uncondBal"),
                       popMom = NULL, ACTmom=1L) 
 {
     momType <- match.arg(momType)
@@ -8,10 +8,7 @@
     if (!is.null(popMom))
         {
             momType <- "fixedMom"
-        } else {
-            if (momType == "fixedMom")
-                stop("With fixed moments, popMom must be provided")
-        }    
+        }
     tmp_model <- momentfit:::.lModelData(g, balm, data)
     if (attr(terms(tmp_model$modelF), "intercept") != 1)
         stop("You cannot remove the intercept from g")

Modified: pkg/causalGel/R/causalMethods.R
===================================================================
--- pkg/causalGel/R/causalMethods.R	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/causalGel/R/causalMethods.R	2020-11-03 20:17:06 UTC (rev 173)
@@ -39,8 +39,8 @@
               G[(k+1):ntet, (k+1):ntet] <- -sum(impProb)*diag(k-1)
               uK <- colSums(impProb*X[,-1,drop=FALSE])
               G[(2*k):q, (k+1):ntet] <- -kronecker(diag(k-1), uK)
-              if (dat at momType != "uncondBal" |  dat at momType=="fixedMom")
-                  {
+              if (!(dat at momType %in% c("uncondBal", "fixedMom")))
+              {
                       G <- rbind(G, matrix(0, ncol(X)-1, ntet))
                       if (augmented)
                       {

Modified: pkg/causalGel/man/causalModel.Rd
===================================================================
--- pkg/causalGel/man/causalModel.Rd	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/causalGel/man/causalModel.Rd	2020-11-03 20:17:06 UTC (rev 173)
@@ -10,7 +10,7 @@
 }
 \usage{
 causalModel(g, balm, data,theta0=NULL,
-            momType=c("ACE","ACT","ACC", "uncondBal","fixedMom"),
+            momType=c("ACE","ACT","ACC", "uncondBal"),
             popMom = NULL, ACTmom=1L) 
 }
 \arguments{

Modified: pkg/momentfit/DESCRIPTION
===================================================================
--- pkg/momentfit/DESCRIPTION	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/momentfit/DESCRIPTION	2020-11-03 20:17:06 UTC (rev 173)
@@ -1,6 +1,6 @@
 Package: momentfit
-Version: 0.1-1
-Date: 2020-05-27
+Version: 0.1-2
+Date: 2020-11-02
 Title: Methods of Moments
 Author: Pierre Chausse <pchausse at uwaterloo.ca>
 Maintainer: Pierre Chausse <pchausse at uwaterloo.ca>

Modified: pkg/momentfit/R/momentModel-methods.R
===================================================================
--- pkg/momentfit/R/momentModel-methods.R	2020-05-27 15:28:22 UTC (rev 172)
+++ pkg/momentfit/R/momentModel-methods.R	2020-11-03 20:17:06 UTC (rev 173)
@@ -168,7 +168,7 @@
           function(object, theta)
               {
                   res <- modelDims(object)
-                  theta <- setCoef(object, theta)
+                  theta <- coef(object, setCoef(object, theta))
                   varList <- c(as.list(theta), as.list(object at modelF))
                   if (!is.null(res$fLHS))
                       {
@@ -200,7 +200,7 @@
 
 setMethod("evalMoment", signature("functionModel"),
           function(object, theta) {
-              theta <- setCoef(object, theta)
+              theta <- coef(object, setCoef(object, theta))              
               gt <- object at fct(theta, object at X)
               if (!is.null(sub <- attr(object at X, "subset")))
                   gt <- gt[,sub]
@@ -212,7 +212,7 @@
 setMethod("evalMoment", signature("formulaModel"),
           function(object, theta) {
               res <- modelDims(object)
-              theta <- setCoef(object, theta)
+              theta <- coef(object, setCoef(object, theta))              
               varList <- c(as.list(theta), as.list(object at modelF))
               gt <- sapply(1:res$q, function(i) {
                   if (!is.null(res$fLHS[[i]]))
@@ -249,7 +249,7 @@
 
 setMethod("Dresiduals", signature("nonlinearModel"),
           function(object, theta) {
-              theta <- setCoef(object, theta)
+              theta <- coef(object, setCoef(object, theta))              
               res <- modelDims(object)
               varList <- c(as.list(theta), as.list(object at modelF))
               De <- numeric()
@@ -354,7 +354,7 @@
           function(object, theta, impProb=NULL, lambda=NULL)
           {
               spec <- modelDims(object)
-              theta <- setCoef(object, theta)
+              theta <- coef(object, setCoef(object, theta))              
               if (object at smooth && !is.null(object at dfct))
               {
                   object at dfct <- NULL
@@ -411,7 +411,7 @@
 setMethod("evalDMoment", signature("formulaModel"),
           function(object, theta, impProb=NULL, lambda=NULL)
           {
-              theta <- setCoef(object, theta)
+              theta <- coef(object, setCoef(object, theta))              
               spec <- modelDims(object)              
               if (is.null(impProb))
                   impProb <- 1/spec$n
@@ -962,7 +962,7 @@
                  wObj <- evalWeights(model, NULL, "ident")
                  theta0 <- solveGmm(model, wObj, theta0, ...)$theta
              }
-             bw <- model at vcovOptions$bw             
+             bw <- model at vcovOptions$bw
              if (type != "cue")
              {
                  while(TRUE)



More information about the Gmm-commits mailing list