From 3aecd56cc48e2ea24fa395cb934e64ab6c4db8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Sat, 8 Mar 2014 00:41:05 -0500 Subject: [PATCH] Correction iterative GMM --- R/iterative.GMM.R | 11 ++++------- R/mean.variance.gmm.vector.R | 6 +++--- R/objective.GMM.R | 2 +- R/optim.GMM.R | 2 +- man/iterative.GMM.Rd | 10 ++-------- man/meanvariance.gmm.vector.Rd | 4 ++-- man/objective.GMM.Rd | 4 ++-- man/optim.GMM.Rd | 4 ++-- 8 files changed, 17 insertions(+), 26 deletions(-) diff --git a/R/iterative.GMM.R b/R/iterative.GMM.R index 7b02b0d..8774529 100644 --- a/R/iterative.GMM.R +++ b/R/iterative.GMM.R @@ -10,23 +10,20 @@ #' @param start Starting values for the parameters and lagrangian #' @param conditions.vector Vector of moment conditions #' @param data Individual data sample -#' @param ... Functions of the vector of moment conditions #' @param W Weighting matrix -#' @param R Linear constraint matrix of coefficients -#' @param r Linear constraint constants +#' @param ... Functions of the vector of moment conditions #' @param max.iter Maximum number of iterations #' @param epsilon Minimum precision level #' @return A list containing the optimized vector of parameter and corresponding covariance matrix #' @export iterative.GMM #' @author François Pelletier -iterative.GMM <- function(start,conditions.vector,data,..., - W=diag(length(conditions.vector)),R=0,r=0,lagrangian.start=rep(0,length(conditions.vector)),max.iter=50,epsilon=1E-6) +iterative.GMM <- function(start,conditions.vector,data,W,...,max.iter=50,epsilon=1E-6) { - theta1 <- optim.GMM(start,conditions.vector,data,...,W,R,r,lagrangian.start) + theta1 <- optim.GMM(start,conditions.vector,data,W,...) i <- 1 repeat { - theta2 <- optim.GMM(theta1,conditions.vector,data,...,W,R,r,lagrangian.start) + theta2 <- optim.GMM(theta1,conditions.vector,data,W,...) S <- covariance.GMM(conditions.vector,param,data,...) if(sqrt(sum((theta1-theta2)^2))