kre: Kernel Regression Estimation

Description Usage Arguments Details Value Warning Author(s) References Examples

Description

To fit a non-parametric relation between a pair of random variables by using kernel method.

Usage

1
2
kre(x, y, h, kernel = c("epan", "unif", "tria", "quar", 
     "triw", "tric", "gaus", "cos"), plot = FALSE)   

Arguments

x

input of explanatory values.

y

input of response values.

h

the smoothing bandwidth. See 'Details' of the default bandwidth.

kernel

a character string which determines the smoothing kernel function. This must be one of "unif" (uniform), "tria" (triangular), "epan" (epanechnikov), "quar" (quartic), "triw" (triweight), "tric" (tricube), "gaus" (gaussian) and "cos" (cosine). The default is "epan".

plot

a logical indicating whether to plot the graph with fitted line.

Details

Kernel regression is a non-parametric technique to find a non-linear relation between a pair of random variables X and Y. It is also called Nadaraya-Watson kernel regression which estimates the conditional expectation of a random variable, i.e., E(Y|X). The default smoothing bandwidth is the optimal plug-in bandwidth in Fan and Gijbels (1996), i.e., h = c*n^(-1/5), where c is a constant and replaced by IQR in this function. Note that it provides the initial bandwidth and may not be the best one. Missing values have been removed.

Value

results

a matrix including the original data of explanatory variable x (first column), the original data of response variable y (second column), and the fitted values of response yhat (third column).

bw

the smoothing bandwidth used.

Warning

The smoothing bandwidth is always a critical issue in non-parametric statistics. The default smoothing bandwidth suggested by Fan and Gijbels (1996) may not perform well in some cases. You are recommended to provide one obtained by other methods.

Author(s)

Debin Qiu <debinqiu@uga.edu>

References

Fan, I. Gijbels (1996). Local Polynomial Modeling and its Applications. Chapman & Hall, London.

Li, Q., Racine, J. (2007). Nonparametric Econometrics: Theory and Practice. Princeton University Press. ISBN 0-691-12161-3.

Nadaraya, E. A. (1964). On Estimating Regression. Theory of Probability and its Applications 9(1): 141-2.

Examples

1
2
3
x <- rnorm(100)
y <- 1 + 4*x^2 + rnorm(100)
kr <- kre(x,y, kernel = "epan", plot = TRUE)

snpar documentation built on May 1, 2019, 10:51 p.m.