calc.kw: Calculate Kernel weights

View source: R/calc.kw.R

calc.kwR Documentation

Calculate Kernel weights

Description

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

Usage

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 risk score values in the data; it cannot be any other vector of arbitrary length.


tdROC documentation built on May 29, 2024, 3:47 a.m.

Related to calc.kw in tdROC...