Description Usage Arguments Methods Examples
Compute several results from a GMM fit.
1 2 3 4 5 6 7 8 |
object |
GMM fit object |
... |
Other arguments to pass to |
signature(object = "gmmfit")
signature(object = "sgmmfit")
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 30 31 32 33 34 35 36 37 38 | data(simData)
theta <- c(beta0=1,beta1=2)
model1 <- gmmModel(y~x1, ~z1+z2, data=simData)
res <- modelFit(model1)
summary(res)
## Fixed and True Weights matrix
## Consider the moment of a normal distribution:
## Using the first three non centered moments
g <- function(theta, x)
{
mu <- theta[1]
sig2 <- theta[2]
m1 <- x-mu
m2 <- x^2-mu^2-sig2
m3 <- x^3-mu^3-3*mu*sig2
cbind(m1,m2,m3)
}
dg <- function(theta, x)
{
mu <- theta[1]
sig2 <- theta[2]
G <- matrix(c(-1,-2*mu,-3*mu^2-3*sig2, 0, -1, -3*mu),3,2)
}
x <- simData$x3
model <- gmmModel(g, x, c(mu=.1, sig2=1.5), vcov="iid")
res1 <- modelFit(model)
summary(res1)
## Same results (that's because the moment vcov is centered by default)
W <- solve(var(cbind(x,x^2,x^3)))
res2 <- modelFit(model, weights=W)
res2
## If is therefore more efficient in this case to do the following:
summary(res2, breadOnly=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.