DTDAcif: Doubly Truncated Data Analysis, Cumulative Incidence...

Description Usage Arguments Details Value Acknowledgements Author(s) References Examples

View source: R/DTDAcif.R

Description

This function computes a nonparametric estimator of the cumulative incidences of competing risks under double truncation. The estimator generalizes the Efron-Petrosian NPMLE (Non-Parametric Maximun Likelihood Estimator) to the competing risks setting.

Usage

1
2
DTDAcif(x, u, v, comp.event, method = c("indep", "dep"), boot = F,
  B = 300, N.iter = 100, error = 1e-06)

Arguments

x

Numeric vector corresponding to the variable of ultimate interest.

u

Numeric vector corresponding to the left truncation variable.

v

Numeric vector corresponding to the right truncation variable.

comp.event

Competing risk indicator.

method

The method used to compute the nonparametric estimator. Use ‘indep’ for independent truncation variables and “dep“ for truncation variables possibly depending on the competing risk.

boot

Logical. If TRUE the bootstrap standard deviation of the cumulative incidences is calculated.

B

Number of bootstrap replicates.

N.iter

Maximum number of iterations.

error

Error criterion for convergence.

Details

The nonparametric estimator is based on the Efron-Petrosian NPMLE (Efron and Petrosian, 1999). Actually, each pair (Xi,Zi) -where Xi stands for the variable of interest and Zi is the competing event indicator- is weighted by the jump of the Efron-Petrosian NPMLE at Xi (method=“indep"), or by a normalized version of the Efron-Petrosian NPMLE computed from the subset of (Xs,Zs)'s such that Zs=Zi (method=“dep”). The former is suitable when the truncating couple (U,V) is independent of (X,Z), while the latter is recommended when (U,V) and X are only conditionally independent given Z; see de Uña-Álvarez (2019) for a full description of the estimators and of their properties. When the competing event indicator is missing, the function simply computes the Efron-Petrosian NPMLE and the argument method has no role.

Value

A list containing:

Acknowledgements

Author(s)

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
set.seed(1234)
n <- 50  # sample size

x <- runif(n, 0, 1)  # time variable of interest
z <- rbinom(n, 1, 1 / 4)   # competing event indicator

# truncation variables

u <- runif(n, -.25, .5)  # left truncation variable
v <- u + .75   # right truncation variable

# note: (u,v) is independent of (x,z) so both estimation methods are consistent

# truncating the sample:

for (i in 1:n) {
  while (u[i] > x[i] | v[i] < x[i]) {
    x[i] <- runif(1, 0, 1)
    z[i] <- rbinom(1, 1, 1 / 4)
    u[i] <- runif(1, -.25, .5)
    v[i] <- u[i] + .75
  }
}

# note: (u,v) since is independent of (x,z)
# both estimation methods are consistent:

res.i <- DTDAcif(x, u, v, z, method = "indep", boot = TRUE)
res.d <- DTDAcif(x, u, v, z, method = "dep", boot = TRUE)

oldpar <- par(mfrow=c(1,2))
plot(res.i, main = "Indep trunc", intervals = TRUE)
plot(res.d, main = "Cond indep trunc", intervals = TRUE)

summary(res.i)
summary(res.d)

plot(res.i$data$x, res.i$biasf, type = "s")  # the observational bias
# the observational bias, event 1
plot(res.d$data$x[res.d$data$z == 1], res.d$biasf$biasf_1, type = "s")
# the observational bias, event 2
lines(res.d$data$x[res.d$data$z == 2], res.d$biasf$biasf_2, type = "s", col = 2)
par(oldpar)

DTDA.cif documentation built on Feb. 13, 2020, 5:07 p.m.