WWW | Community | Store | Account | Contact Us
SHAZAM Homepage

NL

The NL command provides general features for the estimation of nonlinear models. The model specification can be a single equation or a system of equations and estimation with autoregressive errors is available. A system of nonlinear simultaneous equations can also be estimated by Nonlinear Three Stage Least Squares (N3SLS) or by Generalized Method of Moments (GMM).

In general, the format is:

NL neq exogs / NCOEF= GMM= options
EQ equation
...
EQ equation
COEF coef1 value1 coef2 value2 ...
END

where exogs are the list of instrumental variables for N2SLS or N3SLS.

The available options are:

OPTION DESCRIPTION
across Estimates the Seemingly Unrelated Regressions (SUR) model with Vector Auto-Regressive errors. This admits autocorrelation ACROSS equations as well as within a single equation. This option can be computationally slow. Further details can be found in the SHAZAM Reference Manual.
autcov= Specifies the lag length to be used in computing the weighting matrix for the GMM= option. If this option is not specified automatic formulas are used.
auto Estimates the model with AUTOregressive errors. The order is specified with the ORDER= option and the default is first order autoregressive (AR(1)) errors. Further details can be found in the SHAZAM Reference Manual.
beg= Specifies the BEGinning observation to be used in estimation. This option overrides the SAMPLE command and defaults to the sample range in effect.
coef= Saves the COEFficients in the variable specified. If there is an intercept it will be stored as the last coefficient.
conv= Specifies the CONVergence criterion for the coefficients. This value will be multiplied by each coefficient starting value to compute the convergence condition for each coefficient. The default is CONV=.00001.
cov= Saves the COVariance matrix of coefficients in the variable specified.
dn Estimates the error variance by dividing the residual sum of squares by N instead of N-K. This option is the default. Use NODN to divide by N-K.
drho Normally, when the AUTO option is specified SHAZAM gives the same value of rho to each equation. With the DRHO option a Different value of RHO is given to each equation. When the order of autocorrelation is specified as higher than one on the ORDER= option the DRHO option will also give more than one rho for each equation.
dump DUMPs the internal code that SHAZAM has generated for the EQ commands. This option is only useful for SHAZAM consultants. If DUMP is specified with EVAL there will be a large amount of output.
end= Specifies the ENDing observation to be used in estimation. This option overrides the SAMPLE command and defaults to the sample range in effect.
eval EVALuates the likelihood function for the starting values and prints out the answer. If ITER=0 is also specified no estimation will be done. This is useful for experimentation purposes. If EVAL and DUMP are specified all the data in the nonlinear system is dumped along with the computed residuals and derivatives of the function with respect to all parameters. First, the data for each observation will be printed. Then the residuals for each equation and the derivatives of each equation with respect to each parameter will be printed, and finally, the derivatives for the equations will be printed consecutively. This option may not be used with the NUMERIC option.
genrvar Takes the vector of coefficients and generates a set of scalar variables using the same names as those used for the coefficients on the EQ command. These scalar variables can then be used for the rest of the SHAZAM run. This is an alternative to the COEF= method for saving the coefficients. NOTE: A large number of variables may need to be generated if the model is large. The coefficient names used may not be used on any EQ command later in the same run. Since the coefficients are now variables TEST commands will no longer work.
gmm= Specifies the weighting matrix to use for Generalized Method of Moments Estimation. If a matrix is provided it should be a symmetric matrix conforming to the dimensions in the equations described in the section GENERALIZED METHOD OF MOMENTS ESTIMATION in the SHAZAM Reference Manual. Alternatively, SHAZAM will automatically compute the matrix corresponding to the keywords HETCOV, BARTLETT, TRUNC, QS, PARZEN or TUKEY. The option GMM=IDENTITY gives estimation by N2SLS or N3SLS. See also the AUTCOV= option when using the GMM= option. If you don't know what you are doing and want to use GMM anyway, you should probably use either HETCOV or BARTLETT. The identity matrix is likely not a good choice for the weighting matrix.
gmmout= Saves the weighting matrix in the variable specified. This option is available with GMM=HETCOV, BARTLETT, TRUNC, QS, PARZEN or TUKEY.
hybrid Specifies that Simulated Annealing should be used to estimate a set of starting points and subsequently the method specified in METHOD= should be used to find the solution to the problem.
in= Reads back the values of the coefficients and log-likelihood function that were saved with the OUT= option. This option is only useful when there is something to INput from a previous run. This option may be combined with the OUT= option to insure that the IN= file always contains the values of the coefficients from the most recent iteration. The COEF command should only be used with the IN= option if the starting values of some of the coefficients are to be modified. When both OUT= and IN= are used the same unit number is usually used. A binary file should be assigned to the unit with the SHAZAM FILE command or an operating system command.
iter= Specifies the maximum number of ITERations. The default is 100.
list LISTs and plots the residuals and predicted values of the dependent variable and residual statistics. When LIST is specified RSTAT is automatically turned on.
logden Used to tell SHAZAM that the equation given on the EQ command is the LOG-DENsity for a single observation rather than a regression equation. SHAZAM will then compute a complete likelihood function by summing the log-densities. This option allows maximum likelihood estimation of a large variety of functions. With the LOGDEN option, the RESID= option saves the log-densities evaluated at the final parameter estimates in the variable specified.
maxfunc Used to tell SHAZAM that the equation given on the EQ command is a function (such as a log-likelihood function) to be maximized rather than a regression equation. SHAZAM will find the values of the parameters that maximize the function. The SAMPLE command should be set to include only one observation.
method= Specifies the nonlinear algorithm to use for estimation. The default is a Davidon-Fletcher-Powell algorithm. An alternative METHOD=BFGS, Broyden-Fletcher-Goldfarb-Shanno (BFGS), is described in Belsley [1980]. Another alternative is a slightly different D-F-P algorithm which can be obtained with METHOD=DFP. Simulated Annealing is specified via METHOD=SA, which is described in Goffe et al [1994]. The default is ideal for large or complex nonlinear functions. For nearly linear or small problems an alternative algorithm may improve results.
minfunc Used to tell SHAZAM that the equation given on the EQ command is a function to be minimized rather than a regression equation. SHAZAM will then find the values of the parameters that minimize the function. The SAMPLE command should be set to include only one observation.
ncoef= Specifies the Number of different COEFficients to be estimated. This option is required.
nodn Estimates the error variance by dividing the residual sum of squares by N-K instead of N. Use DN to divide by N.
noconexog If a list of exogenous variables is included for either Nonlinear Two or Three Stage Least Squares SHAZAM will automatically add a CONSTANT to the list. If you do not want SHAZAM to automatically include a constant in the list of exogenous variables, specify the NOCONEXOG option.
nonumeric Forces the use of Analytic Derivatives. SHAZAM normally computes analytic derivatives which are more accurate. However, in some models with many equations and parameters, considerable savings in required memory will result if the NUMERIC option is used to compute numeric derivatives. In some cases the NUMERIC option may even be faster. For large models SHAZAM may automatically switch to numeric derivatives. If this happens then analytic derivatives can be forced with the NONUMERIC option (this will not be effective if functions other than LOG() and EXP() are used in the model).
nopsigma Suppresses printing of the sigma matrix from systems estimation.
numcov Uses numeric differences to compute the covariance matrix after estimation. If this option is NOT specified SHAZAM uses a method based on the Davidon-Fletcher-Powell algorithm which builds up the covariance matrix after many iterations. This method may not be accurate if the model only runs for a small number of iterations. The numeric method is more expensive and also may not necessarily be accurate. The differential to be used in numeric differences can be controlled with the STEPSIZE= option.
numeric Uses the NUMERIC difference method to compute derivatives in the algorithm. SHAZAM normally computes analytic derivatives which are more accurate. However, in some models with many equations and parameters, considerable savings in required memory will result if the NUMERIC option is used to compute numeric derivatives. In some cases the NUMERIC option may even be faster. For large models SHAZAM may automatically switch to numeric derivatives. If this happens then analytic derivatives can be forced with the NONUMERIC option (this will not be effective if functions other than LOG() and EXP() are used in the model).
opgcov Uses the outer-product of the Gradient method to compute the covariance matrix. It is not valid with the NUMERIC option.
order= Specifies the ORDER of autocorrelation to be corrected when the AUTO option is used. The default is ORDER=1.
out= Writes OUT on the unit specified the values of the coefficients and log-likelihood function after each iteration. This is quite useful for restarting the model in another run with the IN= option described above. When this option is used, a file must be assigned to the output unit as described in the chapter DATA INPUT AND OUTPUT in the SHAZAM Reference Manual. The values will be written in double precision (binary) all on one line. Units 11-49 are available for use.
pcov Prints an estimate of the COVariance matrix of coefficients after convergence. This estimate is based on an estimate of the Hessian which SHAZAM computes internally. SHAZAM estimates the Hessian by building it up after repeated iterations. Therefore, if the model converges immediately, SHAZAM will have a very poor estimate of the Hessian or none at all. In this case, the covariance matrix will just be an identity matrix. If the NUMCOV or OPGCOV options are used the estimated covariance matrix is computed using alternate methods.
piter= Specifies the frequency with which ITERations will be Printed in the output. The default PITER=15 indicates that one out of every 15 iterations will be printed.
predict= Saves the PREDICTed values of the dependent variable in the variable specified.
resid= Saves the values of the RESIDuals from the regression in the variable specified.
rstat Prints Residual Summary STATistics. The output includes the Durbin-Watson statistic and related residual test statistics. It also includes the Runs Test. When the LIST option is specified RSTAT is automatically turned on.
saconv= Specifies the convergence criterion of the Simulated Annealing algorithm. The default value of this parameter is 0.0001 for pure Simulated Annealing and 0.1 for hybrid options. Requires METHOD=SA or HYBRID.
saiter= Specifies the maximum number of function trials the Simulated Annealing algorithm will evaluate before returning. The default value of this parameter is 1,000,000 and usually the solution is found in less iterations than this. Requires METHOD=SA or HYBRID.
salower= A vector used to specify lower limits on the range of allowed coefficients. The default value is a vector with all elements equal to -10. Requires METHOD=SA or HYBRID.
salowfac= A factor that is can be used to specify the lower bounds array in terms of a factor applied to the initial conditions vector. This factor is over ridden by the use of an SALOWER vector. The default is -10. Requires METHOD=SA or HYBRID.
same Runs the previous NL regression without repeating the EQ commands.
saneps= Specifies how many function evaluations should be used to determine convergence of when performing Simulated Annealing. The default value is 4. If SANEPS evaluations lie within SACONV of each other the Simulated Annealing algorithm will terminate. Requires METHOD=SA or HYBRID.
sans= Determines the number of cycles the Simulated Annealing algorithm iterates through. The algorithm adjusts an internal vector so that approximately half of the function evaluations lie within range. This calculation is done after NCOEF*SANS evaluations. The default value is 20. Requires METHOD=SA or HYBRID.
sant= Determines how many evaluations that should be used by Simulated Annealing before reducing the, internal, temperature variable. After NCOEF*SANS*SANT function evaluations the temperature is reduced. The default value is 100. Requires METHOD=SA or HYBRID.
satrf= A positive value, between 0 and 1, that determines how slowly simulated annealing reduces the internal temperature variable. The default is 0.85. Requires METHOD=SA or HYBRID.
saupfac= A factor that can be used to specify the upper bounds array in terms of a factor applied to the initial conditions vector. This factor is over ridden by the use of an SAUPPER vector. The default value is 10. Requires METHOD=SA or HYBRID.
saupper= A vector used to specify upper limits on the range of allowed coefficients. The default value is a vector with all elements equal to 10. Requires METHOD=SA or HYBRID.
sigma= Saves the sigma matrix from systems estimation in the variable specified. For single equation estimation the estimate of sigma squared is saved.
solve Used to tell SHAZAM that the equations given on the EQ commands are to be solved as a set of nonlinear simultaneous equations. There should be one equation for each coefficient as specified by the NCOEF= option. An example is shown in Solving Nonlinear Sets of Equations in the SHAZAM Reference Manual chapter PROGRAMMING IN SHAZAM. The SAMPLE should be set to include only one observation.
start= Uses the values in the specified variable as starting values for the estimation. The order of the parameters should be the same as normally printed by the SHAZAM NL command, namely, the order that they appear on the EQ commands (followed by autocorrelation coefficients when the AUTO option is used). In some cases this may be an easier way to input starting values than by using the COEF command. Be careful to make sure that the length of the START= vector is equal to the number of coefficients specified with the NCOEF= option (plus the number of autocorrelation coefficients if any).
stderr= Saves the values of the STanDard ERRors of the coefficients in the variable specified.
stepsize= Specifies the stepsize to use with the NUMCOV and NUMERIC options to control the differential in numeric derivatives. The default is STEPSIZE=1E-4. The calculated covariance matrix may be very sensitive to this value.
tratio= Saves the values of the T-RATIOs in the variable specified.
zmatrix= Specifies a matrix to create and use to store the derivatives of the nonlinear function with respect to each parameter. The are many ways to calculate Standard Errors depending on the model being estimated and this option is useful when you wish to calculate your own Standard Errors. This option should be used only when there is only one equation that is estimated. The option is not valid if the NUMERIC option is also used.