Language Reference

LAV Call

CALL LAV (rc, xr, a, b <, x0> <, opt> ) ;

This subroutine is supported only by the IML procedure.

The LAV subroutine performs linear least absolute value regression by solving the upper L 1 norm minimization problem.

The LAV subroutine returns the following values:

rc

is a scalar return code that indicates the reason for optimization termination.

rc Termination
0 Successful
1 Successful, but approximate covariance matrix and standard errors cannot be computed
negative 1 or negative 3 Unsuccessful: error in the input arguments
negative 2 Unsuccessful: matrix A is rank-deficient (normal r normal a normal n normal k left-parenthesis upper A right-parenthesis less-than n)
negative 4 Unsuccessful: maximum iteration limit exceeded
negative 5 Unsuccessful: no solution found for ill-conditioned problem

xr

specifies a vector or matrix with n columns. If the optimization process is not successfully completed, xr is a row vector with n missing values. If termination is successful and the opt[3] option is not set, xr is the vector with the optimal estimate, x Superscript asterisk. If termination is successful and the opt[3] option is specified, xr is an left-parenthesis n plus 2 right-parenthesis times n matrix that contains the optimal estimate, x Superscript asterisk, in the first row, the asymptotic standard errors in the second row, and the n times n covariance matrix of parameter estimates in the remaining rows.

The input arguments to the LAV subroutine are as follows:

a

specifies an m times n matrix A with m greater-than-or-equal-to n and full column rank, normal r normal a normal n normal k left-parenthesis upper A right-parenthesis equals n. If you want to include an intercept in the model, you must include a column of ones in the matrix A.

b

specifies the m times 1 vector b.

x0

specifies an optional n times 1 vector that specifies the starting point of the optimization.

opt

is an optional vector used to specify options. If an element of the opt vector is missing, the default value is used.

  • opt[1] specifies the maximum number maxi of outer iterations (this corresponds to the number of changes of the Huber parameter gamma). The default is maxi equals min left-parenthesis 100 comma 10 n right-parenthesis. (The number of inner iterations is restricted by an internal threshold. If the number of inner iterations exceeds this threshold, a new outer iteration is started with an increased value of gamma.)

  • opt[2] specifies the amount of printed output. Higher values request additional output and include the output of lower values.

    opt[2] Termination
    0 No output is printed.
    1 Error and warning messages are printed.
    2 The iteration history is printed (this is the default).
    3 The n least squares (upper L 2 norm) estimates are printed if no starting point is specified, the upper L 1 norm estimates are always printed, and if opt[3] is set, the estimates are printed together with the asymptotic standard errors.
    4 The n times n approximate covariance matrix of parameter estimates is printed if opt[3] is set.
    5 The residual and predicted values for all m rows (equations) of A are printed.

  • opt[3] specifies which estimate of the variance of the median of nonzero residuals be used as a factor for the approximate covariance matrix of parameter estimates and for the approximate standard errors (ASE). If opt[3]=0, the McKean-Schrader estimate (McKean and Schrader 1987) is used, and if opt[3]greater-than 0, the Cox-Hinkley estimate (Cox and Hinkley 1974), with v equalsopt[3], is used. The default behavior is that the covariance matrix is not computed.

  • opt[4] specifies whether a computationally expensive test for necessary and sufficient optimality of the solution x is executed. The default behavior (opt[4]=0) is that the convergence test is not performed.

Missing values are not permitted in the a or b argument. The x Baseline 0 argument is ignored if it contains any missing values. Missing values in the opt argument cause the default value to be used.

The LAV subroutine is designed for solving the unconstrained linear upper L 1 norm minimization problem,

for m equations with n (unknown) parameters x equals left-parenthesis x 1 comma ellipsis comma x Subscript n Baseline right-parenthesis. This is equivalent to estimating the unknown parameter vector, x, by least absolute value regression in the model

where b is the vector of n observations, A is the design matrix, and epsilon is a random error term.

An algorithm by Madsen and Nielsen (1993) is used, which can be faster for large values of m and n than the Barrodale and Roberts (1974) algorithm. The current version of the algorithm assumes that A has full column rank. Also, constraints cannot be imposed on the parameters in this version.

The upper L 1 norm minimization problem is more difficult to solve than the least squares (upper L 2 norm) minimization problem because the objective function of the upper L 1 norm problem is not continuously differentiable (the first derivative has jumps). A function that is continuous but not continuously differentiable is called nonsmooth. By using PROC NLP and the nonlinear optimization subroutines, you can obtain the estimates in linear and nonlinear upper L 1 norm estimation (even subject to linear or nonlinear constraints) as long as the number of parameters, n, is small. Using the nonlinear optimization subroutines, there are two ways to solve the nonlinear upper L Subscript p norm, p greater-than-or-equal-to 1, problem:

  • For small values of n, you can implement the Nelder-Mead simplex algorithm with the NLPNMS subroutine to solve the minimization problem in its original specification. The Nelder-Mead simplex algorithm does not assume a smooth objective function, does not take advantage of any derivatives, and therefore does not require continuous differentiability of the objective function. See the section NLPNMS Call for details.

  • Gonin and Money (1989) describe how an original upper L Subscript p norm estimation problem can be modified to an equivalent optimization problem with nonlinear constraints which has a simple differentiable objective function. You can invoke the NLPQN subroutine, which implements a quasi-Newton algorithm, to solve the nonlinearly constrained upper L Subscript p norm optimization problem. See the section NLPQN Call for details about the NLPQN subroutine.

Both approaches are successful only for a small number of parameters and good initial estimates. If you cannot supply good initial estimates, the optimal results of the corresponding nonlinear least squares (upper L 2 norm) estimation can provide fairly good initial estimates.

Gonin and Money (1989) show that the nonlinear upper L 1 norm estimation problem

can be reformulated as a linear optimization problem with nonlinear constraints in the following ways.

For linear functions f Subscript i Baseline left-parenthesis x right-parenthesis equals sigma-summation Underscript j equals 1 Overscript n Endscripts left-parenthesis a Subscript i j Baseline x Subscript j Baseline minus b Subscript i Baseline right-parenthesis, i equals 1 comma ellipsis comma m, you obtain linearly constrained linear optimization problems, for which the number of variables and constraints is on the order of the number of observations, m. The advantage that the algorithm by Madsen and Nielsen (1993) has over the Barrodale and Roberts (1974) algorithm is that its computational cost increases only linearly with m, and it can be faster for large values of m.

In addition to computing an optimal solution x Superscript asterisk that minimizes upper L 1 left-parenthesis x right-parenthesis, you can also compute approximate standard errors and the approximate covariance matrix of x Superscript asterisk. The standard errors can be used to compute confidence limits.

The following example is the same one used for illustrating the LAV subroutine by Lee and Gentle (1986). A and b are as follows:

The following statements specify the matrix A, the vector b, and the options vector opt. The options vector specifies that all output is printed (opt[2]=5), that the asymptotic standard errors and covariance matrix are computed based on the McKean-Schrader estimate lamda of the variance of the median (opt[3]=0), and that the convergence test be performed (opt[4]=1).

a = { 0,  1, -1, -1,  2,  2 };
m = nrow(a);
a = j(m, 1, 1.) || a;
b = { 1,  2,  1, -1,  2,  4 };

opt= { . 5  0 1 };
call lav(rc, xr, a, b, , opt);

The first part of the output is shown in Figure 216. This output displays the least squares solution, which is used as the starting point. The estimates of the largest and smallest nonzero eigenvalues of upper A prime upper A give only an idea of the magnitude of these values, and they can be very crude approximations.

Figure 216: Least Squares Solution

LS Solution
Est11


The second part of the printed output shows the iteration history. It is shown in Figure 217.

Figure 217: Iteration History

LAV (L1) Estimation
Start with LS Solution
Start Iter: gamma=1 ActEqn=6
IterN HuberAct EqnRankGammaL1(x)F(Gamma)
11220.90004.0000002.200000
11220.00004.0000002.200000


The third part of the output is shown in Figure 218. This output displays the upper L 1 norm solution (first row) together with asymptotic standard errors (second row) and the asymptotic covariance matrix of parameter estimates. The ASEs are the square roots of the diagonal elements of this covariance matrix.

Figure 218: Parameter and Covariance Estimates

L1 Solution with ASE
Est11
ASE0.44827118110.3310702082

Cov Matrix: McKean-Schrader
0.2009470518-0.054803741
-0.0548037410.1096074828


The last part of the printed output shows the predicted values and residuals, as in Lee and Gentle (1986). It is shown in Figure 219.

Figure 219: Predicted and Residual Values

Predicted Values and Residuals
NObservedPredictedResidual
11.00001.00000
22.00002.00000
31.00000.00001.000000
4-1.00000.0000-1.000000
52.00003.0000-1.000000
64.00003.00001.000000


Last updated: April 16, 2021