model.matrix-methods: ~~ Methods for Function 'model.matrix' in Package 'stats' ~~

Description Usage Arguments Methods Examples

Description

Model matrix form gmmModels. It returns the matrix of regressors or the instruments. In restricted models, it returns the reduced matrix of regressors.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S4 method for signature 'linearGmm'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'rlinearGmm'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'nonlinearGmm'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'slinearGmm'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'rslinearGmm'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'snonlinearGmm'
model.matrix(object,
type=c("regressors","instruments"))

Arguments

object

Object of class linearGmm, rlinearGmm or any system of equations class.

type

Should the function returns the matrix of instruments or the matrix of regressors. For nonlinearGmm classes, type='regressors' will produce an error message, because there is no such model matrix in this case, at least not for now.

Methods

signature(object = "linearGmm")

Linear models with not restrictions.

signature(object = "nonlinearGmm")

Nonlinear models with not restrictions.

signature(object = "rlinearGmm")

linear models with restrictions.

signature(object = "slinearGmm")

System of linear equations with no restrictions.

signature(object = "rslinearGmm")

System of linear equations with restrictions.

signature(object = "snonlinearGmm")

System of nonlinear equations with no restrictions.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(simData)

## Unrestricted model
model1 <- gmmModel(y~x1+x2+x3, ~x2+x3+z1+z2, data=simData)
model.matrix(model1)[1:3,]

## Restrictions change the response
R <- c("x2=2","x3+x1=3")
rmodel1 <- restModel(model1, R)
rmodel1
model.matrix(rmodel1)[1:3,]

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