G02QGF (PDF version)
G02 Chapter Contents
G02 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

G02QGF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.
Note: this routine uses optional parameters to define choices in the problem specification and in the details of the algorithm. If you wish to use default settings for all of the optional parameters, you need only read Sections 1 to 10 of this document. If, however, you wish to reset some or all of the settings please refer to Section 11 for a detailed description of the algorithm, to Section 12 for a detailed description of the specification of the optional parameters and to Section 13 for a detailed description of the monitoring information produced by the routine.

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

G02QGF performs a multiple linear quantile regression. Parameter estimates and, if required, confidence limits, covariance matrices and residuals are calculated. G02QGF may be used to perform a weighted quantile regression. A simplified interface for G02QGF is provided by G02QFF.

2  Specification

SUBROUTINE G02QGF ( SORDER, INTCPT, WEIGHT, N, M, DAT, LDDAT, ISX, IP, Y, WT, NTAU, TAU, DF, B, BL, BU, CH, RES, IOPTS, OPTS, STATE, INFO, IFAIL)
INTEGER  SORDER, N, M, LDDAT, ISX(M), IP, NTAU, IOPTS(*), STATE(*), INFO(NTAU), IFAIL
REAL (KIND=nag_wp)  DAT(LDDAT,*), Y(N), WT(*), TAU(NTAU), DF, B(IP,NTAU), BL(IP,*), BU(IP,*), CH(IP,IP,*), RES(N,*), OPTS(*)
CHARACTER(1)  INTCPT, WEIGHT

3  Description

Given a vector of n observed values, y = y i : i = 1, 2, , n , an n×p design matrix X, a column vector, x, of length p holding the ith row of X and a quantile τ 0 , 1 , G02QGF estimates the p-element vector β as the solution to
minimize β p i=1 n ρ τ y i - xiT β (1)
where ρ τ  is the piecewise linear loss function ρ τ z = z τ - I z < 0 , and I z < 0  is an indicator function taking the value 1 if z<0 and 0 otherwise. Weights can be incorporated by replacing X and y with WX and Wy respectively, where W is an n×n diagonal matrix. Observations with zero weights can either be included or excluded from the analysis; this is in contrast to least squares regression where such observations do not contribute to the objective function and are therefore always dropped.
G02QGF uses the interior point algorithm of Portnoy and Koenker (1997), described briefly in Section 11, to obtain the parameter estimates β^, for a given value of τ.
Under the assumption of Normally distributed errors, Koenker (2005) shows that the limiting covariance matrix of β^-β has the form
Σ = τ 1 - τ n H n -1 J n H n -1  
where Jn = n-1 i=1 n x i xiT  and Hn is a function of τ, as described below. Given an estimate of the covariance matrix, Σ^, lower (β^L) and upper (β^U) limits for an 100×α% confidence interval can be calculated for each of the p parameters, via
β^ Li = β^ i - t n-p , 1 + α / 2 Σ^ ii , β^ Ui = β^ i + t n-p , 1 + α / 2 Σ^ ii  
where tn-p,0.975 is the 97.5 percentile of the Student's t distribution with n-k degrees of freedom, where k is the rank of the cross-product matrix XTX.
Four methods for estimating the covariance matrix, Σ, are available:
(i) Independent, identically distributed (IID) errors
Under an assumption of IID errors the asymptotic relationship for Σ simplifies to
Σ = τ 1 - τ n s τ 2 XT X -1  
where s is the sparsity function. G02QGF estimates sτ from the residuals, ri = yi - xiT β^  and a bandwidth hn.
(ii) Powell Sandwich
Powell (1991) suggested estimating the matrix Hn by a kernel estimator of the form
H^ n = n cn -1 i=1 n K r i c n xi xiT  
where K is a kernel function and cn satisfies lim n cn 0  and lim n n cn . When the Powell method is chosen, G02QGF uses a Gaussian kernel (i.e., K=ϕ) and sets
cn = minσr, qr3 - qr1 / 1.34 × Φ-1 τ + hn - Φ-1 τ - hn  
where hn is a bandwidth, σr,qr1 and qr3 are, respectively, the standard deviation and the 25% and 75% quantiles for the residuals, ri.
(iii) Hendricks–Koenker Sandwich
Koenker (2005) suggested estimating the matrix Hn using
H^ n = n-1 i=1 n 2 hn xiT β^ τ + hn - β^ τ - hn xi xiT  
where hn is a bandwidth and β^τ+hn denotes the parameter estimates obtained from a quantile regression using the τ+hnth quantile. Similarly with β^τ-hn.
(iv) Bootstrap
The last method uses bootstrapping to either estimate a covariance matrix or obtain confidence intervals for the parameter estimates directly. This method therefore does not assume Normally distributed errors. Samples of size n are taken from the paired data yi,xi (i.e., the independent and dependent variables are sampled together). A quantile regression is then fitted to each sample resulting in a series of bootstrap estimates for the model parameters, β. A covariance matrix can then be calculated directly from this series of values. Alternatively, confidence limits, β^L and β^U, can be obtained directly from the 1-α/2 and 1+α/2 sample quantiles of the bootstrap estimates.
Further details of the algorithms used to calculate the covariance matrices can be found in Section 11.
All three asymptotic estimates of the covariance matrix require a bandwidth, hn. Two alternative methods for determining this are provided:
(i) Sheather–Hall
hn = 1.5 Φ-1αb ϕ Φ-1τ 2 n 2 Φ-1τ + 1 13  
for a user-supplied value αb,
(ii) Bofinger
hn = 4.5 ϕ Φ-1τ 4 n 2 Φ-1τ + 1 2 15  
G02QGF allows optional arguments to be supplied via the IOPTS and OPTS arrays (see Section 12 for details of the available options). Prior to calling G02QGF the optional parameter arrays, IOPTS and OPTS must be initialized by calling G02ZKF with OPTSTR set to Initialize=G02QGF (see Section 12 for details on the available options). If bootstrap confidence limits are required (Interval Method=BOOTSTRAP XY) then one of the random number initialization routines G05KFF (for a repeatable analysis) or G05KGF (for an unrepeatable analysis) must also have been previously called.

4  References

Koenker R (2005) Quantile Regression Econometric Society Monographs, Cambridge University Press, New York
Mehrotra S (1992) On the implementation of a primal-dual interior point method SIAM J. Optim. 2 575–601
Nocedal J and Wright S J (1999) Numerical Optimization Springer Series in Operations Research, Springer, New York
Portnoy S and Koenker R (1997) The Gaussian hare and the Laplacian tortoise: computability of squared-error versus absolute error estimators Statistical Science 4 279–300
Powell J L (1991) Estimation of monotonic regression models under quantile restrictions Nonparametric and Semiparametric Methods in Econometrics Cambridge University Press, Cambridge

5  Arguments

1:     SORDER – INTEGERInput
On entry: determines the storage order of variates supplied in DAT.
Constraint: SORDER=1 or 2.
2:     INTCPT – CHARACTER(1)Input
On entry: indicates whether an intercept will be included in the model. The intercept is included by adding a column of ones as the first column in the design matrix, X.
INTCPT='Y'
An intercept will be included in the model.
INTCPT='N'
An intercept will not be included in the model.
Constraint: INTCPT='N' or 'Y'.
3:     WEIGHT – CHARACTER(1)Input
On entry: indicates if weights are to be used.
WEIGHT='W'
A weighted regression model is fitted to the data using weights supplied in array WT.
WEIGHT='U'
An unweighted regression model is fitted to the data and array WT is not referenced.
Constraint: WEIGHT='U' or 'W'.
4:     N – INTEGERInput
On entry: the total number of observations in the dataset. If no weights are supplied, or no zero weights are supplied or observations with zero weights are included in the model then N=n. Otherwise N=n+ the number of observations with zero weights.
Constraint: N2.
5:     M – INTEGERInput
On entry: m, the total number of variates in the dataset.
Constraint: M0.
6:     DATLDDAT* – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array DAT must be at least M if SORDER=1 and at least N if SORDER=2.
On entry: the ith value for the jth variate, for i=1,2,,N and j=1,2,,M, must be supplied in
  • DATij if SORDER=1, and
  • DATji if SORDER=2.
The design matrix X is constructed from DAT, ISX and INTCPT.
7:     LDDAT – INTEGERInput
On entry: the first dimension of the array DAT as declared in the (sub)program from which G02QGF is called.
Constraints:
  • if SORDER=1, LDDATN;
  • otherwise LDDATM.
8:     ISXM – INTEGER arrayInput
On entry: indicates which independent variables are to be included in the model.
ISXj=0
The jth variate, supplied in DAT, is not included in the regression model.
ISXj=1
The jth variate, supplied in DAT, is included in the regression model.
Constraints:
  • ISXj=0 or 1, for j=1,2,,M;
  • if INTCPT='Y', exactly IP-1 values of ISX must be set to 1;
  • if INTCPT='N', exactly IP values of ISX must be set to 1.
9:     IP – INTEGERInput
On entry: p, the number of independent variables in the model, including the intercept, see INTCPT, if present.
Constraints:
  • 1IP<N;
  • if INTCPT='Y', 1IPM+1;
  • if INTCPT='N', 1IPM.
10:   YN – REAL (KIND=nag_wp) arrayInput
On entry: y, the observations on the dependent variable.
11:   WT* – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array WT must be at least N if WEIGHT='W'.
On entry: if WEIGHT='W', WT must contain the diagonal elements of the weight matrix W. Otherwise WT is not referenced.
When
Drop Zero Weights=YES
If WTi=0.0, the ith observation is not included in the model, in which case the effective number of observations, n, is the number of observations with nonzero weights. If Return Residuals=YES, the values of RES will be set to zero for observations with zero weights.
Drop Zero Weights=NO
All observations are included in the model and the effective number of observations is N, i.e., n=N.
Constraints:
  • If WEIGHT='W', WTi0.0, for i=1,2,,N;
  • The effective number of observations 2.
12:   NTAU – INTEGERInput
On entry: the number of quantiles of interest.
Constraint: NTAU1.
13:   TAUNTAU – REAL (KIND=nag_wp) arrayInput
On entry: the vector of quantiles of interest. A separate model is fitted to each quantile.
Constraint: ε<TAUj<1-ε where ε is the machine precision returned by X02AJF, for j=1,2,,NTAU.
14:   DF – REAL (KIND=nag_wp)Output
On exit: the degrees of freedom given by n-k, where n is the effective number of observations and k is the rank of the cross-product matrix XTX.
15:   BIPNTAU – REAL (KIND=nag_wp) arrayInput/Output
On entry: if Calculate Initial Values=NO, Bil must hold an initial estimates for β^i, for i=1,2,,IP and l=1,2,,NTAU. If Calculate Initial Values=YES, B need not be set.
On exit: Bil, for i=1,2,,IP, contains the estimates of the parameters of the regression model, β^, estimated for τ=TAUl.
If INTCPT='Y', B1l will contain the estimate corresponding to the intercept and Bi+1l will contain the coefficient of the jth variate contained in DAT, where ISXj is the ith nonzero value in the array ISX.
If INTCPT='N', Bil will contain the coefficient of the jth variate contained in DAT, where ISXj is the ith nonzero value in the array ISX.
16:   BLIP* – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array BL must be at least NTAU if Interval MethodNONE.
On exit: if Interval MethodNONE, BLil contains the lower limit of an 100×α% confidence interval for Bil, for i=1,2,,IP and l=1,2,,NTAU.
If Interval Method=NONE, BL is not referenced.
The method used for calculating the interval is controlled by the optional parameters Interval Method and Bootstrap Interval Method. The size of the interval, α, is controlled by the optional parameter Significance Level.
17:   BUIP* – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array BU must be at least NTAU if Interval MethodNONE.
On exit: if Interval MethodNONE, BUil contains the upper limit of an 100×α% confidence interval for Bil, for i=1,2,,IP and l=1,2,,NTAU.
If Interval Method=NONE, BU is not referenced.
The method used for calculating the interval is controlled by the optional parameters Interval Method and Bootstrap Interval Method. The size of the interval, α is controlled by the optional parameter Significance Level.
18:   CHIPIP* – REAL (KIND=nag_wp) arrayOutput
Note: the last dimension of the array CH must be at least NTAU if Interval MethodNONE and Matrix Returned=COVARIANCE and at least NTAU+1 if Interval MethodNONE, IID or BOOTSTRAP XY and Matrix Returned=H INVERSE.
On exit: depending on the supplied optional parameters, CH will either not be referenced, hold an estimate of the upper triangular part of the covariance matrix, Σ, or an estimate of the upper triangular parts of nJn and n-1Hn-1.
If Interval Method=NONE or Matrix Returned=NONE, CH is not referenced.
If Interval Method=BOOTSTRAP XY or IID and Matrix Returned=H INVERSE, CH is not referenced.
Otherwise, for i,j=1,2,,IP,ji and l=1,2,,NTAU:
  • If Matrix Returned=COVARIANCE, CHijl holds an estimate of the covariance between Bil and Bjl.
  • If Matrix Returned=H INVERSE, CHij1 holds an estimate of the i,jth element of nJn and CHijl+1 holds an estimate of the i,jth element of n-1Hn-1, for τ=TAUl.
The method used for calculating Σ and Hn-1 is controlled by the optional parameter Interval Method.
19:   RESN* – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array RES must be at least NTAU if Return Residuals=YES.
On exit: if Return Residuals=YES, RESil holds the (weighted) residuals, ri, for τ=TAUl, for i=1,2,,N and l=1,2,,NTAU.
If WEIGHT='W' and Drop Zero Weights=YES, the value of RES will be set to zero for observations with zero weights.
If Return Residuals=NO, RES is not referenced.
20:   IOPTS* – INTEGER arrayCommunication Array
Note: the dimension of this array is dictated by the requirements of associated functions that must have been previously called. This array must be the same array passed as argument IOPTS in the previous call to G02ZKF.
On entry: optional parameter array, as initialized by a call to G02ZKF.
21:   OPTS* – REAL (KIND=nag_wp) arrayCommunication Array
Note: the dimension of this array is dictated by the requirements of associated functions that must have been previously called. This array must be the same array passed as argument OPTS in the previous call to G02ZKF.
On entry: optional parameter array, as initialized by a call to G02ZKF.
22:   STATE* – INTEGER arrayCommunication Array
Note: the actual argument supplied must be the array STATE supplied to the initialization routines G05KFF or G05KGF.
The actual argument supplied must be the array STATE supplied to the initialization routines G05KFF or G05KGF.
If Interval Method=BOOTSTRAP XY, STATE contains information about the selected random number generator. Otherwise STATE is not referenced.
23:   INFONTAU – INTEGER arrayOutput
On exit: INFOi holds additional information concerning the model fitting and confidence limit calculations when τ=TAUi.
Code Warning
0 Model fitted and confidence limits (if requested) calculated successfully
1 The routine did not converge. The returned values are based on the estimate at the last iteration. Try increasing Iteration Limit whilst calculating the parameter estimates or relaxing the definition of convergence by increasing Tolerance.
2 A singular matrix was encountered during the optimization. The model was not fitted for this value of τ.
4 Some truncation occurred whilst calculating the confidence limits for this value of τ. See Section 11 for details. The returned upper and lower limits may be narrower than specified.
8 The routine did not converge whilst calculating the confidence limits. The returned limits are based on the estimate at the last iteration. Try increasing Iteration Limit.
16 Confidence limits for this value of τ could not be calculated. The returned upper and lower limits are set to a large positive and large negative value respectively as defined by the optional parameter Big.
It is possible for multiple warnings to be applicable to a single model. In these cases the value returned in INFO is the sum of the corresponding individual nonzero warning codes.
24:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=11
On entry, SORDER=value.
Constraint: SORDER=1 or 2.
IFAIL=21
On entry, INTCPT=value was an illegal value.
IFAIL=31
On entry, WEIGHT had an illegal value.
IFAIL=41
On entry, N=value.
Constraint: N2.
IFAIL=51
On entry, M=value.
Constraint: M0.
IFAIL=71
On entry, LDDAT=value and N=value.
Constraint: LDDATN.
IFAIL=72
On entry, LDDAT=value and M=value.
Constraint: LDDATM.
IFAIL=81
On entry, ISXvalue=value.
Constraint: ISXi=0 or 1 for all i.
IFAIL=91
On entry, IP=value and N=value.
Constraint: 1IP<N.
IFAIL=92
On entry, IP is not consistent with ISX or INTCPT: IP=value, expected value=value.
IFAIL=111
On entry, WTvalue=value.
Constraint: WTi0.0 for all i.
IFAIL=112
On entry, effective number of observations=value.
Constraint: effective number of observationsvalue.
IFAIL=121
On entry, NTAU=value.
Constraint: NTAU1.
IFAIL=131
On entry, TAUvalue=value is invalid.
IFAIL=201
On entry, either the option arrays have not been initialized or they have been corrupted.
IFAIL=221
On entry, STATE vector has been corrupted or not initialized.
IFAIL=231
A potential problem occurred whilst fitting the model(s).
Additional information has been returned in INFO.
IFAIL=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
IFAIL=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
IFAIL=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7  Accuracy

Not applicable.

8  Parallelism and Performance

G02QGF is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
G02QGF makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9  Further Comments

G02QGF allocates internally approximately the following elements of real storage: 13n+ np+ 3p2+ 6p+ 3p+1×NTAU. If Interval Method=BOOTSTRAP XY then a further np elements are required, and this increases by p×NTAU×Bootstrap Iterations if Bootstrap Interval Method=QUANTILE. Where possible, any user-supplied output arrays are used as workspace and so the amount actually allocated may be less. If SORDER=2, WEIGHT='U', INTCPT='N' and IP=M an internal copy of the input data is avoided and the amount of locally allocated memory is reduced by np.

10  Example

A quantile regression model is fitted to Engels 1857 study of household expenditure on food. The model regresses the dependent variable, household food expenditure, against two explanatory variables, a column of ones and household income. The model is fit for five different values of τ and the covariance matrix is estimated assuming Normal IID errors. Both the covariance matrix and the residuals are returned.

10.1  Program Text

Program Text (g02qgfe.f90)

10.2  Program Data

Program Data (g02qgfe.d)

10.3  Program Results

Program Results (g02qgfe.r)

GnuplotProduced by GNUPLOT 4.6 patchlevel 3 0 500 1000 1500 2000 0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 Household Food Expenditure Household Income Example Program Quantile Regression Engels 1857 Study of Household Expenditure on Food gnuplot_plot_1 gnuplot_plot_2 τ = 0.10 gnuplot_plot_3 τ = 0.25 gnuplot_plot_4 τ = 0.50 gnuplot_plot_5 τ = 0.75 gnuplot_plot_6 τ = 0.90

11  Algorithmic Details

By the addition of slack variables the minimization (1) can be reformulated into the linear programming problem
minimize u, v, β + n × + n × p τ eT u + 1 - τ eT v ​   subject to   y = Xβ + u - v (2)
and its associated dual
maximize d yT d ​   subject to   XTd=0, d τ-1,τ n (3)
where e is a vector of n 1s. Setting a=d+1-τe gives the equivalent formulation
maximize a yT a ​   subject to   XT a = 1 - τ XT e , a 0,1 n . (4)
The algorithm introduced by Portnoy and Koenker (1997) and used by G02QGF, uses the primal-dual formulation expressed in equations (2) and (4) along with a logarithmic barrier function to obtain estimates for β. The algorithm is based on the predictor-corrector algorithm of Mehrotra (1992) and further details can be obtained from Portnoy and Koenker (1997) and Koenker (2005). A good description of linear programming, interior point algorithms, barrier functions and Mehrotra's predictor-corrector algorithm can be found in Nocedal and Wright (1999).

11.1  Interior Point Algorithm

In this section a brief description of the interior point algorithm used to estimate the model parameters is presented. It should be noted that there are some differences in the equations given here – particularly (7) and (9) – compared to those given in Koenker (2005) and Portnoy and Koenker (1997).

11.1.1  Central path

Rather than optimize (4) directly, an additional slack variable s is added and the constraint a 0,1 n  is replaced with a+s=e , a i 0 , s i 0 , for i= 1,2,,n .
The positivity constraint on a and s is handled using the logarithmic barrier function
B a,s,μ = yT a + μ i=1 n logai + logsi .  
The primal-dual form of the problem is used giving the Lagrangian
L a,s,β,u,μ = B a,s,μ - βT XT a - 1 - τ XT e - uT a + s - e  
whose central path is described by the following first order conditions
XTa = 1-τ XTe a+s = e Xβ+u-v = y SUe = μe AVe = μe (5)
where A denotes the diagonal matrix with diagonal elements given by a, similarly with S,U and V. By enforcing the inequalities on s and a strictly, i.e., ai>0 and si>0 for all i we ensure that A and S are positive definite diagonal matrices and hence A-1 and S-1 exist.
Rather than applying Newton's method to the system of equations given in (5) to obtain the step directions δβ,δa,δs,δu  and δv , Mehrotra substituted the steps directly into (5) giving the augmented system of equations
XT a + δa = 1-τXTe a + δa + s + δs = e X β + δβ + u + δu - v + δv = y S + Δs U + Δu e = μe A + Δa V + Δv e = μe (6)
where Δa,Δs,Δu  and Δv  denote the diagonal matrices with diagonal elements given by δa,δs,δu  and δv  respectively.

11.1.2  Affine scaling step

The affine scaling step is constructed by setting μ=0 in (5) and applying Newton's method to obtain an intermediate set of step directions
XT W X δ β = XT W y - X β + τ - 1 XT e + XT a δ a = W y-Xβ - X δ β δ s = - δ a δ u = S-1 U δ a - U e δ v = A-1 V δ s - V e (7)
where W = S-1 U + A-1 V -1 .
Initial step sizes for the primal (γ^P) and dual (γ^D) parameters are constructed as
γ^P = σ × min min i , δ a i < 0 ai / δ a i , min i , δ s i < 0 si / δ s i γ^D = σ × min min i , δ u i < 0 ui / δ u i , min i , δ v i < 0 vi / δ v i (8)
where σ is a user-supplied scaling factor. If γ^P × γ^D 1  then the nonlinearity adjustment, described in Section 11.1.3, is not made and the model parameters are updated using the current step size and directions.

11.1.3  Nonlinearity Adjustment

In the nonlinearity adjustment step a new estimate of μ is obtained by letting
g^γ^P,γ^D = s + γ^P δs T u + γ^D δu + a + γ^P δa T v + γ^D δv  
and estimating μ as
μ = g^γ^P,γ^D g^0,0 3 g^0,0 2n .  
This estimate, along with the nonlinear terms (Δu, Δs, Δa and Δv) from (6) are calculated using the values of δa,δs,δu  and δv  obtained from the affine scaling step.
Given an updated estimate for μ and the nonlinear terms the system of equations
XT W X δ β = XT W y - X β + μ S-1 - A-1 e + S-1 Δ s Δ u e - A-1 Δ a Δ v e + τ - 1 XT e + XT a δ a = W y-Xβ - X δ β + μ S-1 - A-1 δ s = - δ a δ u = μ S-1 e + S-1 U δ a - U e - S-1 Δs Δu e δ v = μ A-1 e + A-1 V δ s - V e - A-1 Δa Δv e (9)
are solved and updated values for δβ,δa,δs,δu,δv,γ^P  and γ^D  calculated.

11.1.4  Update and convergence

At each iteration the model parameters β,a,s,u,v  are updated using step directions, δβ,δa,δs,δu,δv  and step lengths γ^P,γ^D .
Convergence is assessed using the duality gap, that is, the differences between the objective function in the primal and dual formulations. For any feasible point u,v,s,a  the duality gap can be calculated from equations (2) and (3) as
τ eT u + 1-τ eT v - dT y = τ eT u + 1-τ eT v - a - 1 - τ e T y = sT u + aT v = eT u - aT y + 1 - τ eT X β  
and the optimization terminates if the duality gap is smaller than the tolerance supplied in the optional parameter Tolerance.

11.1.5  Additional information

Initial values are required for the parameters a,s,u,v and β. If not supplied by the user, initial values for β are calculated from a least squares regression of y on X. This regression is carried out by first constructing the cross-product matrix XTX and then using a pivoted QR decomposition as performed by F08BFF (DGEQP3). In addition, if the cross-product matrix is not of full rank, a rank reduction is carried out and, rather than using the full design matrix, X, a matrix formed from the first p-rank columns of XP is used instead, where P is the pivot matrix used during the QR decomposition. Parameter estimates, confidence intervals and the rows and columns of the matrices returned in the argument CH (if any) are set to zero for variables dropped during the rank-reduction. The rank reduction step is performed irrespective of whether initial values are supplied by the user.
Once initial values have been obtained for β, the initial values for u and v are calculated from the residuals. If ri<εu then a value of ±εu is used instead, where εu is supplied in the optional parameter Epsilon. The initial values for the a and s are always set to 1-τ and τ respectively.
The solution for δβ in both (7) and (9) is obtained using a Bunch–Kaufman decomposition, as implemented in F07MDF (DSYTRF).

11.2  Calculation of Covariance Matrix

G02QGF supplies four methods to calculate the covariance matrices associated with the parameter estimates for β. This section gives some additional detail on three of the algorithms, the fourth, (which uses bootstrapping), is described in Section 3.
(i) Independent, identically distributed (IID) errors
When assuming IID errors, the covariance matrices depend on the sparsity, sτ, which G02QGF estimates as follows:
(a) Let ri denote the residuals from the original quantile regression, that is ri = yi - xiT β^ .
(b) Drop any residual where ri is less than εu, supplied in the optional parameter Epsilon.
(c) Sort and relabel the remaining residuals in ascending order, by absolute value, so that εu < r1 < r2 < .
(d) Select the first l values where l=hnn, for some bandwidth hn.
(e) Sort and relabel these l residuals again, so that r1 < r2 < < rl  and regress them against a design matrix with two columns (p=2) and rows given by xi = 1, i/n-p  using quantile regression with τ=0.5.
(f) Use the resulting estimate of the slope as an estimate of the sparsity.
(ii) Powell Sandwich
When using the Powell Sandwich to estimate the matrix Hn, the quantity
cn = minσr, qr3 - qr1 / 1.34 × Φ-1 τ + hn - Φ-1 τ - hn  
is calculated. Dependent on the value of τ and the method used to calculate the bandwidth (hn), it is possible for the quantities τ±hn to be too large or small, compared to machine precision (ε). More specifically, when τ-hnε, or τ+hn1-ε, a warning flag is raised in INFO, the value is truncated to ε or 1-ε respectively and the covariance matrix calculated as usual.
(iii) Hendricks–Koenker Sandwich
The Hendricks–Koenker Sandwich requires the calculation of the quantity di= xiT β^ τ + hn - β^ τ - hn . As with the Powell Sandwich, in cases where τ-hnε, or τ+hn1-ε, a warning flag is raised in INFO, the value truncated to ε or 1-ε respectively and the covariance matrix calculated as usual.
In addition, it is required that di>0, in this method. Hence, instead of using 2 hn / di  in the calculation of Hn, max 2 hn / di + εu ,0  is used instead, where εu is supplied in the optional parameter Epsilon.

12  Optional Parameters

Several optional parameters in G02QGF control aspects of the optimization algorithm, methodology used, logic or output. Their values are contained in the arrays IOPTS and OPTS; these must be initialized before calling G02QGF by first calling G02ZKF with OPTSTR set to Initialize=G02QGF.
Each optional parameter has an associated default value; to set any of them to a non-default value, use G02ZKF. The current value of an optional parameter can be queried using G02ZLF.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in Section 12.1.

12.1  Description of the Optional Parameters

For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
Keywords and character values are case and white space insensitive.
Band Width AlpharDefault =1.0
A multiplier used to construct the parameter αb used when calculating the Sheather–Hall bandwidth (see Section 3), with αb=1-α×Band Width Alpha. Here, α is the Significance Level.
Constraint: Band Width Alpha>0.0.
Band Width MethodaDefault ='SHEATHER HALL'
The method used to calculate the bandwidth used in the calculation of the asymptotic covariance matrix Σ and H-1 if Interval Method=HKS, KERNEL or IID (see Section 3).
Constraint: Band Width Method=SHEATHER HALL or BOFINGER.
BigrDefault =10.020
This parameter should be set to something larger than the biggest value supplied in DAT and Y.
Constraint: Big>0.0.
Bootstrap Interval MethodaDefault =QUANTILE
If Interval Method=BOOTSTRAP XY, Bootstrap Interval Method controls how the confidence intervals are calculated from the bootstrap estimates.
Bootstrap Interval Method=T
t intervals are calculated. That is, the covariance matrix, Σ = σ ij : i,j = 1,2,,p  is calculated from the bootstrap estimates and the limits calculated as β i ± t n - p , 1 + α / 2 σ ii  where t n - p , 1 + α / 2  is the 1 + α / 2  percentage point from a Student's t distribution on n - p  degrees of freedom, n is the effective number of observations and α is given by the optional parameter Significance Level.
Bootstrap Interval Method=QUANTILE
Quantile intervals are calculated. That is, the upper and lower limits are taken as the 1 + α / 2  and 1 - α / 2  quantiles of the bootstrap estimates, as calculated using G01AMF.
Constraint: Bootstrap Interval Method=T or QUANTILE.
Bootstrap IterationsiDefault =100
The number of bootstrap samples used to calculate the confidence limits and covariance matrix (if requested) when Interval Method=BOOTSTRAP XY.
Constraint: Bootstrap Iterations>1.
Bootstrap MonitoringaDefault =NO
If Bootstrap Monitoring=YES and Interval Method=BOOTSTRAP XY, then the parameter estimates for each of the bootstrap samples are displayed. This information is sent to the unit number specified by Unit Number.
Constraint: Bootstrap Monitoring=YES or NO.
Calculate Initial ValuesaDefault =YES
If Calculate Initial Values=YES then the initial values for the regression parameters, β, are calculated from the data. Otherwise they must be supplied in B.
Constraint: Calculate Initial Values=YES or NO.
Defaults
This special keyword is used to reset all optional parameters to their default values.
Drop Zero WeightsaDefault =YES
If a weighted regression is being performed and Drop Zero Weights=YES then observations with zero weight are dropped from the analysis. Otherwise such observations are included.
Constraint: Drop Zero Weights=YES or NO.
EpsilonrDefault =ε
εu, the tolerance used when calculating the covariance matrix and the initial values for u and v. For additional details see Section 11.2 and Section 11.1.5 respectively.
Constraint: Epsilon0.0.
Interval MethodaDefault =IID
The value of Interval Method controls whether confidence limits are returned in BL and BU and how these limits are calculated. This parameter also controls how the matrices returned in CH are calculated.
Interval Method=NONE
No limits are calculated and BL, BU and CH are not referenced.
Interval Method=KERNEL
The Powell Sandwich method with a Gaussian kernel is used.
Interval Method=HKS
The Hendricks–Koenker Sandwich is used.
Interval Method=IID
The errors are assumed to be identical, and independently distributed.
Interval Method=BOOTSTRAP XY
A bootstrap method is used, where sampling is done on the pair yi,xi. The number of bootstrap samples is controlled by the parameter Bootstrap Iterations and the type of interval constructed from the bootstrap samples is controlled by Bootstrap Interval Method.
Constraint: Interval Method=NONE, KERNEL, HKS, IID or BOOTSTRAP XY.
Iteration LimitiDefault =100
The maximum number of iterations to be performed by the interior point optimization algorithm.
Constraint: Iteration Limit>0.
Matrix ReturnedaDefault =NONE
The value of Matrix Returned controls the type of matrices returned in CH. If Interval Method=NONE, this parameter is ignored and CH is not referenced. Otherwise:
Matrix Returned=NONE
No matrices are returned and CH is not referenced.
Matrix Returned=COVARIANCE
The covariance matrices are returned.
Matrix Returned=H INVERSE
If Interval Method=KERNEL or HKS, the matrices J and H-1 are returned. Otherwise no matrices are returned and CH is not referenced.
The matrices returned are calculated as described in Section 3, with the algorithm used specified by Interval Method. In the case of Interval Method=BOOTSTRAP XY the covariance matrix is calculated directly from the bootstrap estimates.
Constraint: Matrix Returned=NONE, COVARIANCE or H INVERSE.
MonitoringaDefault =NO
If Monitoring=YES then the duality gap is displayed at each iteration of the interior point optimization algorithm. In addition, the final estimates for β are also displayed.
The monitoring information is sent to the unit number specified by Unit Number.
Constraint: Monitoring=YES or NO.
QR TolerancerDefault =ε0.9
The tolerance used to calculate the rank, k, of the p×p cross-product matrix, XTX. Letting Q be the orthogonal matrix obtained from a QR decomposition of XTX, then the rank is calculated by comparing Qii with Q11×QR Tolerance.
If the cross-product matrix is rank deficient, then the parameter estimates for the p-k columns with the smallest values of Qii are set to zero, along with the corresponding entries in BL, BU and CH, if returned. This is equivalent to dropping these variables from the model. Details on the QR decomposition used can be found in F08BFF (DGEQP3).
Constraint: QR Tolerance>0.0.
Return ResidualsaDefault =NO
If Return Residuals=YES, the residuals are returned in RES. Otherwise RES is not referenced.
Constraint: Return Residuals=YES or NO.
SigmarDefault =0.99995
The scaling factor used when calculating the affine scaling step size (see equation (8)).
Constraint: 0.0<Sigma<1.0.
Significance LevelrDefault =0.95
α, the size of the confidence interval whose limits are returned in BL and BU.
Constraint: 0.0<Significance Level<1.0.
TolerancerDefault =ε
Convergence tolerance. The optimization is deemed to have converged if the duality gap is less than Tolerance (see Section 11.1.4).
Constraint: Tolerance>0.0.
Unit NumberiDefault taken from X04ABF
The unit number to which any monitoring information is sent.
Constraint: Unit Number>1.

13  Description of Monitoring Information

See the description of the optional argument Monitoring.

G02QGF (PDF version)
G02 Chapter Contents
G02 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2016