np_elife {longevity} | R Documentation |
Nonparametric estimation of the survival function
Description
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 |
type |
character string specifying the type of censoring. Possible values are " |
thresh |
double thresh |
ltrunc |
lower truncation limit, default to |
rtrunc |
upper truncation limit, default to |
tol |
double, relative tolerance for convergence of the EM algorithm |
weights |
double, vector of weights for the observations |
method |
string, one of |
arguments |
a named list specifying default arguments of the function that are common to all |
maxiter |
integer, maximum number of iterations for the EM algorithm |
... |
additional arguments, currently ignored |
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
.
Value
a list with elements
-
cdf
: right-continuousstepfun
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
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)
summary(npi)
plot(npi)