Package 'MultSurvTests'

Title: Permutation Tests for Multivariate Survival Analysis
Description: Multivariate version of the two-sample Gehan and logrank tests, as described in L.J Wei & J.M Lachin (1984) and Persson et al. (2019).
Authors: Lukas Arnroth, Mans Thulin
Maintainer: Lukas Arnroth <[email protected]>
License: MIT + file LICENSE
Version: 0.2
Built: 2025-03-06 04:03:00 UTC
Source: https://github.com/lukketotte/multsurvtests

Help Index


Permutation Tests for Multivariate Survival Analysis

Description

Multivariate version of the two-sample Gehan and logrank tests, as described in L.J Wei & J.M Lachin (1984) and Persson et al. (2019).

Details

The DESCRIPTION file:

Package: MultSurvTests
Title: Permutation Tests for Multivariate Survival Analysis
Version: 0.2
Author: Lukas Arnroth, Mans Thulin
Maintainer: Lukas Arnroth <[email protected]>
Description: Multivariate version of the two-sample Gehan and logrank tests, as described in L.J Wei & J.M Lachin (1984) and Persson et al. (2019).
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
Imports: Rcpp (>= 0.12.9), Rdpack
LinkingTo: Rcpp, RcppArmadillo
RdMacros: Rdpack
URL: https://github.com/lukketotte/MultSurvTests
BugReports: https://github.com/lukketotte/MultSurvTests/issues
Depends: R (>= 2.10)
License: MIT + file LICENSE
Repository: https://lukketotte.r-universe.dev
RemoteUrl: https://github.com/lukketotte/multsurvtests
RemoteRef: HEAD
RemoteSha: 542231ee020d1c8d464cd658a32e263352174e94

Index of help topics:

MultSurvTests-package   Permutation Tests for Multivariate Survival
                        Analysis
choose_B                Choose B for permutation tests
diabetes                Diabetes Data
gehan                   Gehan test
mvlogrank               Mvlogrank test
perm_gehan              Multivariate permutation Gehan test
perm_mvlogrank          Multivariate permutation logrank test
wltestdata              Data randomly generated.

Author(s)

Lukas Arnroth, Mans Thulin

Maintainer: Lukas Arnroth <[email protected]>

References

L.J. Wei & J.M. Lachin, Two-Sample Asymptotically Distribution-Free Tests for Incomplete Multivariate Observations, 1984, Journal of the American Statistical Association, Vol. 79, No.387

I. Persson, L. Arnroth & M. Thulin, Multivariate two‐sample permutation tests for trials with multiple time‐to‐event outcomes, 2019, Pharmaceutical statistics, Vol. 18, No.4, pp. 476-485

See Also

https://github.com/lukketotte/MultSurvTests

Examples

# Diabetes data:
?diabetes

# Survival times for the two groups:
x <- as.matrix(subset(diabetes, LASER==1)[c(6,8)])
y <- as.matrix(subset(diabetes, LASER==2)[c(6,8)])

# Censoring status for the two groups:
delta.x <- as.matrix(subset(diabetes, LASER==1)[c(7,9)])
delta.y <- as.matrix(subset(diabetes, LASER==2)[c(7,9)])

# Create the input for the test:
z <- rbind(x, y)
delta.z <- rbind(delta.x, delta.y)

# Run the tests with 99 permutations:
perm_gehan(B = 99, z, delta.z, n1 = nrow(x))
perm_mvlogrank(B = 99, z, delta.z, n1 = nrow(x))

Choose B for permutation tests

Description

Computes the value of B for a permutation test required to obtain a specified accuracy when approximating the permutation p-values using B random permutations.

Usage

choose_B(p0 = 0.05, width = 0.01, conf.level = 0.95)

Arguments

p0

A guess for the p-value. Can be based e.g. on a small number of simulations. The default is 0.05.

width

The desired width of the Clopper-Pearson interval. The default is 0.01.

conf.level

The confidence level of the Clopper-Pearson interval. The default is 0.95.

Details

Computations are based on the Clopper-Pearson interval, using a formula from Thulin (2014). The procedure is described in Section 3.3 in Persson et al. (2019).

Value

B

References

Persson I, Arnroth L, Thulin M (2019). “Multivariate two sample permutation tests for trials with multiple time to event outcomes.” Pharmaceutical Statistics, 18, 476-485.

Thulin M (2014). “The cost of using exact confidence intervals for a binomial proportion.” Electronic Journal of Statistics, 8(1), 817-840.

Examples

# B required to achieve an expected width of 0.02 when
# the p-value is approximately 0.1:
choose_B(p0 = 0.1, width = 0.02)

Diabetes Data

Description

Diabetic retinopathy: how strongly are times to blindness of a treated and an untreated eye correlated in patients suffering from diabetic retinopathy? The analysis is based on a sample of n=197 paired failure times (censoring 73% and 49% for the treated and untreated eyes, respectively) described by Huster, Brookmeyer, and Self (1989). Both eyes of an individual are observed for the same time, and therefore dots on the diagonal generally indicate pairs of censored times.

Usage

diabetes

Format

A data.frame containing 197 rows.

Source

https://www.mayo.edu/research/documents/diabeteshtml/DOC-10027460

References

Huster WJ, Brookmeyer R, Self SG. Modelling paired survival data with covariates. Biometrics 1989; 45:145-156.


Gehan test

Description

Computes the multivariate Gehan test statistic.

Usage

gehan(x, y, delta_x, delta_y, n1, n2, p, k = 1L, l = 1L)

Arguments

x

Matrix

y

Matrix

delta_x

Matrix

delta_y

Matrix

n1

Integer. Set as the number of rows in x

n2

Integer. Set as the number of rows in y

p

Integer. Set as the number of columns in x and y

k

Integer. Use the default value.

l

Integer. Use the default value.

Value

1x1 matrix containing a numeric


Mvlogrank test

Description

Computes the multivariate logrank test statistic.

Usage

mvlogrank(x, y, delta_x, delta_y, n1, n2, p, k = 1L, l = 1L)

Arguments

x

Matrix

y

Matrix

delta_x

Matrix

delta_y

Matrix

n1

Integer. Set as the number of rows in x

n2

Integer. Set as the number of rows in y

p

Integer. Set as the number of columns in x and y

k

Integer. Use the default value.

l

Integer. Use the default value.

Value

1x1 matrix containing a numeric


Multivariate permutation Gehan test

Description

Computes the p-value of the multivariate permutation Gehan test described in Persson et al. (2019).

Usage

perm_gehan(B = 999, z, delta.z, n1)

Arguments

B

An integer specifying the number of permutations to perform. The default is 999. It is recommended to use choose_B for choosing B.

z

A matrix containing the observed (possibly censored) survival times for the two groups. The observations for the first group should be one the first n1 rows.

delta.z

A matrix containing the censoring status of each observation in z.

n1

An integer specifying the sample size of the first group.

Details

Multivariate version of the logrank and Gehan tests were described by Wei & Lachin (1984). Persson et al. (2019) described permutation versions of these tests, with improved performance.

Value

A p-value.

References

Persson I, Arnroth L, Thulin M (2019). “Multivariate two sample permutation tests for trials with multiple time to event outcomes.” Pharmaceutical Statistics, 18, 476-485.

Wei LJ, Lachin JM (1984). “Two sample asymptotically distribution free tests for incomplete multivariate observations.” Journal of the American Statistical Association, 79(387), 653-661.

Examples

# Diabetes data:
?diabetes
# Survival times for the two groups:
x <- as.matrix(subset(diabetes, LASER==1)[c(6,8)])
y <- as.matrix(subset(diabetes, LASER==2)[c(6,8)])
# Censoring status for the two groups:
delta.x <- as.matrix(subset(diabetes, LASER==1)[c(7,9)])
delta.y <- as.matrix(subset(diabetes, LASER==2)[c(7,9)])
# Create the input for the test:
z <- rbind(x, y)
delta.z <- rbind(delta.x, delta.y)
# Run the test with 50 permutations:
perm_gehan(B = 50, z, delta.z, n1 = nrow(x))
# In most cases, it is preferable to use more than 50
# permutations for computing p-values. choose_B() can
# be used to determine how many permutations are needed.

Multivariate permutation logrank test

Description

Computes the p-value of the multivariate permutation logrank test described in Persson et al. (2019).

Usage

perm_mvlogrank(B, z, delta.z, n1)

Arguments

B

An integer specifying the number of permutations to perform. The default is 999. It is recommended to use choose_B for choosing B.

z

A matrix containing the observed (possibly censored) survival times for the two groups. The observations for the first group should be one the first n1 rows.

delta.z

A matrix containing the censoring status of each observation in z.

n1

An integer specifying the sample size of the first group.

Details

Multivariate version of the logrank and Gehan tests were described by Wei & Lachin (1984). Persson et al. (2019) described permutation versions of these tests, with improved performance.

Value

A p-value.

References

Persson I, Arnroth L, Thulin M (2019). “Multivariate two sample permutation tests for trials with multiple time to event outcomes.” Pharmaceutical Statistics, 18, 476-485.

Wei LJ, Lachin JM (1984). “Two sample asymptotically distribution free tests for incomplete multivariate observations.” Journal of the American Statistical Association, 79(387), 653-661.

Examples

# Diabetes data:
?diabetes
# Survival times for the two groups:
x <- as.matrix(subset(diabetes, LASER==1)[c(6,8)])
y <- as.matrix(subset(diabetes, LASER==2)[c(6,8)])
# Censoring status for the two groups:
delta.x <- as.matrix(subset(diabetes, LASER==1)[c(7,9)])
delta.y <- as.matrix(subset(diabetes, LASER==2)[c(7,9)])
# Create the input for the test:
z <- rbind(x, y)
delta.z <- rbind(delta.x, delta.y)
# Run the test with 50 permutations:
perm_mvlogrank(B = 50, z, delta.z, n1 = nrow(x))
# In most cases, it is preferable to use more than 50
# permutations for computing p-values. choose_B() can
# be used to determine how many permutations are needed.

Data randomly generated.

Description

Data randomly generated.

Usage

wltestdata

Format

A dataframe containing 47 rows and 9 columns

V1:V9

Randomly generated integers