DWH-methods: ~~ Methods for Function 'DWH' in Package 'gmm4' ~~

Description Usage Arguments Methods References Examples

Description

It performs the Durbin-Wu-Hausman test on GMM fit models.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## S4 method for signature 'gmmfit,missing'
DWH(object1, object2)

## S4 method for signature 'gmmfit,lm'
DWH(object1, object2,
tol=sqrt(.Machine$double.eps), v1=NULL, v2=NULL, ...)

## S4 method for signature 'gmmfit,gmmfit'
DWH(object1, object2,
tol=sqrt(.Machine$double.eps), v1=NULL, v2=NULL, ...)

Arguments

object1

Object of class "gmmfit".

object2

Object of class "gmmfit" or "lm". If missing, the DWH test is a two step test in which the fitted endogenous variables from the first step are added to the regression. In that case, the test a a test of significance of the coefficients of the fitted endogenous variables.

v1

Alternatively, we can provide a different covariance matrix for object1

v2

Alternatively, we can provide a different covariance matrix for object2

tol

Tolerance for the Moore-Penrose generalized inverse

...

Argument to pass to vcov

Methods

signature(object1 = "gmmfit", object2 = "lm")
signature(object1 = "gmmfit", object2 = "gmmfit")
signature(object1 = "gmmfit", object2 = "missing")

References

Green, W.H.. (2012). Econometric Analysis, 7th edition, Prentice Hall.

Examples

 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
39
40
### Exampe 8.7 of Greene (2012)
data(ConsumptionG)
Y <- ConsumptionG$REALDPI
C <- ConsumptionG$REALCONS
n <- nrow(ConsumptionG)
Y1 <- Y[-n]; Y <- Y[-1]
C1 <- C[-n]; C <- C[-1]
dat <- data.frame(Y=Y,Y1=Y1,C=C,C1=C1)



model1 <- gmmModel(C~Y, ~Y, data=dat, vcov="iid")
model2 <- gmmModel(C~Y, ~Y1+C1, data=dat, vcov="iid")
res1 <- tsls(model1)
res2 <- tsls(model2)
res <- lm(C~Y)

## Exampke 8.7-2. The difference is explained by the rounding
## error in Greene. Only the first the 3 digits of the t-test are used.
DWH(res2)

## Example 8.7-1. Not quite the same.
DWH(res2, res1)

## using lm object to compare OLS and 2SLS:
## The same adjustment on the vcov must be done (it is by default in lm)
## otherwise the different in the covariance matrices is mostly caused by the
## different ways to compute them.
DWH(res2, res, df.adj=TRUE)

## To reproduce the same results as Exampke 8.7-1,
## we need to specify the variance.
## But it is not necessary as the above way is
## asymptotically equivalent
X <- model.matrix(model1)
Xhat <- qr.fitted(res2@wObj@w, X)
s2 <- sum(residuals(res)^2)/(res$df.residual)
v1 <-  solve(crossprod(Xhat))*s2
v2 <- solve(crossprod(X))*s2
DWH(res2, res, v1=v1, v2=v2)

gmm4 documentation built on Dec. 6, 2019, 3:01 a.m.