gmm_est: Generalized Methods of Moments Estimation

Description Usage Arguments Details Value References See Also Examples

Description

Fitting a model by GMM

Usage

1
2
3
4
5
6
GmmEst(func, theta0, data,
    est_type=c("2step","1step","iter"), initial_W=NULL, 
    optim_method=c("BFGS","Nelder-Mead", "CG", "L-BFGS-B", "SANN"),
    control = GmmEst_control(...), ...)

GmmEst_control(maxit = 5000, tol_gmm_iter=1e-12, maxit_gmm_iter=100, ...)

Arguments

func

a user supplied function of the form f(theta,data), with the first input being a vector of the parameters, which are to be estimated. The function is assumed to return a (nobs x kmoms) matrix of moments.

theta0

a vector of initial values of the parameters.

data

a dataframe or matrix containing the necessary data to compute the moments.

est_type

Optional: One of 2step, 1step or iter. Default value is 2step.

initial_W

Optional: An initial weighting matrix of class matrix that can be supplied by the user. If not supplied, the identity matrix is used.

optim_method

Optional: The possible implemented methods in optim that are used to minimize the objective function. Default is BFGS.

control, maxit, tol_gmm_iter, maxit_gmm_iter

Optional: a list of control parameters passed to optim or used in an iterated GMM estimation. maxit defines the maximal number of iterations in optim, while tol_gmm_iter and maxit_gmm_iter are used in an iterated GMM procedure as stopping criteria. maxit_gmm_iter is the maximal number of iterations in the iterated GMM procedure. The iterated procedure stops if maxit_gmm_iter is exceeded or the norm of the difference of the estimated parameter vector is smaller than tol_gmm_iter.

...

Further arguments that can be passed to optim.

Details

Will be available soon

Value

An object of class "GmmEst".

References

Will be available soon

See Also

Will be available soon

Examples

 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
# Description (better example will be implemented soon)
# A minimal example of a regression estimated by two-step GMM based on the mtcars dataset

## Data
data(mtcars)

## User specified function
func = function(params, data){
  b0 = params[1]
  b1 = params[2]
  
  y = data$mpg
  x = data$hp
  
  yfit = b0 + b1*x
  eps = y - yfit
  
  gt1 = eps
  gt2 = eps*x
  
  gt = cbind(gt1, gt2)
  return(gt)
}

# Estimation
mod = GmmEst(func, c(mean(mtcars$mpg),0), mtcars)

GmmEst documentation built on July 4, 2017, 3:02 p.m.