funcen {smoothROCtime} | R Documentation |
Bivariate kernel density estimation under random censoring
Description
Computes the kernel density estimation of the bivariate vector (marker, time-to-event)
with the time-to-event variable subject to right censorship, according to the procedure exposed in https://doi.org/10.1177/0962280217740786.
Usage
funcen(data, H, bw, adj, ...)
Arguments
data |
matrix with three columns: time-to-event, censoring status (0=censored/1=uncensored) and marker. |
H |
2x2 bandwidth matrix when it is specified in an explicit way. |
bw |
method for computing the bandwidth matrix. Most of the methods included in the |
adj |
adjusment parameter for calculating the bandwidth matrix. Default value 1. |
... |
|
Details
The matrix of bandwidths can be defined by using H=matrix() or automatically selected by the method indicated in bw.
Given the matrix of bandwidths, H, the argument adj modifies it and the final computed matrix is adj^2 H.
If H is missing, the naive.pdf method is used for obtaining the kernel density estimation.
Function funcen
generates, from the original set of data, a collection of pseudodata through an iterative weights allocation process, with two main goals: keep the information from the censored observations represented in the sample and prepare data so they can be used as incoming parameters in the kde
function included in the ks package. A weighted kernel density estimation is therefore finally computed.
There should be at least two uncensored observations for computing the density estimation.
Omitted parameters are considered to be the default ones in the kde
function.
Value
An object of class kde
is returned. It is a list where the most relevant values are:
x |
matrix containing the pseudodata values. It has two columns: marker and time-to-event. |
eval.points |
list of points where the bivariate kernel estimation is calculated. |
estimate |
values of the density estimation. |
H |
bandwidth matrix. |
names |
variable names. |
w |
weights calculated by the function and allocated to pseudodata. |
References
P. Martinez-Camblor and J. C. Pardo-Fernandez. Smooth time-dependent receiver operating characteristic curve estimators. Statistical Methods in Medical Research, 27(3):651-674, 2018. https://doi.org/10.1177/0962280217740786.
T. Duong. Bandwidth matrices for multivariate kernel density estimation. Ph.D. Thesis, University of Western, Australia, 2004. http://www.mvstat.net/tduong.
Examples
library(smoothROCtime)
require(KMsurv)
require(lattice)
data(kidtran)
# Preparing data: a logarithmic transformationof the time-to-event variable is made
DT <- cbind(log(kidtran$time),kidtran$delta,kidtran$age)
n <-length(log(kidtran$time))
# Directly definition of the bandwidth matrix
H <- diag((c(sd(kidtran$age),sd(log(kidtran$time)))*n^(-0.2))^2)
# Kernel density function estimation
density <- funcen(data=DT,H=H)
# Plot graphics
wireframe(density$estimate, row.values=density$eval.points[[1]],
column.values=density$eval.points[[1]],zlab="density")
contour(x=density$eval.points[[1]],
y=density$eval.points[[2]],
z=density$estimate,
ylim=c(6,10))