Learn R Programming

SIMMS (version 1.3.2)

get.chisq.stats: Applies survdiff function

Description

Applies survdiff on different prognoses groups and computes Logrank P using chisquare statistics.

Usage

get.chisq.stats(groups, survobj)

Arguments

groups

Grouping of patients (passed directly to survdiff, so factors & continuous variables are okay)

survobj

An object of class Surv (from the survival package) -- patient ordering needs to be identical as for groups

Value

A vector containing: Chisq, degrees of freedom (DOF) and Logrank P-value.

Examples

Run this code
# NOT RUN {
survtime <- sample(seq(0.1,10,0.1), 100, replace = TRUE);
survstat <- sample(c(0,1), 100, replace = TRUE);
survobj <- Surv(survtime, survstat);
groups <- sample(c('A','B'), 100, replace = TRUE);
get.chisq.stats(
  groups = as.factor(groups),
  survobj = survobj
  );

# }

Run the code above in your browser using DataLab