residuals-methods: ~~ Methods for Function 'residuals' in Package 'stats' ~~

Description Methods Examples

Description

It computes the residual for a given coefficient vector, when the model is a linear of nonlinear regression with instruments. The method can be called on a gmmModels class for a given coefficient theta or on a gmmfit object.

Methods

signature(object = "rslinearGmm")
signature(object = "linearGmm")
signature(object = "nonlinearGmm")
signature(object = "gmmfit")
signature(object = "gelfit")
signature(object = "sgmmfit")
signature(object = "sysGmmModels")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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 <- gmmModel(y~x, ~z1+z2, data=dat)

## residuals for a given theta
e <- residuals(model1, theta)

## residuals of the fit
res <- modelFit(model1)
e <- residuals(res)

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