Package 'BwQuant'

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] , Cesar Sanchez-Sellero [aut]
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

Help Index


Bandwidth selectors for local linear quantile regression

Description

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.

Author(s)

Mercedes Conde-Amboage <[email protected]> and Cesar Sanchez-Sellero <[email protected]>

Maintainer: Mercedes Conde-Amboage <[email protected]>


Computing the cross-validation bandwidth proposed by Abberger (1998)

Description

Function to compute a bandwidth for local linear quantile regression following the cross-validation criteria presented by Abberger (1998).

Usage

bwCV(x, y, hseq, tau)

Arguments

x

numeric vector of x data.

y

numeric vector of y data. This must be the same length as x.

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.

Details

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.

Value

Returns a number with the chosen bandwidth.

Author(s)

Mercedes Conde-Amboage and Cesar Sanchez-Sellero.

References

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.

See Also

The obtained bandwidth can be used in the function llqr to produce a local linear estimate of the tau-quantile regression function.

Examples

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)

Computing the plug-in bandwidth proposed by Conde-Amboage and Sanchez-Sellero (2018)

Description

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).

Usage

bwPI(x, y, tau)

Arguments

x

numeric vector of x data.

y

numeric vector of y data. This must be the same length as x.

tau

the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1.

Value

Returns a bandwidth for a local linear estimate of the tau-quantile regression function.

Author(s)

Mercedes Conde-Amboage and Cesar Sanchez-Sellero.

References

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>.

See Also

The obtained bandwidth can be used in the function llqr to produce a local linear estimate of the tau-quantile regression function.

Examples

set.seed(1234)
x=runif(100)
y=10*(x^4+x^2-x)+rexp(100)
tau=0.25
bwPI(x,y,tau)

Computing a bandwidth using a rule of thumb

Description

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).

Usage

bwRT(x, y, tau)

Arguments

x

numeric vector of x data.

y

numeric vector of y data. This must be the same length as x.

tau

the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1.

Value

Returns a bandwidth for a local linear estimate of the tau-quantile regression function.

Author(s)

Mercedes Conde-Amboage and Cesar Sanchez-Sellero.

References

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>.

See Also

The obtained bandwidth can be used in the function llqr to produce a local linear estimate of the tau-quantile regression function.

Examples

set.seed(1234)
x=runif(100)
y=10*(x^4+x^2-x)+rexp(100)
tau=0.25
bwRT(x,y,tau)

Computing the plug-in bandwidth proposed by Yu and Jones (1998)

Description

Function to compute a bandwidth selector for local linear quantile regression following the plug-in rule proposed by Yu and Jones (1998).

Usage

bwYJ(x, y, tau)

Arguments

x

numeric vector of x data.

y

numeric vector of y data. This must be the same length as x.

tau

the quantile order where the regression function is to be estimated. It must be a number strictly between 0 and 1.

Value

Returns a bandwidth for a local linear estimate of the tau-quantile regression function.

Author(s)

Mercedes Conde-Amboage and Cesar Sanchez-Sellero.

References

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.

See Also

The obtained bandwidth can be used in the function llqr to produce a local linear estimate of the tau-quantile regression function.

Examples

set.seed(1234)
x=runif(100)
y=10*(x^4+x^2-x)+rexp(100)
tau=0.25
bwYJ(x,y,tau)

Fitting a local linear quantile regression model

Description

Function that estimates the quantile regression function using a local linear kernel smoother.

Usage

llqr(x, y, tau, t, h)

Arguments

x

numeric vector of x data.

y

numeric vector of y data. This must be the same length as x.

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 x at which the quantile regression model is to be estimated.

h

the bandwidth parameter.

Value

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 x.values.

Author(s)

Mercedes Conde-Amboage and Cesar Sanchez-Sellero.

References

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.

See Also

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.

Examples

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)