It computes the matrix of derivatives of the sample moments with respect to the coefficients.
signature(object = "functionGmm")
signature(object = "gelModels")
signature(object = "formulaGmm")
signature(object = "regGmm")
signature(object = "sysGmmModels")
signature(object = "rslinearGmm")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | data(simData)
theta <- c(1,1)
model1 <- gmmModel(y~x1, ~z1+z2, data=simData)
G <- evalDMoment(model1, theta)
## A nonlinearGmm
g <- y~beta0+x1^beta1
h <- ~z1+z2
model2 <- gmmModel(g, h, c(beta0=1, beta1=2), data=simData)
G <- evalDMoment(model2, c(beta0=1, beta1=2))
## A functionGmm
fct <- function(tet, x)
{
m1 <- (tet[1] - x)
m2 <- (tet[2]^2 - (x - tet[1])^2)
m3 <- x^3 - tet[1]*(tet[1]^2 + 3*tet[2]^2)
f <- cbind(m1, m2, m3)
return(f)
}
dfct <- function(tet, x)
{
jacobian <- matrix(c( 1, 2*(-tet[1]+mean(x)), -3*tet[1]^2-3*tet[2]^2,0, 2*tet[2],
-6*tet[1]*tet[2]), nrow=3,ncol=2)
return(jacobian)
}
X <- rnorm(200)
model3 <- gmmModel(fct, X, theta0=c(beta0=1, beta1=2), grad=dfct)
G <- evalDMoment(model3, c(beta0=1, beta1=2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.