From ae40f584277f2939a22c0796e269bae01c429f2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pelletier?= Date: Thu, 27 Feb 2014 23:07:02 -0500 Subject: [PATCH] gradient moyenne variance GMM --- R/mean.variance.GMM.gradient.R | 25 +++++++++++++++++++++++++ man/mean.variance.GMM.gradient.Rd | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 R/mean.variance.GMM.gradient.R create mode 100644 man/mean.variance.GMM.gradient.Rd diff --git a/R/mean.variance.GMM.gradient.R b/R/mean.variance.GMM.gradient.R new file mode 100644 index 0000000..5d83fef --- /dev/null +++ b/R/mean.variance.GMM.gradient.R @@ -0,0 +1,25 @@ +# Gradient of the GMM moment conditions on mean and variance +# +# Author: Francois Pelletier +# +# LGPL-3.0 +############################################################################### + + +#' Gradient of the GMM moment conditions on mean and variance +#' +#' Derivative of the moment conditions according to the vector of parameters +#' @param param GAL parameters +#' @return gradient matrix +#' +#' @author François Pelletier +mean.variance.GMM.gradient <- function(param,Data,type="mu") +{ + if(type=="mu") + { + matrix(c(-1,0,-param[4],-param[3], + -2*(mean(Data)-param[1]-param[3]*param[4]),-2*param[2]*param[4],2*param[4]*(mean(Data)-param[1]-param[3]*param[4])+2*param[3]*param[4],-2*param[3]*(mean(Data)-param[1]-param[3]*param[4])-param[2]^2-param[3]^2), + nrow=4,ncol=2) + } +} + diff --git a/man/mean.variance.GMM.gradient.Rd b/man/mean.variance.GMM.gradient.Rd new file mode 100644 index 0000000..84ba393 --- /dev/null +++ b/man/mean.variance.GMM.gradient.Rd @@ -0,0 +1,20 @@ +\name{mean.variance.GMM.gradient} +\alias{mean.variance.GMM.gradient} +\title{Gradient of the GMM moment conditions on mean and variance} +\usage{ +\method{mean}{variance.GMM.gradient}(param, Data, type = "mu") +} +\arguments{ + \item{param}{GAL parameters} +} +\value{ +gradient matrix +} +\description{ +Derivative of the moment conditions according to the vector +of parameters +} +\author{ +François Pelletier +} +