rlr: Calculating Running Logrank Test

Description Usage Arguments Details Value References Examples

Description

rlr is used to calculate a logrank test for every two groups obtained from dichotomizing a continuous covariate x at a particular point. It will examine all values in x except the first and last ns points.

Usage

1
rlr(times, status, x, ns = 15, trend = "decrease", method = "approximate")

Arguments

times

Survival outcome.

status

Censoring indicator which takes 1 when an event occurs at the end of a study and 0 otherwise.

x

A continuous covariate.

ns

Minimum number of subjects in each group, whether it is the group with x < cutpoint, or the group with x >= cutpoint.

trend

A character that takes either "decrease" or "increase" to represent a positive or negative relationship between the covariate and survival.

method

A character that takes either "approximate" or "exact" where an approximate or exact method will be used to calculate the running logrank test.

Details

When the association is positive, that is, larger covariate values leading to worse survival, and you enter trend = "decrease", the test statistics will be positive, but if you enter trend = "increase" the test statistics will be negative. Opposite is true when the association is negative. You want to make sure to enter the option so that the resulting test statistics are positive.

Value

A matrix of four columns as the following -

xcutoff - All cutpoints that have been used to dichotomize the sample (that is, all values of the covariate x except the first and last ns points)

L - Numerators of the logrank z tests for all cutpoints considered.

V - Denominators of the logrank z tests for all cutpoints considered.

logrank.stat - The logrank z tests for all cutpoints considered.

References

See main package help page.

Examples

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(rolr)

##### -------- Example 1

#simulate survival where hazard increases as covariate increases
d=simdata(nn = 150, hr.linear = 2, hazard.func = "linear", censoring.rate = 0)

#using trend = 'decrease', the test statistics are positive, which is good
res=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='decrease')
head(res)

#do it again with trend = 'increase', now the test statistics are negative.
#So you want to switch to trend='decrease'.
res2=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='increase')
head(res2)

#Note that the test statistics are the same except the signs
res[,'logrank.stat']+res2[,'logrank.stat']

#do it with exact method, how close is it to the approximate method?
res3=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='decrease',
         method="exact")
cor(res[,'logrank.stat'], res3[,'logrank.stat'])

##### -------- Example 2

#Simulate survival where hazard decreases as covariate increases
d=simdata(nn = 150, hr.linear = 1/3, hazard.func = "linear", censoring.rate = 0)

#using trend = 'decrease', and the test statistics are negative, which
#is not good
res=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='decrease')
head(res)

#do it again with trend = 'increase', now the test statistics are positive,
#which is good
res2=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='increase')
head(res2)

#Note that the test statistics are the same except the signs
res[,'logrank.stat']+res2[,'logrank.stat']

#do it with exact method, how close is it to the approximate method?
res3=rlr(times=d$times, status=d$status, x=d$x, ns=15, trend='increase',
         method="exact")
cor(res[,'logrank.stat'], res3[,'logrank.stat'])

rolr documentation built on May 2, 2019, 3:29 p.m.

Related to rlr in rolr...