Description Usage Arguments Details Value Note Author(s) References See Also Examples
LogrankA
provides a logrank test across unlimited groups with the
possibility to input aggregated survival data.
1 |
surv |
An object of type |
group |
Argument |
weight |
The argument |
The group
and weight
arguments must correspond to the entries in
the surv
argument. Therefore the group
and weight
vectors
must be equal in length to the time and status columns in the survival object
of surv
If the weight argument is not specified it is assumed that the input data is not aggregated.
More than a single group must be specified.
p.chi2 |
P-value of chi-squared test of logrank test statistic. |
df |
Degrees of freedom used for chi-squared test. |
LR |
Value of logrank test statistic. |
lr.parameter |
Number of observations, observed events, expected events, (O-E)^2/E for each group. |
In addition a short text summary of the logrank test is printed to the console.
For an in-depth explanation of LogrankA
please see the package vignette.
Jonas Richter-Dumke and Roland Rau
Maintainer: Jonas Richter-Dumke <jrd.r.project@gmail.com>
Peto, R. et al. (1977). "Design and analysis of randomized clinical trials requiring prolonged observation of each patient". II. analysis and examples. In: British journal of cancer 35.1, pp. 1-39.
Ziegler, A., S. Lange, and R. Bender (2007). "Ueberlebenszeitanalyse: Der Log-Rang-Test". In: Deutsche Medizinische Wochenschrift 132, pp. 39-41.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library(survival)
library(MASS)
## data: survival of australian aids patients (individual and aggregated)
aids2.ind <- Aids2 # import australian aids data
aids2.ind$status <- as.numeric(aids2.ind$status) - 1 # recode status to 0/1
stime.days <- aids2.ind$death - aids2.ind$diag # generate survival time in weeks
aids2.ind$stime <- round(stime.days / 7, 0)
aids2.ind$agegr <- cut(aids2.ind$age, # generate age groups
c(0, 20, 40, 60, 100), right = FALSE)
aids2.ind <- aids2.ind[ , c(5, 8, 9)] # keep only important columns
aids2.aggr <- aggregate(aids2.ind$stime, # transform to aggregated data
by = list(aids2.ind$status, aids2.ind$stime,
aids2.ind$agegr),
FUN = length)
colnames(aids2.aggr) <- c("status", "stime", "agegr", "n")
# generate survival objects for individual and aggregated data
surv.ind <- Surv(aids2.ind$stime, aids2.ind$status)
surv.aggr <- Surv(aids2.aggr$stime, aids2.aggr$status)
## logrank test on individual and aggregated data
# logrank on individual data
LogrankA(surv = surv.ind,
group = aids2.ind$agegr)
# logrank on aggregated data
LogrankA(surv = surv.aggr,
group = aids2.aggr$agegr,
weight = aids2.aggr$n)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.