Learn R Programming

EquiSurv (version 0.1.0)

test_nonpar: Non-inferiority and equivalence test for the difference of two Kaplan-Meier curves

Description

Function for fitting and testing two Kaplan Meier curves \(S_1\), \(S_2\) at \(t_0\) concerning the hypotheses of non-inferiority $$H_0:S_1(t_0)-S_2(t_0)\geq \epsilon\ vs.\ H_1: S_1(t_0)-S_2(t_0)< \epsilon$$ or equivalence $$H_0:|S_1(t_0)-S_2(t_0)|\geq \epsilon\ vs.\ H_1: |S_1(t_0)-S_2(t_0)|< \epsilon.$$

Usage

test_nonpar(epsilon, alpha, t0, type, data_r, data_t, plot = TRUE)

Arguments

epsilon

non-inferiority/equivalence margin

alpha

significance level

t0

time point of interest

type

type of the test. "ni" for non-inferiority, "eq" for equivalence test

data_r, data_t

datasets containing time and status for each individual

plot

if TRUE, a plot of the two Kaplan Meier curves will be given

Value

A list containing the difference \(S_1(t_0)-S_2(t_0)\), the lower and upper (1-\(\alpha\))-confidence bounds, the chosen margin and significance level and the test decision. Further a plot of the curves is given.

Examples

Run this code
# NOT RUN {
data(veteran)
veteran_r <- veteran[veteran$trt==1,]
veteran_t <- veteran[veteran$trt==2,]
alpha<-0.05
t0<-80
epsilon<-0.15
test_nonpar(epsilon=epsilon,alpha=alpha,t0=t0,type="eq",data_r=veteran_r,data_t=veteran_t)
# }

Run the code above in your browser using DataLab