Learn R Programming

prodlim (version 1.2.1)

neighborhood: Symmetric neighborhoods for kernel smoothing

Description

Nearest neighborhoods for the values of a continuous predictor. The result is used for the conditional Kaplan-Meier estimator and other conditional product limit estimators.

Usage

neighborhood(x, bandwidth = NULL, kernel = "box")

Arguments

x
Numeric vector -- typically the observations of a continuous random variate.
bandwidth
Controls the distance between neighbors in a neighborhood. It can be a decimal, i.e. the bandwidth, or the string `"smooth"', in which case the fourth root of the sample size is used, or NULL in which case the
kernel
Only the rectangular kernel ("box") is implemented.

Value

  • An object of class 'neighborhood'. The value is a list that includes the unique values of `x' (values) for which a neighborhood, consisting of the nearest neighbors, is defined by the first neighbor (first.nbh) of the usually very long vector neighbors and the size of the neighborhood (size.nbh). Further values are the arguments bandwidth, kernel, the total sample size n and the number of unique values nu.

References

Stute, W. "Asymptotic Normality of Nearest Neighbor Regression Function Estimates", The Annals of Statistics, 1984,12,917--926.

See Also

dpik, prodlim

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
library(survival)
data(pbc)
neighborhood(pbc$age)

Run the code above in your browser using DataLab