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..::..Int32On entry: , the number of observations in the dataset.Constraint: .
- m
- Type: System..::..Int32On entry: , the number of variates in the model.Constraint: .
- x
- Type: array<System..::..Double,2>[,](,)[,][,]On entry: , the design matrix, with the th value for the th variate supplied in , for and .
- y
- Type: array<System..::..Double>[]()[][]An array of size [n]On entry: , observations on the dependent variable.
- ntau
- Type: System..::..Int32On entry: the number of quantiles of interest.Constraint: .
- 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: where is the machine precision returned by x02aj, for .
- df
- Type: System..::..Double%On exit: the degrees of freedom given by , where is the number of observations and is the rank of the cross-product matrix .
- b
- Type: array<System..::..Double,2>[,](,)[,][,]On exit: , the estimates of the parameters of the regression model, with containing the coefficient for the variable in column of x, estimated for .
- bl
- Type: array<System..::..Double,2>[,](,)[,][,]On exit: , the lower limit of a confidence interval for , with holding the lower limit associated with .
- bu
- Type: array<System..::..Double,2>[,](,)[,][,]On exit: , the upper limit of a confidence interval for , with holding the upper limit associated with .
- info
- Type: array<System..::..Int32>[]()[][]An array of size []On exit: holds additional information concerning the model fitting and confidence limit calculations when .
Code Warning Model fitted and confidence limits calculated successfully. The method did not converge whilst calculating the parameter estimates. The returned values are based on the estimate at the last iteration. A singular matrix was encountered during the optimization. The model was not fitted for this value of . The method did not converge whilst calculating the confidence limits. The returned limits are based on the estimate at the last iteration. 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. 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: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
Given a vector of observed values,
, an design matrix , a column vector, , of length holding the th row of and a quantile , g02qf estimates the -element vector as the solution to
where is the piecewise linear loss function , and is an indicator function taking the value if and otherwise.
(1) |
g02qf assumes Normal, independent, identically distributed (IID) errors and calculates the asymptotic covariance matrix from
where is the sparsity function, which is estimated from the residuals,
(see Koenker (2005)).
Given an estimate of the covariance matrix, , lower, , and upper, , limits for a confidence interval are calculated for each of the parameters, via
where is the percentile of the Student's distribution with degrees of freedom, where is the rank of the cross-product matrix .
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:
- On entry, .
On entry, , or .
- On entry, .
- On entry, tau is invalid.
- On exit, problems were encountered whilst fitting at least one model. Additional information has been returned in info.
Accuracy
Not applicable.
Parallelism and Performance
None.
Further Comments
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