Skip to contents

The survival function is obtained through the EM algorithm described in Turnbull (1976); censoring and truncation are assumed to be non-informative. The survival function changes only at the J distinct exceedances \(y_i-u\) and truncation points.

Usage

np_elife(
  time,
  time2 = NULL,
  event = NULL,
  type = c("right", "left", "interval", "interval2"),
  thresh = 0,
  ltrunc = NULL,
  rtrunc = NULL,
  tol = 1e-12,
  weights = NULL,
  method = c("em", "sqp"),
  arguments = NULL,
  maxiter = 100000L,
  ...
)

Arguments

time

excess time of the event of follow-up time, depending on the value of event

time2

ending excess time of the interval for interval censored data only.

event

status indicator, normally 0=alive, 1=dead. Other choices are TRUE/FALSE (TRUE for death). For interval censored data, the status indicator is 0=right censored, 1=event at time, 2=left censored, 3=interval censored. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have experienced an event.

type

character string specifying the type of censoring. Possible values are "right", "left", "interval", "interval2".

thresh

double thresh

ltrunc

lower truncation limit, default to NULL

rtrunc

upper truncation limit, default to NULL

tol

double, relative tolerance for convergence of the EM algorithm

weights

double, vector of weights for the observations

method

string, one of "em" for expectation-maximization (EM) algorithm or "sqp" for sequential quadratic programming with augmented Lagrange multiplie method.

arguments

a named list specifying default arguments of the function that are common to all elife calls

maxiter

integer, maximum number of iterations for the EM algorithm

...

additional arguments, currently ignored

Value

a list with elements

  • cdf: right-continuous stepfun object defined by probabilities

  • time: matrix of unique values for the Turnbull intervals defining equivalence classes; only those with non-zero probabilities are returned

  • prob: J vector of non-zero probabilities

  • niter: number of iterations

Details

The unknown parameters of the model are \(p_j (j=1, \ldots, J)\) subject to the constraint that \(\sum_{j=1}^J p_j=1\).

References

Turnbull, B. W. (1976). The Empirical Distribution Function with Arbitrarily Grouped, Censored and Truncated Data. Journal of the Royal Statistical Society. Series B (Methodological) 38(3), 290–295.

Gentleman, R. and C. J. Geyer (1994). Maximum likelihood for interval censored data: Consistency and computation, Biometrika, 81(3), 618–623.

Frydman, H. (1994). A Note on Nonparametric Estimation of the Distribution Function from Interval-Censored and Truncated Observations, Journal of the Royal Statistical Society. Series B (Methodological) 56(1), 71-74.

Examples

set.seed(2021)
n <- 20L
# Create fake data
ltrunc <- pmax(0, runif(n, -0.5, 1))
rtrunc <- runif(n, 6, 10)
dat <- samp_elife(n = n,
                  scale = 1,
                  shape = -0.1,
                  lower = ltrunc,
                  upper = rtrunc,
                  family = "gp",
                  type2 = "ltrt")
npi <- np_elife(time = dat,
                rtrunc = rtrunc,
                ltrunc = ltrunc)
print(npi)
#> Nonparametric maximum likelihood estimator
#> 
#> Routine converged 
#> Number of equivalence classes: 20 
#> Mean:  0.6303924 
#> Quartiles of the survival function: 0.8432573 0.2835524 0.01681107
summary(npi)
#>       Min.    1st Qu.     Median       Mean    3rd Qu.       Max. 
#> 0.01681107 0.01681107 0.28355239 0.63039239 0.84325728 2.75769053 
plot(npi)