testmz: Test of Maller-Zhou

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/tests.R

Description

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

Usage

1
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.

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 <= 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.

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^*, and interval, a vector giving the range between max(0, t_n^* - delta) and t_n^*.

Author(s)

Ignacio López-de-Ullibarri [aut, cre], Ana López-Cheda [aut], Maria Amalia Jácome [aut]

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

npcure documentation built on March 26, 2020, 7:51 p.m.