gradient moyenne variance GMM
This commit is contained in:
parent
23984a21df
commit
ae40f58427
2 changed files with 45 additions and 0 deletions
25
R/mean.variance.GMM.gradient.R
Normal file
25
R/mean.variance.GMM.gradient.R
Normal file
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue