Description Usage Arguments Methods References Examples
It performs the Durbin-Wu-Hausman test on GMM fit models.
1 2 3 4 5 6 7 8 9 10 |
object1 |
Object of class |
object2 |
Object of class |
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 |
signature(object1 = "gmmfit", object2 = "lm")
signature(object1 = "gmmfit", object2 = "gmmfit")
signature(object1 = "gmmfit", object2 = "missing")
Green, W.H.. (2012). Econometric Analysis, 7th edition, Prentice Hall.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.