2014-02-28 04:07:02 +00:00
|
|
|
# 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
|
2014-03-06 00:25:03 +00:00
|
|
|
#' @param Data Data sample
|
|
|
|
#' @param type Choose between "mu" or "kappa" parametrization
|
2014-02-28 04:07:02 +00:00
|
|
|
#' @return gradient matrix
|
2014-03-06 02:44:52 +00:00
|
|
|
#' @export mean.variance.GMM.gradient.GAL
|
2014-02-28 04:07:02 +00:00
|
|
|
#' @author François Pelletier
|
2014-03-06 02:44:52 +00:00
|
|
|
mean.variance.GMM.gradient.GAL <- function(param,Data,type="mu")
|
2014-02-28 04:07:02 +00:00
|
|
|
{
|
|
|
|
if(type=="mu")
|
|
|
|
{
|
2014-03-06 02:44:52 +00:00
|
|
|
return(matrix(c(-1,0,-param[4],-param[3],
|
2014-02-28 04:07:02 +00:00
|
|
|
-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),
|
2014-03-06 02:44:52 +00:00
|
|
|
nrow=4,ncol=2))
|
2014-02-28 04:07:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|