Learn R Programming

NPCox (version 1.3)

bandselect: Bandwidth selection function for 'npcox' and 'spcox'.

Description

The embeded bandwidth selection function in 'npcox' and 'spcox' together with prediction error calculation.

Usage

bandselect(cva, delta, obstime, bandwidth = FALSE)

Value

Prediction error on given bandwidth or list that contains the optimal bandwidth, an arithmetic progression of bandwidths with corresponding prediction error.

Arguments

cva

Covariate Z in h(t) = h0(t)exp(b(t)'Z)

delta

Right censoring indicator for the model

obstime

The observed time = min(censoring time, observed failure time)

bandwidth

Bandwidth for kernel function, which can be specified. The default value is FALSE and can be selected through least prediction error over all subjects.

Details

This is some description of this function.

'bandwidth_selection' function can provide the prediction error calculation with given bandwidth, or produce the optimal bandwidth based on an arithmetic progression of bandwidths.

Examples

Run this code
data(pbc)
dta  = na.omit(pbc[,c('time', 'status', 'age', "edema")])
dta  = dta[dta$time>600 & dta$time<2000,]
dta[,'status'] = sign(dta[,'status'])
colnames(dta) = c('time', 'status', 'age',  "edema")
res = bandselect(cva = dta[,3:4], delta = dta$status, obstime = dta$time, bandwidth = 700)

Run the code above in your browser using DataLab