calc.kw: Calculate Kernel weights

Description Usage Arguments Value Note

View source: R/calc.kw.R

Description

This function calculate the nearest neighbor kernel weights using uniform kernel weights.

Usage

1
calc.kw(X, x0, span = 0.1, h = NULL, type = "uniform")

Arguments

X

the vector of biomarker values from other subjects used to calculate the weights around the center x0.

x0

a scalar as the center around which the kernel weights are calculated.

span

a numeric value of the proportion of neighbour observations used, default is 0.1.

h

a numeric value of the bandwidth of kernel weights, defualt is NULL. If not specified, the function used the value of span to calculate weights. If both span and h are specified, the function will ignore the span and used bandwidth of kernel function instead.

type

a character value of the type of kernel function used to calculate kernel weights. Default is "uniform" kernel. Other options are "Epanichnekov" and "normal". It will only be used when the bandwidth h is specified.

Value

Return a vector of kernel weights for each element in X. It has the same length as X.

Note

X must be the vector of ALL biomarker values in the data; it cannot be any other vector of arbitrary length.


tdROC documentation built on May 2, 2019, 8:31 a.m.

Related to calc.kw in tdROC...