wlogr2: Log-rank statistics

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/wlogr2.R

Description

This will calculate the log-rank and Gehan statistics along with their variances

Usage

1
wlogr2(y, d, z, wty = 1)

Arguments

y

a vector of observed event times

d

a vector of event indicators with 1=event and 0=censored

z

a vector of group indicators with 1=treatment and 0=control

wty

a vector of weight indicators with 1=Gehan and 2=log-rank

Value

wty

Type of statistics, 1=Gehan, 2=log-rank

stat

value of the stat

vstat

estimated variance

tstat

standardized test stat

pstat

2-sided p-value of the standardized test stat

Note

This provides Gehan test that is usually ignored

Author(s)

Xiaodong Luo

References

Gehan E.A. 1965. A generalized Wilcoxon test for comparing arbitrarily single-censored samples. Biometrika, 53, 203-223.

Peto R. and Peto J. 1972. Asymptotically Efficient Rank Invariant Test Procedures. Journal of the Royal Statistical Society, Series A, 135, 185-207.

See Also

winratio,wwratio

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
n<-300
b<-0.2
bc<-1.0
lambda0<-0.1;lambdac0<-0.09
lam<-rep(0,n);lamc<-rep(0,n)
z<-rep(0,n)
z[1:(n/2)]<-1

lam<-lambda0*exp(-b*z)
lamc<-lambdac0*exp(-bc*z)
tem<-matrix(0,ncol=2,nrow=n)

tem[,1]<--log(1-runif(n))/lam
tem[,2]<--log(1-runif(n))/lamc

y<-apply(tem,1,min)
d<-as.numeric(tem[,1]<=y)

i<-1 ##i=1,2
wtest<-wlogr2(y,d,z,wty=i)
wtest

Example output

$wty
[1] 1

$stat
[1] -10.42333

$vstat
[1] 0.0493617

$tstat
[1] -2.708638

$pstat
[1] 0.006756006

WWR documentation built on May 2, 2019, 11:02 a.m.