Learn R Programming

npsurv (version 0.3-3)

npsurv: Nonparametric Survival Function Estimation

Description

npsurv computes the nonparametric maximum likelihood esimate (NPMLE) of a survival function for general interval-censored data.

Usage

npsurv(data, w=1, maxit=100, tol=1e-6, verb=0)

Arguments

data
vector or matrix, or an object of class icendata.
w
weights or multiplicities of the observations.
maxit
maximum number of iterations.
tol
tolerance level for stopping the algorithm. It is used as the threshold on the increase of the log-likelihood after each iteration.
verb
verbosity level for printing intermediate results at each iteration.

Value

  • An object of class npsurv, which is a list consisting of:
  • fNPMLE, an object of class idf.
  • upperlargest finite value in the data.
  • convergence= TRUE, converged successfully;

    = FALSE, maximum number of iterations reached.

  • lllog-likelihood value of the NPMLE f.
  • maxgradmaximum gradient value of the NPMLE f.
  • numiternumber of iterations used.

Details

If data is a vector, it contains only exact observations, with weights given in w.

If data is a matrix with two columns, it contains interval-censored observations, with the two columns storing their left and right end-points, respectively. If the left and right end-points are equal, then the observation is exact. Weights are provided by w.

If data is a matrix with three columns, it contains interval-censored observations, with the first two columns storing their left and right end-points, respectively. The weight of each observation is the third-column value multiplied by the corresponding weight value in w.

The algorithm used for the computing the NPMLE is the constrained Newton method (CNM) that is proposed by Wang (2008).

Inside the function, it detects if data has only right censoring, and if so, the Kaplan-Meier estimate is computed directly by function km.

References

Wang, Y. (2008). Dimension-reduced nonparametric maximum likelihood computation for interval-censored data. Computational Statistics & Data Analysis, 52, 2388-2402.

See Also

icendata, Deltamatrix, idf, km.

Examples

Run this code
## all exact observations
data(acfail)
plot(npsurv(acfail))

## right-censored (and exact) observations
data(gastric)
plot(npsurv(gastric))

data(leukemia)
i = leukemia[,"group"] == "Placebo"
plot(npsurv(leukemia[i,1:2]), xlim=c(0,40), col="blue") # placebo
plot(npsurv(leukemia[!i,1:2]), add=TRUE, col="red")     # 6-MP

## purely interval-censored data
data(ap)
plot(npsurv(ap))

data(cancer)
cancerRT = with(cancer, cancer[group=="RT",1:2])
plot(npsurv(cancerRT), xlim=c(0,60))                  # survival of RT 
cancerRCT = with(cancer, cancer[group=="RCT",1:2])
plot(npsurv(cancerRCT), add=TRUE, col="green")        # survival of RCT

Run the code above in your browser using DataLab