Description Usage Arguments Methods Examples
Method to fit a model using GMM, from an object of class "gmmModels"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ## S4 method for signature 'gmmModels'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, ...)
## S4 method for signature 'formulaGmm'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, ...)
## S4 method for signature 'sysGmmModels'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls", "EbyE"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, EbyE=FALSE, ...)
## S4 method for signature 'rnonlinearGmm'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, ...)
## S4 method for signature 'rlinearGmm'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, ...)
## S4 method for signature 'rformulaGmm'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, ...)
## S4 method for signature 'rslinearGmm'
modelFit(model, type=c("twostep", "iter","cue",
"onestep"), itertol=1e-7, initW=c("ident", "tsls", "EbyE"),
weights="optimal", itermaxit=100,
efficientWeights=FALSE, theta0=NULL, EbyE=FALSE, ...)
## S4 method for signature 'gelModels'
modelFit(model, gelType=NULL, rhoFct=NULL,
initTheta=c("gmm", "modelTheta0"), theta0=NULL,
lambda0=NULL, vcov=FALSE, ...)
## S4 method for signature 'rgelModels'
modelFit(model, gelType=NULL, rhoFct=NULL,
initTheta=c("gmm", "modelTheta0"), theta0=NULL,
lambda0=NULL, vcov=FALSE, ...)
|
model |
An object of class |
type |
What GMM methods should we use? for
|
itertol |
Tolance for the stopping rule in iterative GMM |
initW |
How should be compute the initial coefficient vector in
the first. For single equation GMM, it only makes a difference for
linear models for which the choice is GMM with identity matrix or
two-stage least quares. For system of equations, |
weights |
What weighting matrix to use? The choices are
|
itermaxit |
Maximum iterations for iterative GMM |
efficientWeights |
If |
theta0 |
An optional initial vector for |
EbyE |
Should we estimate the system equation by equation? |
... |
Arguments to pass to other methods (mostly the optimization algorithm) |
gelType |
The type of GEL. This argument is only used if we want
to fit the model with a different GEL method. see |
rhoFct |
An alternative objective function for GEL. This argument
is only used if we want to fit the model with a different GEL
method. see |
initTheta |
Method to obtain the starting values for the coefficient vector. By default the GMM estimate with identity matrix is used. The second argument means that the theta0 of the object, if any, should be used. |
lambda0 |
Manual starting values for the Lagrange multiplier. By default, it is a vector of zeros. |
vcov |
Should the method computes the covariance matrices of the coefficients and Lagrange multipliers. |
signature(model = "gmmModels")
The main method for all GMM-type models.
signature(model = "gelModels")
The main method for all GEL-type models.
signature(model = "rnonlinearGmm")
It makes a difference only if the number of contraints is equal to the
number of coefficients, in which case, the method evalModel
is called at the contrained vector. If not, the next method is called.
signature(model = "rformulaGmm")
It makes a difference only if the number of contraints is equal to the
number of coefficients, in which case, the method evalModel
is called at the contrained vector. If not, the next method is called.
signature(model = "rlinearGmm")
It makes a difference only if the number of contraints is equal to the
number of coefficients, in which case, the method evalModel
is called at the contrained vector. If not, the next method is called.
signature(model = "sysGmmModels")
Method to estimate system of equations using GMM methods.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | data(simData)
theta <- c(beta0=1,beta1=2)
model1 <- gmmModel(y~x1, ~z1+z2, data=simData)
## Efficient GMM with HAC vcov and tsls as first step.
res1 <- modelFit(model1, init="tsls")
## GMM with identity. Two ways.
res2 <- modelFit(model1, type="onestep")
res3 <- modelFit(model1, weights=diag(3))
## nonlinear regression with iterative GMM.
g <- y~beta0+x1^beta1
h <- ~z1+z2
model2 <- gmmModel(g, h, c(beta0=1, beta1=2), data=simData)
res4 <- modelFit(model2, type="iter")
## GMM for with no endogenous vaiables is
## OLS with Robust standard error
library(lmtest)
model3 <- gmmModel(y~x1, ~x1, data=simData, vcov="MDS")
resGmm <- modelFit(model3)
resLm <- lm(y~x1, simData)
summary(resGmm)
coeftest(resLm, vcov=vcovHC(resLm, "HC0"))
summary(resGmm, df.adj=TRUE)
coeftest(resLm, vcov=vcovHC(resLm, "HC1"))
### All constrained
R <- diag(2)
q <- c(1,2)
rmodel1 <- restModel(model1, R, q)
modelFit(rmodel1)
## Only one constraint
R <- matrix(c(0,1), ncol=2)
q <- 2
rmodel1 <- restModel(model1, R, q)
modelFit(rmodel1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.