naginterfaces.library.correg.quantile_linreg_easy¶
- naginterfaces.library.correg.quantile_linreg_easy(x, y, tau, io_manager=None)[source]¶
quantile_linreg_easy
performs a multiple linear quantile regression, returning the parameter estimates and associated confidence limits based on an assumption of Normal, independent, identically distributed errors.quantile_linreg_easy
is a simplified version ofquantile_linreg()
.For full information please refer to the NAG Library document for g02qf
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02qff.html
- Parameters
- xfloat, array-like, shape
, the design matrix, with the th value for the th variate supplied in , for , for .
- yfloat, array-like, shape
, the observations on the dependent variable.
- taufloat, array-like, shape
The vector of quantiles of interest. A separate model is fitted to each quantile.
- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- dffloat
The degrees of freedom given by , where is the number of observations and is the rank of the cross-product matrix .
- bfloat, ndarray, shape
, the estimates of the parameters of the regression model, with containing the coefficient for the variable in column of , estimated for .
- blfloat, ndarray, shape
, the lower limit of a confidence interval for , with holding the lower limit associated with .
- bufloat, ndarray, shape
, the upper limit of a confidence interval for , with holding the upper limit associated with .
- infoint, ndarray, shape
holds additional information concerning the model fitting and confidence limit calculations when .
Code
Warning
Model fitted and confidence limits calculated successfully.
The function 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 function 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 is the sum of the corresponding individual nonzero warning codes.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: .
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: where is the machine precision returned by
machine.precision
, for all .
- Warns
- NagAlgorithmicWarning
- (errno )
A potential problem occurred whilst fitting the model(s).
Additional information has been returned in .
- Notes
Given a vector of observed values, , an design matrix , a column vector, , of length holding the th row of and a quantile ,
quantile_linreg_easy
estimates the -element vector as the solution towhere is the piecewise linear loss function , and is an indicator function taking the value if and otherwise.
quantile_linreg_easy
assumes Normal, independent, identically distributed (IID) errors and calculates the asymptotic covariance matrix fromwhere 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 .
Further details of the algorithms used by
quantile_linreg_easy
can be found in the documentation forquantile_linreg()
.
- References
Koenker, R, 2005, Quantile Regression, Econometric Society Monographs, Cambridge University Press, New York