dab: Find bandwidth that minimizes cross validation error

Description Usage Arguments Value Examples

View source: R/dab.R

Description

This function searches a grid to find the bandwidth that minimizes mean squared leave-one-out cross validation error. The procedure uses a first-order kernel, and thus yields a bandwidth on the order of n^(-1/3). We recommend using a bandwidth on the order of n^(-7/24) in the kernel estimator, which can be obtained by multiplying the bandwidth returned by the dab function by n^(1/24).

Usage

1
dab(dat, lower, upper, tau, tau2, length.out = 5000)

Arguments

dat

a dataframe with one row per individual with the variables t1-tm and x1-xm where m is the number of visits and ti and xi are the time and status at each visit. xi=1 represents alive and event free (state 1 in a multistate illness-death model), and xi=2 represents alive with event.

lower

the lower end of the interval that will be searched

upper

the upper end of the interval that will be searched

tau

the maximum visit time that will be used in the cross-validation

tau2

the maximum time that individuals were at risk for a visit, based on the study design

length.out

the number of grid points in the interval [lower, upper] that will be considered. Default is 5000.

Value

the bandwidth minimizes cross-validation error. We recommend multiplying by n^(1/24) to get a bandwidth on the order of n^(-7/24) for the kernel estiamtor.

Examples

1
2
3
4
mydat <- simdat(50, scale12=1/.0008, scale13=1/.0002, scale23=1/.0016,
vital.lfu=c(30.4*36, 30.4*48),
visit.schedule = 30.4*c(6, 12, 18, 24, 30, 36, 42, 48), scatter.sd=10)
dab(mydat, lower = 30.4, upper = 36*30.4, tau = 30.4*48, tau2=30.4*48,length.out = 100)

anneae/cwcens documentation built on Aug. 14, 2021, 7:20 p.m.