FH.frac.cal: Information fraction for Fleming-Harrington weighted log-rank...

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

View source: R/Hasegawa2016.R

Description

Monitor the raction for Fleming-Harrington weighted log-rank test for a vector of time points

Usage

1
FH.frac.cal(data, t_vec, I_max, rho, gamma, trimmed)

Arguments

data

There are two possible structures allowed for this input data. The first type needs to have trimmed=F and include variables: a treatment variable with "experimental" denoting treatment group, cnsr variable with value 1 denoting censoring, ct variable denoting event time from the origin of the study, which equals the sum of entering time enterT and the survival time (time to event or censoring). A dataset simulated from from R package nphsim should fit the first type well enough (see the example1). The second type can be any data.frame or data.table output from a data.trim function, including variables: ct denoting event time from the origin of the study or the sum of entering time and the survival time, survival denoting the survival time or time to event/censoring, delta as an event indicator, enterT as entering time (example 2). For the second type, we set trimmed=T to avoid extra computations, but should be fine if trimmed=F.

t_vec

Follow-up time since the origin of the study (not that it's not following the survival time scale, but following the calendar time scale ), which could be a vector, to measure the information fraction for these time points.

I_max

The evaluated I_{max}, which returned from function I.1 or I.0 by setting the t.start=tau, where tau is the end of the study.

rho

First power parameter for the Fleming-Harrington weight which weighs on the early departures: S(t^-)^ρ(1-S(t^-))^γ.

gamma

Second power parameter for the Fleming-Harrington weight which weighs on the late departures: S(t^-)^ρ(1-S(t^-))^γ.

trimmed

Logical indicator to show whether the data input has been "trimmed" by data.trim and data.trim.d before: adding variables like delta indicating events (=1), and trt distringuishing the treatment group (=1) from the control group (=0)

Details

Calculation the information fraction for Fleming-Harrington family weighted log-rank tests using the monitored estimated information for numerator, and the predicted information I_{max} as denominator.

Value

This function returns a vector of information fractions corresponding to the input time vector t_vec.

Author(s)

Lili Wang

References

Hasegawa, T. (2016). Group sequential monitoring based on the weighted log‐rank test statistic with the Fleming–Harrington class of weights in cancer vaccine studies. Pharmaceutical statistics, 15(5), 412-419.

See Also

data.trim

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
# install.packages("devtools")
# library(devtools)
# install_github("keaven/nphsim")
library(nphsim)
eps<-2 # delayed effect
p<-0.5 #treatment assignment
b<-30 # an intrinsic parameter to decide the number of intervals per time unit
tau<- 18 # end of the study
R<-14 # accrual period [0,R]
omega<- tau-R
lambda<-log(2)/6 # control group risk hazard
theta<-0.7 # hazard ratio
lambda.trt<- lambda*theta #hazard after the change point for the treatment arm
rho<- 0 # parameter for the weights
gamma<-1 #parameter for the weights
alpha<-0.025 #type 1 error
beta<-0.1 #type 2 error
# First we decide the sample size:
size_FH <- sample.size_FH(eps,p,b,tau,omega,lambda,lambda.trt,rho, gamma,alpha,beta)
n_FH <-size_FH$n
n_event_FH<-size_FH$n_event
accrual.rt<-n_FH/R # the needed arrual rate
#Generate data accordingly, use eta=1e-5 to inhibit censoring
data_temp <- nphsim(nsim=1,lambdaC=lambda, lambdaE = c(lambda,lambda.trt),
                  ssC=ceiling(n_FH*(1-p)),intervals = c(eps),ssE=ceiling(n_FH*p),
                                   gamma=accrual.rt, R=R, eta=1e-5, fixEnrollTime = TRUE)$simd

# Example 1 for FH.frac.cal: Set trimmed=F and work on the crude dataset from nphsim()
inf_frac_vec1<-FH.frac.cal(data_temp,c(10,15,18),I_denom,rho,gamma,trimmed=F)
inf_frac_vec1

# Example 2 for FH.frac.cal: First trim the data before inputting into FH.frac.cal() setting trimmed=T, and obtain the whole spectrum.
I_denom<-I.1(rho, gamma,lambda,theta,eps,R,p,t.star=tau)*n_FH
tau.star=21 #in case the ratio=1 when t>tau
#Trim the data
data_temp2 <-data.trim(tau.star,data_temp)
t_seq <- seq(0.1,tau.star,0.1) # the time series to check the information fraction
inf_frac_vec2<-FH.frac.cal(data_temp2,t_seq,I_denom,rho,gamma,trimmed=T)
# WLRT at the interim
interim_index<- which.min(abs(inf_frac_vec2-0.6))
interim_time<-t_seq[interim_index]
interim_frac<-inf_frac_vec2[interim_index]
 # WLRT at the final
 final_index<- which.min(abs(inf_frac_vec2-1))
 final_time<-t_seq[final_index]
 final_frac<-inf_frac_vec2[final_index]

lilywang1988/IAfrac documentation built on March 11, 2021, 11:53 a.m.