model.matrix-methods {momentfit} | R Documentation |
~~ Methods for Function model.matrix
in Package stats ~~
Description
Model matrix form momentModel
. It returns the matrix of regressors
or the instruments. In restricted models, it returns the reduced matrix
of regressors.
Usage
## S4 method for signature 'linearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'rlinearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'nonlinearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'slinearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'rslinearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'rsnonlinearModel'
model.matrix(object,
type=c("regressors","instruments"))
## S4 method for signature 'snonlinearModel'
model.matrix(object,
type=c("regressors","instruments"))
Arguments
object |
Object of class |
type |
Should the function returns the matrix of instruments or the
matrix of regressors. For |
Methods
signature(object = "linearModel")
-
Linear models with not restrictions.
signature(object = "nonlinearModel")
-
Nonlinear models with not restrictions.
signature(object = "rlinearModel")
-
linear models with restrictions.
signature(object = "slinearModel")
-
System of linear equations with no restrictions.
signature(object = "rslinearModel")
-
System of linear equations with restrictions.
signature(object = "rsnonlinearModel")
-
System of nonlinear equations with restrictions.
signature(object = "snonlinearModel")
-
System of nonlinear equations with no restrictions.
Examples
data(simData)
## Unrestricted model
model1 <- momentModel(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,]