Package 'SurvivalTests'

Title: Survival Tests for One-Way Layout
Description: Performs survival analysis for one-way layout. The package includes the generalized test for survival ANOVA (Tsui and Weerahandi (1989) <doi:10.2307/2289949> and (Weerahandi, 2004; ISBN:978-0471470175)). It also performs pairwise comparisons and graphical approaches. Moreover, it assesses the weibullness of data in each group via test. The package computes mean and confidence interval under Weibull distribution.
Authors: Osman Dag [aut, cre], Malwane Ananda [aut], Sam Weerahandi [aut]
Maintainer: Osman Dag <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2025-03-04 05:02:51 UTC
Source: https://github.com/cran/SurvivalTests

Help Index


Error Bars with Means and Confidence Limits

Description

plot.Sdescribe produce error bars with means and confidence limits of the given grouped values.

Usage

## S3 method for class 'Sdescribe'
plot(x, ylim = NULL, xlab = NULL, ylab = NULL, title = NULL, width = NULL, ...)

Arguments

x

a Sdescribe object.

ylim

a limit for y axes.

xlab

a label for the x axis.

ylab

a label for the y axis.

title

a main title for the plot.

width

the little lines at the tops and bottoms of the error bars (defaults to 0.80).

...

additional arguments.

Value

No return value, called for side effects

Author(s)

Osman Dag

Examples

library(survival)
lung$status <- ifelse(lung$status == 2, 1, 0)
lung$age <- arules::discretize(lung$age, breaks = 3, labels = c("Low","Medium","High"))


library(SurvivalTests)

out <- Sdescribe(time~age+status, lung)

plot(out, ylim = c(0,500))
plot(out)

Generalized Test for Survival ANOVA

Description

SANOVA performs generalized test for survival ANOVA.

Usage

SANOVA(formula, data, nM = 5000, seed = 123, alpha = 0.05, na.rm = TRUE, verbose = TRUE)

Arguments

formula

a formula of the form lhs ~ rhs where lhs gives the survival times and rhs the corresponding groups + the status variable (1: non-censored, 0: censored).

data

a data frame containing the variables in formula.

nM

a number of bootstrap samples.

seed

a seed number for the reproducibility of results. Default is set to 123.

alpha

the level of significance to assess the statistical difference. Default is set to alpha = 0.05.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

verbose

a logical for printing output to R console.

Details

SANOVA performs parametric survival ANOVA when the underlying data are distributed as Weibull or Gumbel. SANOVA tests are based on generalized p-value approach (cf. Tsui and Weerahandi (1989) and Weerahandi (2004)) extended for situations of affine invariance.

Value

A list with class "survtests" containing the following components:

p.value

the p-value of the test.

alpha

the level of significance to assess the statistical difference.

method

the character string "Generalized Test for Survival ANOVA".

data

a data frame containing the variables in which NA values (if exist) are removed.

formula

a formula of the form lhs ~ rhs where lhs gives the sample values and rhs the corresponding groups + the status variable (1: non-censored, 0: censored).

seed

a seed number for the reproducibility of results.

Author(s)

Sam Weerahandi, Malwane Ananda, Osman Dag

References

Tsui K. and Weerahandi, S. (1989). Generalized P-values in Significance Testing of Hypotheses in the Presence of Nuisance Parameters. Journal of the American Statistical Association, 84, 602-607.

Weerahandi, S. (2004). Generalized Inference in Repeated Measures: Exact Methods in MANOVA and Mixed Models, Wiley.

Examples

library(survival)
lung$status <- ifelse(lung$status == 2, 1, 0)
lung$age <- arules::discretize(lung$age, breaks = 3, labels = c("Low","Medium","High"))

library(SurvivalTests)

SANOVA(time~age+status, lung, alpha = 0.05)

Descriptive Statistics

Description

Sdescribe produces number of observations (n), number of events (nE), and the mean survival with confidence limits for the mean.

Usage

Sdescribe(formula, data, level = 0.95, nM = 5000, na.rm = TRUE, 
	  verbose = TRUE)

Arguments

formula

a formula of the form lhs ~ rhs where lhs gives the survival times and rhs the corresponding groups + the status variable (1: non-censored, 0: censored).

data

a data frame containing the variables in formula.

level

the confidence level.

nM

a number of bootstrap samples.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

verbose

a logical for printing output to R console.

Value

Returns a data.frame of output with class "Sdescribe".

Author(s)

Malwane Ananda, Osman Dag

Examples

library(survival)
lung$status <- ifelse(lung$status == 2, 1, 0)
lung$age <- arules::discretize(lung$age, breaks = 3, labels = c("Low","Medium","High"))

library(SurvivalTests)

Sdescribe(time~age+status, lung)

Pairwise Comparisons of Survival Tests for One-Way Layout

Description

Spaircomp is a generic function for pairwise comparisons of survival tests in one-way layout by adjusting p-values.

Usage

## S3 method for class 'survtests'
Spaircomp(x, adjust.method = c("bonferroni", "holm", "hochberg", "hommel", "BH", 
  "BY", "fdr", "none"), verbose = TRUE, ...)

Arguments

x

a survtests object.

adjust.method

Method for adjusting p values (see p.adjust). Default is set to "bonferroni".

verbose

a logical for printing output to R console.

...

Additional arguments affecting multiple comparisons of groups in one-way independent designs.

Value

Returns a data.frame of output.

Author(s)

Osman Dag

Examples

library(survival)
lung$status <- ifelse(lung$status == 2, 1, 0)
lung$age <- arules::discretize(lung$age, breaks = 3, labels = c("Low","Medium","High"))

library(SurvivalTests)

out = SANOVA(time~age+status, lung, alpha = 0.05)

Spaircomp(out, adjust.method = "bonferroni")


# to illustrate pairwise comparison, alpha is set to 0.5
out2 = SANOVA(time~age+status, lung, alpha = 0.5)

Spaircomp(out2, adjust.method = "bonferroni")

Spaircomp(out2, adjust.method = "hochberg")

Spaircomp(out2, adjust.method = "hommel")

Spaircomp(out2, adjust.method = "holm")

Weibullness Test

Description

weibull.test performs weibullness test from weibull plot in each group.

Usage

weibull.test(formula, data, alpha = 0.05, na.rm = TRUE, verbose = TRUE)

Arguments

formula

a formula of the form lhs ~ rhs where lhs gives the survival times and rhs the corresponding groups.

data

a tibble or data frame containing the variables in formula.

alpha

the level of significance to assess normality. Default is set to alpha = 0.05.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

verbose

a logical for printing output to R console.

Value

A data frame gives the test results for the weibullness of groups.

Author(s)

Osman Dag

See Also

wp.test

Examples

library(survival)
lung$status <- ifelse(lung$status == 2, 1, 0)
lung$age <- arules::discretize(lung$age, breaks = 3, labels = c("Low","Medium","High"))

library(SurvivalTests)

weibull.test(time~age, lung)