Generalized Method of Moments
gmmout =gmm1(Y,b,gmmopt,X,Z,Win)
* Y = dependent variable vector (nobs x 1)
* b = vector of starting values for parameters
* gmmopt = a tlist (with 'gmm' as type) wich argument can be [default]:
- gmmopt('momt') = filename of moment conditions REQUIRED
- gmmopt('jake') = filename of Jacobian of moment condition ['numz0']
- gmmopt('namep') = a vector containing the name of the parameters (optional)
- gmmopt('gmmit') = number of GMM iterations [2]
- gmmopt('maxit') = cap on number of GMM iterations [25]
- gmmopt('tol') = convergence criteria for iterated GMM [1e-7]
- gmmopt('W0') = initial GMM weighting matrix ['Z'],
. 'I' = identity
. 'Z' = instruments (Z'Z)
. 'C' = calculate from b
. 'Win' = Fixed passed as Win
. myfile = user's own sci-file
-gmmopt('W') = subsequent GMM weighting matrix ['S'], inverse spectral density from gmmS
- gmmopt('S') = type of spectral density matrix ['NW'],
. 'W'=White
. NW'=Newey-West (Bartlett)
. 'G'=Gallant (Parzen)
. 'H'=Hansen (truncated)
. 'AM'=Andrews-Monahan
. 'P'=Plain (OLS)
. 'myfile' = user's sci-file
-gmmopt('aminfo') = tlist if gmmopt('S')='AM' (see gmmAndMon.sci)
- gmmopt('lags') = lags used in truncated kernel for S [nobs^(1/3)]
- gmmopt('wtvec') = user-defined weights for Hansen matrix allows for seasonals, etc (eg. wtvec = [1 0 1])
- gmmopt('Strim') = controls demeaning of moments in calculus of S [1],
. 0 = none
. 1 = demean e
. 2 = demean Z'e
- gmmopt('Slast') = 1 to recalculate S at final parameters estimate, 2 updates W [1]
- gmmopt('null') = vector of null hypotheses for t-satistics [0]
- gmmopt('plt) = 1 if the user want to graph the weights of GMM matrix [0]
- gmmopt('prt') = 1 if the user want to print the optimization steps [0]
* X = "independent" variables
* Z = instruments (can be same as X)
* Win user-defined initial weighting matrix (optionnal). To use a function to calculate W0, don't use Win, but set gmmopt('W0') to gmmopt('U') and give the sci-file name in gmmopt('W')
* gmmout = a tlist with:
- gmmout('meth') = 'GMM'
- gmmout('y') = y data vector
- gmmout('x') = x data matrix
- gmmout('z') = instruments data matrix
- gmmout('f') = function value
- gmmout('nobs') = number of observations
- gmmout('varn') = number of parameters to estimate
- gmmout('north') = number of orthogonality conditions
- gmmout('neq') = number of equations
- gmmout('nz') = number of instruments
- gmmout('J') = chi-square stat for model fit
- gmmout('pvalue fit') = p-value for model fit
- gmmout('beta') = coefficient estimates
- gmmout('se') = standard errors of parameters
- gmmout('vcovar') = cov matrix of parameter estimates
- gmmout('tstat') = t-satistics for parms = null hypotheses
- gmmout('pvalue') = p-values for coefficients
- gmmout('m') = value moments
- gmmout('M') = value of jacobian of moments conditions
- gmmout('mse') = standard errors of moments
- gmmout('varm') = covariance matrix of moments
- gmmout('m tstat') = t-satistics for moments = 0
- gmmout('m pvalue') = p-values for moments
- gmmout('nz') = number of instruments
- gmmout('nvar') = number of parameters
- gmmout('df') = degrees of freedom for model
- gmmout('null') = vector of null hypotheses for parameter values
- gmmout('W0 type') = type of initial weighting matrix
- gmmout('W type') = type of weighting matrix
- gmmout('W') = weighting matrix
- gmmout('S type') = type of spectral density matrix
- gmmout('S') = spectral density matrix
- gmmout('eflag') = error flag for spectral density matrix
- gmmopt('namey') = name of "endogenous" variables
- gmmopt('namex') = name of "exogenous" variables
- gmmopt('namez') = name of instruments
- gmmopt('prests') = boolean indicating presence of time series
- gmmopt('bounds') = if there is a times series in the regression, the bounds of the regression
X = [ones(1000,1) grand(1000,1,'nor',0,1) grand(1000,1,'nor',0,1)]; b = [0;1;-1]; e = grand(1000,1,'nor',0,1); y = X*b + e; gmmopt = tlist(['gmm';'momt';'jake';'prt';'gmmit';'S']); gmmopt('prt')=1; gmmopt('gmmit') = 1; gmmopt('S')='W'; gmmopt('momt')='gmmLinM'; gmmopt('jake')='gmmLinJ'; b0=zeros(3,1); uout=gmm1(y,b0,gmmopt,X,X); | ![]() | ![]() |