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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 13 21:51:24 CET 2015


Author: chaussep
Date: 2015-02-13 21:51:24 +0100 (Fri, 13 Feb 2015)
New Revision: 77

Modified:
   pkg/gmm/DESCRIPTION
   pkg/gmm/NEWS
   pkg/gmm/R/momentEstim.R
Log:
Added constrOptim to fixed W gmm

Modified: pkg/gmm/DESCRIPTION
===================================================================
--- pkg/gmm/DESCRIPTION	2015-02-06 22:50:15 UTC (rev 76)
+++ pkg/gmm/DESCRIPTION	2015-02-13 20:51:24 UTC (rev 77)
@@ -1,5 +1,5 @@
 Package: gmm
-Version: 1.5-1
+Version: 1.5-2
 Date: 2015-02-02
 Title: Generalized Method of Moments and Generalized Empirical
         Likelihood

Modified: pkg/gmm/NEWS
===================================================================
--- pkg/gmm/NEWS	2015-02-06 22:50:15 UTC (rev 76)
+++ pkg/gmm/NEWS	2015-02-13 20:51:24 UTC (rev 77)
@@ -1,3 +1,7 @@
+Changes in version 1.5-2
+
+o Added constrOptim to nonlinear gmm() with fixed W
+
 Changes in version 1.5-1
 
 o Added importFrom element

Modified: pkg/gmm/R/momentEstim.R
===================================================================
--- pkg/gmm/R/momentEstim.R	2015-02-06 22:50:15 UTC (rev 76)
+++ pkg/gmm/R/momentEstim.R	2015-02-13 20:51:24 UTC (rev 77)
@@ -992,6 +992,20 @@
       res2 <- optim(P$t0, .obj1, x = P$x, w = w, gf = P$g, INV = FALSE,  ...)
     }
 
+  if (P$optfct == "constrOptim")
+	{
+	if (!any(c("ui","ci") %in% names(list(...))))
+		stop("You must specify ui and ci when optfct is set to constrOptim")
+	argDots <- list(...)
+	ui <- argDots$ui
+	ci <- argDots$ci
+	argDots$ui <- NULL
+	argDots$ci <- NULL
+      	allArgOptim <- list(theta = P$t0, f = .obj1, grad = NULL, ui = ui, ci = ci, x = P$x, w = w, gf = P$g, INV = FALSE)
+        allArgOptim <- c(allArgOptim,argDots)
+	res2 <- do.call(constrOptim,allArgOptim)
+	}
+  
   if (P$optfct == "nlminb")
     {
     res2 <- nlminb(P$t0, .obj1, x = P$x, w = w, gf = P$g, INV = FALSE, ...)



More information about the Gmm-commits mailing list