GMMStuff/R/objective.GMM.R
2014-03-08 00:41:05 -05:00

20 lines
No EOL
689 B
R

# Objective function for the GMM method
#
# Author: Francois Pelletier
#
# LGPL-3.0
###############################################################################
#' Objective function for the GMM method
#' @param param Vector of parameters
#' @param conditions.vector Vector of moment conditions
#' @param data Individual data sample
#' @param W Weighting matrix
#' @param ... Functions of the vector of moment conditions
#' @return A scalar value
#' @export objective.GMM
#' @author François Pelletier
objective.GMM <- function(param,conditions.vector,data,W,...)
{
as.vector(colMeans(conditions.vector(param,data,...)) %*% ginv(W) %*% colMeans(conditions.vector(param,data,...)))
}