Learn R Programming

npcure (version 0.1-4)

testmz: Test of Maller-Zhou

Description

This function carries out the nonparametric test of Maller and Zhou (1992).

Usage

testmz(t, d, dataset)

Arguments

t

If dataset is missing, a numeric object giving the the observed times. If dataset is a data frame, it is interpreted as the name of the variable corresponding to the observed times in the data frame.

d

If dataset is missing, an integer object giving the values of the uncensoring indicator. Censored observations must be coded as 0, uncensored ones as 1. If dataset is a data frame, it is interpreted as the name of the variable corresponding to the uncensoring indicator.

dataset

An optional data frame in which the variables named in x, t and d are interpreted. If it is missing, x, t and d must be objects of the workspace.

Value

An object of S3 class 'npcure'. Formally, a list of components:

type

The constant character string c("test", "Maller-Zhou").

pvalue

The p-value of the test.

aux

A list of components: statistic, the test statistic, n the sample size, delta, the difference between the largest observed time \(t_{n}\) and the largest uncensored time \(t_{n}^{\star}\), and interval, a vector giving the range between \(\max(0,t_{n}^{\star}-\texttt{delta})\) and \(t_{n}^{\star}\).

Details

The function implements Maller and Zhou's (1992) method to test the null hypothesis \(H_{0} : \tau_{F_{0}} > \tau_{G}\) vs. \(H_{1} : \tau_{F_{0}} \leq \tau_{G}\), where \(\tau_{F_{0}}\) and \(\tau_{G}\) are the supports of, respectively, the distribution function of the survival time of the uncured and the distribution function of the censoring time.

References

Maller R. A., Zhou S. (1992). Estimating the proportion of immunes in a censored sample. Biometrika, 79: 731-739. https://doi.org/10.1093/biomet/79.4.731.

See Also

latency, probcure

Examples

Run this code
# NOT RUN {
## Some artificial data
set.seed(123)
n <- 50
y <- qweibull(runif(n)*pweibull(2, shape = 2), shape = 2) ## True lifetimes
c <- qexp(runif(n)*pexp(2.5)) ## Censoring values
u <- runif(n)
## Probability of being susceptible is constantly equal to .5
t <- ifelse(u < .5, pmin(y, c), c) ## Observed times
d <- ifelse(u < .5, ifelse(y < c, 1, 0), 0) ## Uncensoring indicator
data <- data.frame(t = t, d = d)

## Maller-Zhou test
testmz(t, d, data)
# }

Run the code above in your browser using DataLab