RATS 10.1
RATS 10.1

RATS can estimate, by non-linear least squares, models of the form

\begin{equation} y_t = f\left( {X_t ,\beta } \right) + u_t \label{eq:nonlin_nllsfrml} \end{equation}

with objective function

\begin{equation} \sum\limits_{{\rm{t = 1}}}^T {u_t^2 } {\rm{ }} \end{equation}

This is done using the instruction NLLS. NLLS can also be used for GMM/non-linear two-stage least squares, while NLSYSTEM performs non-linear systems estimation and multivariate GMM, and MAXIMIZE is designed to handle more general problems.

 

The syntax for the NLLS instruction, which does the actual estimation is:

 

nlls(frml=formula, other optionsdepvar  start  end  resids

 

Before you can run NLLS you need to:

Set the parameter list using NONLIN.

Set up the function using FRML.

Set initial values for the parameters, using, for instance, COMPUTE.

 

For instance, the following estimates the parameters for a CES production function

\begin{equation} \log \,Q_t = \log \,\gamma - \frac{\upsilon }{\rho }\log \left( {\delta {\kern 1pt} K_t^{ - \rho } + (1 - \delta )L_t^{ - \rho } } \right) + u_t \end{equation}          

nonlin lgamma delta nu rho

frml ces = lgamma-nu/rho*  $

  log(  delta * k^(-rho) + (1.-delta) * l^(-rho)  )

 

compute lgamma=1.0

compute  delta=0.4

compute     nu=0.8

compute    rho=0.6

 

nlls(frml=ces,trace) logq

 

Technically, NLLS is set up for models strictly of the form \eqref{eq:nonlin_nllsfrml}. However, you can use * in place of depvarNLLS interprets this as a series of zeros. Since \(R^2\) and related statistics are meaningless in such cases, they are omitted.

 

By default, NLLS estimates using the Gauss–Newton algorithm. The covariance matrix is calculated as detailed in "Nonlinear Covariance Matrices". However, it also supports the derivative-free methods such as SIMPLEX. These can be applied if the function is continuous but not differentiable. They can also be used to refine initial guesses before using the standard method, or to make a broader search of the parameter space.

 

You can test hypotheses on the coefficients using TEST, RESTRICT and MRESTRICT. Coefficients are numbered by their positions in the parameter vector. You cannot use EXCLUDE since that requires a variable list rather than coefficients.

 

NLLS can handle parameter sets with constraints imposed. However, it doesn’t use the Gauss–Newton algorithm in this case. Instead, it uses constrained BFGS.

 

The example NLLS.RPF estimates a non-linear consumption function and does a test of a hypothesis on the parameters.

 


Copyright © 2025 Thomas A. Doan