g02qf performs a multiple linear quantile regression, returning the parameter estimates and associated confidence limits based on an assumption of Normal, independent, identically distributed errors. g02qf is a simplified version of g02qg.

Syntax

C#
public static void g02qf(
	int n,
	int m,
	double[,] x,
	double[] y,
	int ntau,
	double[] tau,
	out double df,
	double[,] b,
	double[,] bl,
	double[,] bu,
	int[] info,
	out int ifail
)
Visual Basic
Public Shared Sub g02qf ( _
	n As Integer, _
	m As Integer, _
	x As Double(,), _
	y As Double(), _
	ntau As Integer, _
	tau As Double(), _
	<OutAttribute> ByRef df As Double, _
	b As Double(,), _
	bl As Double(,), _
	bu As Double(,), _
	info As Integer(), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02qf(
	int n, 
	int m, 
	array<double,2>^ x, 
	array<double>^ y, 
	int ntau, 
	array<double>^ tau, 
	[OutAttribute] double% df, 
	array<double,2>^ b, 
	array<double,2>^ bl, 
	array<double,2>^ bu, 
	array<int>^ info, 
	[OutAttribute] int% ifail
)
F#
static member g02qf : 
        n : int * 
        m : int * 
        x : float[,] * 
        y : float[] * 
        ntau : int * 
        tau : float[] * 
        df : float byref * 
        b : float[,] * 
        bl : float[,] * 
        bu : float[,] * 
        info : int[] * 
        ifail : int byref -> unit 

Parameters

n
Type: System..::..Int32
On entry: n, the number of observations in the dataset.
Constraint: n2.
m
Type: System..::..Int32
On entry: p, the number of variates in the model.
Constraint: 1m<n.
x
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [n, m]
On entry: X, the design matrix, with the ith value for the jth variate supplied in x[i-1,j-1], for i=1,2,,n and j=1,2,,m.
y
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: y, observations on the dependent variable.
ntau
Type: System..::..Int32
On entry: the number of quantiles of interest.
Constraint: ntau1.
tau
Type: array<System..::..Double>[]()[][]
An array of size [ntau]
On entry: the vector of quantiles of interest. A separate model is fitted to each quantile.
Constraint: ε<tau[l-1]<1-ε where ε is the machine precision returned by x02aj, for l=1,2,,ntau.
df
Type: System..::..Double%
On exit: the degrees of freedom given by n-k, where n is the number of observations and k is the rank of the cross-product matrix XTX.
b
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [m, ntau]
On exit: β^, the estimates of the parameters of the regression model, with b[j-1,l-1] containing the coefficient for the variable in column j of x, estimated for τ=tau[l-1].
bl
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [m, ntau]
On exit: β^L, the lower limit of a 95% confidence interval for β^, with bl[j-1,l-1] holding the lower limit associated with b[j-1,l-1].
bu
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [m, ntau]
On exit: β^U, the upper limit of a 95% confidence interval for β^, with bu[j-1,l-1] holding the upper limit associated with b[j-1,l-1].
info
Type: array<System..::..Int32>[]()[][]
An array of size [ntau]
On exit: info[l] holds additional information concerning the model fitting and confidence limit calculations when τ=tau[l].
CodeWarning
0Model fitted and confidence limits calculated successfully.
1The method did not converge whilst calculating the parameter estimates. The returned values are based on the estimate at the last iteration.
2A singular matrix was encountered during the optimization. The model was not fitted for this value of τ.
8The method did not converge whilst calculating the confidence limits. The returned limits are based on the estimate at the last iteration.
16Confidence 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.
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.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

Given a vector of n observed values, y=yi: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, g02qf estimates the p-element vector β as the solution to
minimizeβp i=1 n ρτyi-xiTβ (1)
where ρτ is the piecewise linear loss function ρτz=zτ-Iz<0, and Iz<0 is an indicator function taking the value 1 if z<0 and 0 otherwise.
g02qf assumes Normal, independent, identically distributed (IID) errors and calculates the asymptotic covariance matrix from
Σ=τ1-τnsτ2XTX-1
where s is the sparsity function, which is estimated from the residuals, ri=yi-xiTβ^ (see Koenker (2005)).
Given an estimate of the covariance matrix, Σ^, lower, β^L, and upper, β^U, limits for a 95% confidence interval are calculated for each of the p parameters, via
β^Li=β^i-tn-p,0.975Σ^ii,β^Ui=β^i+tn-p,0.975Σ^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.
Further details of the algorithms used by g02qf can be found in the documentation for g02qg.

References

Koenker R (2005) Quantile Regression Econometric Society Monographs, Cambridge University Press, New York

Error Indicators and Warnings

Errors or warnings detected by the method:
ifail=11
On entry, n<2.
ifail=21
On entry,m<1,
ormn.
ifail=51
On entry, ntau<1.
ifail=61
On entry, tau is invalid.
ifail=111
On exit, problems were encountered whilst fitting at least one model. Additional information has been returned in info.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

Not applicable.

Parallelism and Performance

None.

Further Comments

Calling g02qf is equivalent to calling g02qg with
  • rcord=2,
  • rcord=1, ic1="N",
  • _weight="U",
  • lddat=n,
  • setting each element of isx to 1,
  • ip=m,
  • Interval Method=IID, and
  • Significance Level=0.95.

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 household income. An intercept is included in the model by augmenting the dataset with a column of ones.

Example program (C#): g02qfe.cs

Example program data: g02qfe.d

Example program results: g02qfe.r

See Also