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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 25 21:17:22 CEST 2015


Author: chaussep
Date: 2015-08-25 21:17:21 +0200 (Tue, 25 Aug 2015)
New Revision: 78

Modified:
   pkg/gmm/DESCRIPTION
   pkg/gmm/NEWS
   pkg/gmm/R/FinRes.R
Log:
typo in FinRes.R

Modified: pkg/gmm/DESCRIPTION
===================================================================
--- pkg/gmm/DESCRIPTION	2015-02-13 20:51:24 UTC (rev 77)
+++ pkg/gmm/DESCRIPTION	2015-08-25 19:17:21 UTC (rev 78)
@@ -1,6 +1,6 @@
 Package: gmm
-Version: 1.5-2
-Date: 2015-02-02
+Version: 1.5-3
+Date: 2015-08-25
 Title: Generalized Method of Moments and Generalized Empirical
         Likelihood
 Author: Pierre Chausse <pchausse at uwaterloo.ca>

Modified: pkg/gmm/NEWS
===================================================================
--- pkg/gmm/NEWS	2015-02-13 20:51:24 UTC (rev 77)
+++ pkg/gmm/NEWS	2015-08-25 19:17:21 UTC (rev 78)
@@ -1,3 +1,7 @@
+Changes in version 1.5-3
+
+o Fixed a typo in FinRes.R file. It was preventing to compute the proper vcov matrix for a very special case (fixed weights)
+
 Changes in version 1.5-2
 
 o Added constrOptim to nonlinear gmm() with fixed W

Modified: pkg/gmm/R/FinRes.R
===================================================================
--- pkg/gmm/R/FinRes.R	2015-02-13 20:51:24 UTC (rev 77)
+++ pkg/gmm/R/FinRes.R	2015-08-25 19:17:21 UTC (rev 78)
@@ -19,7 +19,7 @@
   }
 
 FinRes.baseGmm.res <- function(z, object, ...)
-  {
+    {
   P <- object
   x <- z$dat
   n <- ifelse(is.null(nrow(z$gt)),length(z$gt),nrow(z$gt))
@@ -71,8 +71,7 @@
 	    object$WSpec$sandwich$bw <- attr(z$w0,"Spec")$bw
     v <- .myKernHAC(z$gt, object)
     z$v <- v
-    }
-
+    }  
   if (P$vcov == "TrueFixed") 
 	{
 	z$vcov=try(solve(crossprod(G, P$weightsMatrix) %*% G)/n, silent = TRUE)
@@ -80,16 +79,16 @@
            {
            z$vcov <- matrix(Inf,length(z$coef),length(z$coef))
            warning("The covariance matrix of the coefficients is singular")
-           }
+       }
 	}
-  else if (is.null(P$weigthsMatrix) & (P$wmatrix != "ident") )
+  else if ( (is.null(P$weightsMatrix)) & (P$wmatrix != "ident") )
 	{
  	z$vcov <- try(solve(crossprod(G, solve(v, G)))/n, silent = TRUE)
         if(class(z$vcov) == "try-error")
            {
            z$vcov <- matrix(Inf,length(z$coef),length(z$coef))
            warning("The covariance matrix of the coefficients is singular")
-           }
+       }
 	}
    else
      {
@@ -97,11 +96,11 @@
 	w <- diag(ncol(z$gt))
      else
 	w <- P$weightsMatrix
-
-     if (dim(G)[1] == dim(G)[2])	
+     if (dim(G)[1] == dim(G)[2]){
 	T1 <- try(solve(G), silent=TRUE)
-     else
-	T1 <- try(solve(t(G)%*%w%*%G,t(G)%*%w), silent = TRUE)
+     } else {
+         T1 <- try(solve(t(G)%*%w%*%G,t(G)%*%w), silent = TRUE)
+     }
      if(class(T1) == "try-error")
            {
            z$vcov <- matrix(Inf,length(z$coef),length(z$coef))



More information about the Gmm-commits mailing list