x <- rchisq(200,5)
z1 <- rnorm(200)
z2 <- .2*x+rnorm(200)
y <- x+rnorm(200)
dat <- data.frame(y=y,z1=z1,x=x,z2=z2)
theta <- c(beta0=1,beta1=2)
model1 <- momentModel(y~x, ~z1+z2, data=dat)
## residuals for a given theta
e <- residuals(model1, theta)
## residuals of the fit
res <- gmmFit(model1)
e <- residuals(res)
Run the code above in your browser using DataLab