Learn R Programming

ANSM5 (version 1.1.1)

logrank: Perform logrank test

Description

logrank() performs the logrank test and is used in chapter 9 of "Applied Nonparametric Statistical Methods" (5th edition)

Usage

logrank(
  x,
  censored,
  groups,
  score.censored = TRUE,
  max.exact.perms = 1e+05,
  nsims.mc = 10000,
  seed = NULL
)

Value

An ANSMtest object with the results from applying the function

Arguments

x

Numeric vector of same length as censored, groups

censored

Binary vector of same length as x, groups

groups

Factor of same length as x, censored

score.censored

Boolean indicating whether or not to score censored values (defaults to TRUE)

max.exact.perms

Maximum number of permutations allowed for exact calculations (defaults to 100000)

nsims.mc

Number of Monte Carlo simulations to be performed (defaults to 10000)

seed

Random number seed to be used for Monte Carlo simulations (defaults to NULL)

Examples

Run this code
# Example 9.6 from "Applied Nonparametric Statistical Methods" (5th edition)
logrank(ch9$samplesAB.survtime, ch9$samplesAB.censor, ch9$samplesAB, score.censored = FALSE)

# Exercise 9.7 from "Applied Nonparametric Statistical Methods" (5th edition)
logrank(ch9$samplesXYZ.survtime, ch9$samplesXYZ.censor, ch9$samplesXYZ)

Run the code above in your browser using DataLab