Skip to contents

wt_kern calculates the appropriate kernel weights for a vector. This is useful when, for instance, one wishes to perform local regression. It is based on the kernelwts function in the "rdd" package. This is an internal function and is typically not directly invoked by the user. It can be accessed using the triple colon, as in rddapp:::wt_kern().

Usage

wt_kern(X, center, bw, kernel = "triangular")

Arguments

X

A numeric vector containing the the input X values. This variable represents the axis along which kernel weighting should be performed.

center

A numeric value specifying the point from which distances should be calculated.

bw

A numeric value specifying the bandwidth.

kernel

A string indicating which kernel to use. Options are "triangular" (default and recommended), "rectangular", "epanechnikov", "quartic", "triweight", "tricube", and "cosine".

Value

wt_kern returns a vector of weights with length equal to that of the X input (one weight per element of X).

References

Drew Dimmery (2016). rdd: Regression Discontinuity Estimation. R package version 0.57. https://CRAN.R-project.org/package=rdd