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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Feb 25 20:09:11 CET 2013


Author: chaussep
Date: 2013-02-25 20:09:11 +0100 (Mon, 25 Feb 2013)
New Revision: 69

Modified:
   pkg/gmm/DESCRIPTION
   pkg/gmm/NEWS
   pkg/gmm/R/gel.R
   pkg/gmm/R/getModel.R
   pkg/gmm/man/gel.Rd
Log:
Added data option to gel()

Modified: pkg/gmm/DESCRIPTION
===================================================================
--- pkg/gmm/DESCRIPTION	2013-01-10 17:57:19 UTC (rev 68)
+++ pkg/gmm/DESCRIPTION	2013-02-25 19:09:11 UTC (rev 69)
@@ -1,6 +1,6 @@
 Package: gmm
-Version: 1.4-5
-Date: 2013-01-10
+Version: 1.4-6
+Date: 2013-02-25
 Title: Generalized Method of Moments and Generalized Empirical
         Likelihood
 Author: Pierre Chausse <pchausse at uwaterloo.ca>

Modified: pkg/gmm/NEWS
===================================================================
--- pkg/gmm/NEWS	2013-01-10 17:57:19 UTC (rev 68)
+++ pkg/gmm/NEWS	2013-02-25 19:09:11 UTC (rev 69)
@@ -1,3 +1,7 @@
+Changes in version 1.4-6
+
+o Added the possibility of providing data.frame() with formula to gel()
+
 Changes in version 1.4-5
 
 o Replaced the deprecated function real(), is.real() and as.real() by double()

Modified: pkg/gmm/R/gel.R
===================================================================
--- pkg/gmm/R/gel.R	2013-01-10 17:57:19 UTC (rev 68)
+++ pkg/gmm/R/gel.R	2013-02-25 19:09:11 UTC (rev 69)
@@ -216,7 +216,7 @@
                 kernel = c("Truncated", "Bartlett"), bw = bwAndrews, approx = c("AR(1)", 
     		"ARMA(1,1)"), prewhite = 1, ar.method = "ols", tol_weights = 1e-7, tol_lam = 1e-9, tol_obj = 1e-9, 
 		tol_mom = 1e-9, maxiterlam = 100, constraint = FALSE, optfct = c("optim", "optimize", "nlminb"), 
-                optlam = c("nlminb", "optim", "iter"), Lambdacontrol = list(), model = TRUE, X = FALSE, Y = FALSE, TypeGel = "baseGel", alpha = NULL, ...)
+                optlam = c("nlminb", "optim", "iter"), data, Lambdacontrol = list(), model = TRUE, X = FALSE, Y = FALSE, TypeGel = "baseGel", alpha = NULL, ...)
 	{
 
 	type <- match.arg(type)
@@ -225,13 +225,14 @@
 	weights <- weightsAndrews
 	approx <- match.arg(approx)
 	kernel <- match.arg(kernel)
-
+	if(missing(data))
+		data<-NULL
 	all_args <- list(g = g, x = x, tet0 = tet0, gradv = gradv, smooth = smooth, type = type,
                 kernel = kernel, bw = bw, approx = approx, prewhite = prewhite, ar.method = ar.method, 
 		tol_weights = tol_weights, tol_lam = tol_lam, tol_obj = tol_obj, tol_mom = tol_mom, 
 		maxiterlam = maxiterlam, constraint = constraint, optfct = optfct, weights = weights,
                 optlam = optlam, model = model, X = X, Y = Y, TypeGel = TypeGel, call = match.call(), 
-		Lambdacontrol = Lambdacontrol, alpha = alpha)
+		Lambdacontrol = Lambdacontrol, alpha = alpha, data = data)
 
 	class(all_args)<-TypeGel
 	Model_info<-getModel(all_args)

Modified: pkg/gmm/R/getModel.R
===================================================================
--- pkg/gmm/R/getModel.R	2013-01-10 17:57:19 UTC (rev 68)
+++ pkg/gmm/R/getModel.R	2013-02-25 19:09:11 UTC (rev 69)
@@ -250,7 +250,12 @@
   if (is(P$g, "formula"))
     {
     clname <- paste(class(P), ".modFormula", sep = "")
-    dat <- getDat(P$g, P$x)
+    if (is.null(P$data))
+    	dat <- getDat(P$g, P$x)
+    else
+    	dat <- getDat(P$g, P$x, P$data)
+    if (P$k != dat$k)
+	stop("The length of tet0 does not match the number of regressors")
 
     g <- function(tet, dat)
       {

Modified: pkg/gmm/man/gel.Rd
===================================================================
--- pkg/gmm/man/gel.Rd	2013-01-10 17:57:19 UTC (rev 68)
+++ pkg/gmm/man/gel.Rd	2013-02-25 19:09:11 UTC (rev 69)
@@ -12,7 +12,7 @@
     kernel = c("Truncated", "Bartlett"), bw = bwAndrews, 
     approx = c("AR(1)", "ARMA(1,1)"), prewhite = 1, ar.method = "ols", tol_weights = 1e-7, 
     tol_lam = 1e-9, tol_obj = 1e-9, tol_mom = 1e-9, maxiterlam = 100, constraint = FALSE,
-    optfct = c("optim", "optimize", "nlminb"), optlam = c("nlminb", "optim", "iter"), Lambdacontrol = list(), model = TRUE, 
+    optfct = c("optim", "optimize", "nlminb"), optlam = c("nlminb", "optim", "iter"), data, Lambdacontrol = list(), model = TRUE, 
     X = FALSE, Y = FALSE, TypeGel = "baseGel", alpha = NULL, ...)
 }
 \arguments{
@@ -54,6 +54,8 @@
 
 \item{optlam}{The default is "iter" which solves for \eqn{\lambda} using the Newton iterative method \code{\link{getLamb}}. If set to "numeric", the algorithm \code{\link{optim}} is used to compute \eqn{\lambda} instead.}
 
+\item{data}{A data.frame or a matrix with column names (Optional). }
+
 \item{Lambdacontrol}{Controls for the optimization of the vector of Lagrange multipliers used by either \code{\link{optim}}, \code{\link{nlminb}} or \code{\link{constrOptim}}}
 
 \item{model, X, Y}{logicals.  If \code{TRUE} the corresponding components of the fit (the model frame, the model matrix, the response) are returned if g is a formula.}



More information about the Gmm-commits mailing list