## Example 15.1 of Wooldridge (2016)
data(Mroz)
Mroz <- subset(Mroz, hours>0)
## I guess IID is assumed (That's how we get the same s.e.)
## By default a sandwich vcov is computed because it is
## a just-identified model.
res4 <- gmm4(log(wage)~educ, ~fatheduc, vcov="iid", data=Mroz)
summary(res4)
## If we adjust the variance of the residuals, however,
## we are a little off (very little)
summary(res4, df.adj=TRUE)
## Example 15.5 of Wooldridge (2016)
## Need to adjust for degrees of freedom in order
## to get the same s.e.
## The first stage F-test is very different though
## Cannot get the same even if do it manually
## with the linearHypothesis from the car package
model <- momentModel(log(wage)~educ+exper+I(exper^2),
~exper+I(exper^2)+fatheduc+motheduc, vcov="iid", data=Mroz)
res <- tsls(model)
summary(res, df.adj=TRUE)
Run the code above in your browser using DataLab