specTest-methods: ~~ Methods for Function 'specTest' in Package 'momentfit' ~~

specTest-methodsR Documentation

~~ Methods for Function specTest in Package momentfit ~~

Description

It computes tests of specification for GMM fit.

Usage

## S4 method for signature 'gmmfit,missing'
specTest(object, which, df.adj=FALSE, wObj=NULL)

## S4 method for signature 'sgmmfit,missing'
specTest(object, which, df.adj=FALSE, wObj=NULL)

## S4 method for signature 'gmmfit,numeric'
specTest(object, which)

## S4 method for signature 'gelfit,missing'
specTest(object, which,
                    type = c("All", "LR", "LM", "J"))

Arguments

object

GMM or GEL fit object

which

Which sub-moment conditions to test.

df.adj

Should we adjust the covariance matrix of the moment conditions for degrees of freedom. If TRUE the covariance matrix is multiplied by n/(n-k), where n is the sample size and k is the number of coefficients. For heteroscedastic robust covariance matrix, adjusting is equivalent to computing HC1 while not adjusting is HC0.

wObj

An object of class gmmWeights. If NULL (the recommended value), the optimal weights is computed at the fitted coefficient estimates. It is used by hypothesisTest if one wants the LR statistics to be computed using the same weights for the restricted and unrestricted model.

type

For GEL, three specification tests are available

Methods

signature(object = "gmmfit", which="missing")
signature(object = "sgmmfit", which="missing")
signature(object = "gmmfit", which="numeric")

References

Eichenbaum, M. and Hansen L. and Singleton, K. (1985). A time Series Analysis of Representative Agent Models of Consumption and Leisure Choise under Uncertainty. Quarterly Journal of Economics, 103, 51–78.

Hayashi, F. (2000). Econometrics, New Jersey: Princeton University Press.

Examples

data(simData)
model1 <- momentModel(y~x1, ~z1+z2, data=simData)

res <- gmmFit(model1)
specTest(res)

## Hayashi Example 3.3 (there is not result in the book but
## that's how we would do it for YEAR=1967
data(Griliches)
dat <- subset(Griliches, YEAR==67)
model <- momentModel(LW~S+EXPR+IQ, ~S+EXPR+AGE+MED, data=dat, vcov="MDS")
res <- gmmFit(model)
## testing the orthogonality conditions of S
specTest(res, 2)


momentfit documentation built on Sept. 20, 2023, 3:01 a.m.