Learn R Programming

momentfit (version 0.5)

gelFit-methods: ~~ Methods for Function gelFit in Package momentfit ~~

Description

Method to fit a model using GEL, from an object of class "momentModel" or its restricted counterpart.

Usage

# S4 method for momentModel
gelFit(model, gelType="EL", rhoFct=NULL,
              initTheta=c("gmm", "modelTheta0"), theta0=NULL,
              lambda0=NULL, vcov=FALSE, ...)

# S4 method for rmomentModel gelFit(model, gelType="EL", rhoFct=NULL, initTheta=c("gmm", "modelTheta0"), theta0=NULL, lambda0=NULL, vcov=FALSE, ...)

Arguments

model

A model class object

gelType

The type of GEL. It is either "EL", "ET", "EEL", "HD", "ETEL" or "ETHD".

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 rhoFct.

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.

theta0

An optional initial vector for optim when the model is nonlinear. If provided, the argument "initTheta" is ignored.

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.

...

Arguments to pass to other methods (mostly the optimization algorithm)

Methods

signature(model = "momentModel")

The main method for all moment-based models.

signature(model = "rmomentModel")

The main method for all restricted moment-based models.

Examples

Run this code
data(simData)

theta <- c(beta0=1,beta1=2)
model1 <- momentModel(y~x1, ~z1+z2, data=simData)

## EL estimate
res1 <- gelFit(model1)
res1

## ET estimate
res2 <- gelFit(model1, gelType="ET")
res2

## Restricted models by EL
## using the Brent method
R <- matrix(c(0,1), ncol=2)
q <- 2
rmodel1 <- restModel(model1, R, q)
gelFit(rmodel1, tControl=list(method="Brent", lower=-10, upper=10))

Run the code above in your browser using DataLab