Title: | Bandwidth Selectors for Local Linear Quantile Regression |
---|---|
Description: | Bandwidth selectors for local linear quantile regression, including cross-validation and plug-in methods. The local linear quantile regression estimate is also implemented. |
Authors: | Mercedes Conde-Amboage [aut, cre]
|
Maintainer: | Mercedes Conde-Amboage <[email protected]> |
License: | GPL-2 |
Version: | 0.1.0 |
Built: | 2025-03-07 04:18:45 UTC |
Source: | https://github.com/cran/BwQuant |
The R package BwQuant
implements different bandwidth selectors for local linear quantile regression, including selectors based on rule of thumb, plug-in and cross-validation tecniques.
Mercedes Conde-Amboage <[email protected]> and Cesar Sanchez-Sellero <[email protected]>
Maintainer: Mercedes Conde-Amboage <[email protected]>
Function to compute a bandwidth for local linear quantile regression following the cross-validation criteria presented by Abberger (1998).
bwCV(x, y, hseq, tau)
bwCV(x, y, hseq, tau)
x |
numeric vector of |
y |
numeric vector of |
hseq |
sequence of values where the cross-validation function will be evaluated. |
tau |
the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1. |
The cross-validation function is evaluated at each element of hseq
. Then, the cross-validation selector will be the element of hseq
that minimizes the cross-validation function.
Returns a number with the chosen bandwidth.
Mercedes Conde-Amboage and Cesar Sanchez-Sellero.
Abberger, K. (1998). Cross-validation in nonparametric quantile regression. Allgemeines Statistisches Archiv, 82, 149-161.
Abberger, K. (2002). Variable data driven bandwidth choice in nonparametric quantile regression. Technical Report.
The obtained bandwidth can be used in the function llqr
to produce a local linear estimate of the tau
-quantile regression function.
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) hseq=seq(0.05,0.8,length=21) tau=0.25 bwCV(x,y,hseq,tau)
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) hseq=seq(0.05,0.8,length=21) tau=0.25 bwCV(x,y,hseq,tau)
Function to compute a bandwidth selector for local linear quantile regression following the plug-in rule proposed in Section 2.2 of Conde-Amboage and Sanchez-Sellero (2018).
bwPI(x, y, tau)
bwPI(x, y, tau)
x |
numeric vector of |
y |
numeric vector of |
tau |
the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1. |
Returns a bandwidth for a local linear estimate of the tau
-quantile regression function.
Mercedes Conde-Amboage and Cesar Sanchez-Sellero.
Conde-Amboage, M. and Sanchez-Sellero, C. (2018). A plug-in bandwidth selector for nonparametric quantile regression. TEST, 28, 423-450. <doi:10.1007/s11749-018-0582-6>.
The obtained bandwidth can be used in the function llqr
to produce a local linear estimate of the tau
-quantile regression function.
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwPI(x,y,tau)
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwPI(x,y,tau)
Function to compute a bandwidth selector for local linear quantile regression following the rule of thumb presented in Section 2.1 of Conde-Amboage and Sanchez-Sellero (2018).
bwRT(x, y, tau)
bwRT(x, y, tau)
x |
numeric vector of |
y |
numeric vector of |
tau |
the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1. |
Returns a bandwidth for a local linear estimate of the tau
-quantile regression function.
Mercedes Conde-Amboage and Cesar Sanchez-Sellero.
Conde-Amboage, M. and Sanchez-Sellero, C. (2018). A plug-in bandwidth selector for nonparametric quantile regression. TEST, 28, 423-450. <doi:10.1007/s11749-018-0582-6>.
The obtained bandwidth can be used in the function llqr
to produce a local linear estimate of the tau
-quantile regression function.
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwRT(x,y,tau)
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwRT(x,y,tau)
Function to compute a bandwidth selector for local linear quantile regression following the plug-in rule proposed by Yu and Jones (1998).
bwYJ(x, y, tau)
bwYJ(x, y, tau)
x |
numeric vector of |
y |
numeric vector of |
tau |
the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1. |
Returns a bandwidth for a local linear estimate of the tau
-quantile regression function.
Mercedes Conde-Amboage and Cesar Sanchez-Sellero.
Ruppert, D., Sheather, S. J. and Wand, M. P. (1995). An efective bandwidth selector for local least squares regression. Journal of the American Statistical Association. 90, 1257-1270.
Yu, K. and Jones, M. C. (1998). Local linear quantile regression. Journal of the American Statistical Association, 93, 228-237.
The obtained bandwidth can be used in the function llqr
to produce a local linear estimate of the tau
-quantile regression function.
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwYJ(x,y,tau)
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 bwYJ(x,y,tau)
Function that estimates the quantile regression function using a local linear kernel smoother.
llqr(x, y, tau, t, h)
llqr(x, y, tau, t, h)
x |
numeric vector of |
y |
numeric vector of |
tau |
the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1. |
t |
the values of |
h |
the bandwidth parameter. |
A list with the following components:
x.values |
the given points at which the evaluation occurs. |
y.values |
the estimated values of the quantile regression function at the given |
Mercedes Conde-Amboage and Cesar Sanchez-Sellero.
Fan, J., Hu, T. C. and Truong, Y. K. (1994). Robust nonparametric function estimation. Scandinavian Journal of Statistics, 21, 433-446.
Yu, K. and Jones, M. C. (1998). Local linear quantile regression. Journal of the American Statistical Association, 93, 228-237.
The argument h
with the bandwidth parameter can be fixed to some arbitrary value or chosen by one of the procedures implemented in the functions bwCV
, bwPI
, bwRT
or bwYJ
.
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 h=bwPI(x,y,tau) t=seq(0,1,length=101) m=llqr(x,y,tau,t,h) plot(x,y) lines(m$x.values,m$y.values)
set.seed(1234) x=runif(100) y=10*(x^4+x^2-x)+rexp(100) tau=0.25 h=bwPI(x,y,tau) t=seq(0,1,length=101) m=llqr(x,y,tau,t,h) plot(x,y) lines(m$x.values,m$y.values)