# FH.test: Fleming-Harrington weighted log-rank tests In lilywang1988/IAfrac: Tools for weighted log-rank tests

## Description

Calculating the Fleming-Harrington weighted log-rank tests

## Usage

 `1` ```FH.test(survival, delta, trt, rho, gamma) ```

## Arguments

 `survival` Time to event or censoring. `delta` Event indicators. `trt` Treatment assignment indicator with 1 denoting the treated group, and 0 denoting the placebo group. `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^-))^γ.

## Value

A list 3 different components

 `O1` Observed number of weighted events (with a multiplication of corresponding weights) in the treatment arm. `E1 ` Expected number of weighted events (with a multiplication of corresponding weights) in the treatment arm. `Z` Weighted log-rank test statistic.

## Author(s)

Lili Wang

`WLR.test`
 ``` 1 2 3 4 5 6 7 8 9 10 11``` ```# Examples for FH.test and WLR.test set.seed(12345) data_temp<- nphsim(nsim=1,lambdaC=log(2)/6, lambdaE = c(log(2)/6,log(2)/6*0.7), ssC=250, intervals = c(2),ssE=250, gamma=500/14, R=14, eta=1e-5, fixEnrollTime = TRUE)\$simd data_final<-data.trim.d(100,data_temp)[] rho=1 gamma=0 # compare the 3 different ways below: #library(survival) sqrt(survdiff(Surv(survival,delta)~trt, data =data_final,rho=rho)\$chisq) FH.test(survival=data_final\$survival,delta=data_final\$delta,trt=data_final\$trt,rho=rho,gamma=gamma) WLR.test(survival=data_final\$survival,delta=data_final\$delta,trt=data_final\$trt,w=function(...){survKM_minus(...)^rho*(1-survKM_minus(...))^gamma}) ```