kernel.est: Estimate the probability in state and restricted mean time in...

Description Usage Arguments Value Examples

View source: R/kernel.est.R

Description

This function implements the non-parametric kernel estimator of the probability in state and restricted mean time in state in an illness-death model with component-wise censoring, based on the method of Sun, Huang and Wang (2017).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
kernel.est(
  dat,
  bandwidth,
  tau2,
  prob.times = NULL,
  mu.times = NULL,
  boundary = "boundary.kernel",
  kfun = "epanechnikov",
  std.err = "none",
  B = 50,
  boot.seed = NULL,
  scale = 1
)

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, and the variables dtime and dstatus which are the time and event indicator for death, and the variable nvisits is the number of visits. xi=1 represents alive and event free (state 1 in a multistate illness-death model), and xi=2 represents alive with event.

bandwidth

specifies the bandwidth to be used for the kernel estimator. This can be selected data-adaptively using the dab() function.

tau2

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

prob.times

a vector of times at which probability in state will be estimated

mu.times

a vector of restriction times at which restricted mean time in state will be estimated

boundary

specifies how kernel estimation is done in the left boundary region from zero to the bandwidth. The default is boundary.kernel, meaning a boundary kernel is used in the left boundary region. Set boundary = 'interpolation' to use linear interpolation through the points (0,1) and (h, r) where h is the bandwidth and r is the kernel estimate at time h.

kfun

specifies the kernel function to be used for estimation. The default is epanechnikov; other possible values are triweight, biweight and uniform

std.err

If std.err= 'asymptotic' or 'boot', the function calculates the standard error estimates and 95% confidence intervals for each quantity using the asymptotic or bootstrap estimators. (std.err= 'none' is the default.)

B

the number of bootstrap samples; the default value of 50 for the sake of computation time, but we recommend increasing it

boot.seed

If boot.seed is specified, set.seed(boot.seed) will be run before generating bootstrap samples, so the samples can be reproduced.

scale

a scaling factor for the restricted mean time in state output. For example, if times are in days and you want the output to reflect restricted mean years in state, set scale = 365.25.

Value

A list with up to two elements: an element called prob.info if prob.times was non-null, and an element called mu.info if mu.times was non-null. prob.info contains probability in state estimates and mu.info contains restricted mean time in state estimates. The columns in prob.info are t, p1, p2, p3 for time and probability in state 1, 2 and 3, respectively. If std.err ='boot' or 'asymptotic', additional columns are added with standard error estimates and lower and upper limits of the 95% confidence interval for each estimate. The columns in mu.info are analogous.

Examples

1
2
3
4
5
6
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)
kernel.est(mydat, bandwidth=12*30.4, tau2=30.4*48, prob.times=30.4*48, mu.times=30.4*48,
boundary = 'boundary.kernel', kfun='epanechnikov',
std.err='none',  scale=12*30.4)

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