Learn R Programming

bpcp (version 1.5.1)

bpcp2samp: Melded BPCP test

Description

Tests for dissimilarity between two groups in their survival distributions at a fixed point in time. Can operationalize that dissimilarity as 'difference', 'ratio' or 'oddsratio'.

Usage

bpcp2samp(time, status, group, testtime = NULL, parmtype =
                 c("difference", "oddsratio", "ratio", "efflogs",
                 "effcdf", "cdfratio", "logsratio", "one.minus.ratio",
                 "one.minus.cdfratio"), nullparm = NULL, alternative =
                 c("two.sided", "less", "greater"), conf.level = 0.95,
                 midp = FALSE, changeGroupOrder = FALSE, control =
                 bpcp2sampControl(), add.eps = 1e-10)
    
delta2samp(time,status,group, testtime=NULL,conf.level=0.95,
                       zero.one.adjustment=FALSE,
                       method=c("standard","reg_hybrid","adj_hybrid","sh_adj_hybrid"),
                       parmtype=c("difference","oddsratio","ratio","efflogs","effcdf"),
                       nullparm=NULL,
                       alternative=c("two.sided","less","greater"),
                       changeGroupOrder=FALSE)

Value

The functions return an object of class either "htest" if testtime is NULL, otherwise they will return an object of class "twosamp""

A list with class "htest" contains the following components:

statistic

estimate of S1, survival at testtime for group 1

parameter

estimate of S2, survival at testtime for group 2

p.value

p-value for the test

conf.int

a confidence interval for the parameter determined by parmtype

estimate

estimate of parameter determined by parmtype (see note)

null.value

the specificed null hypothesized value of the parameter determined by parmtype

alternative

type of alternative with respect to the null.value, either 'two.sided', 'greater' or 'less'

method

a character string describing the test

data.name

a character string describing the parameter determined by parmtype

A list with class "twosamp" contains the following components:

L

left endpoint of interval

Lin

logical vector, include left endpoint?

R

right endpoint of interval

Rin

logical vector, include right endpoint?

interval

interval of survival and confidence interval as determined by L, Lin, R, Rin

g1

name of group 1 as determined by group

est_group1

one-sample survival estimate for group 1 in interval/at time point

lower_group1

one-sample lower pointwise confidence limit for group 1 in interval/at time point

upper_group1

one-sample upper pointwise confidence limit for group 1 in interval/at time point

g2

name of group 2 as determined by group

est_group2

one-sample survival estimate for group 2 in interval/at time point

lower_group2

one-sample lower pointwise confidence limit for group 2 in interval/at time point

upper_group2

one-sample upper pointwise confidence limit for group 2 in interval/at time point

beta

estimate of parameter determined by parmtype (see note)

lower

the lower limit of the confidence interval for the parameter determined by parmtype

upper

the upper limit of the confidence interval for the parameter determined by parmtype

conf.level

confidence level

p.value

p-value for the test

null.value

the specificed null hypothesized value of the parameter determined by parmtype

alternative

type of alternative with respect to the null.value, either 'two.sided', 'greater' or 'less'

method

a character string describing the test

Arguments

time

time to event for each observation

status

status of event time, 1 is observed, 0 is right censored

group

group for test, should have two levels, to change order use as factor and change order of levels

testtime

vector of fixed times to test between the two survival distributions, default of NULL will return results for all distinct times in the data

parmtype

parameter type for comparing the survival function of the two groups, either 'difference' 'ratio' 'oddsratio' 'cdfratio' 'effcdf' 'efflogs' 'one.minus.ratio' or 'one.minus.cdfratio' (see details)

nullparm

null value of the parameter of interest, default of NULL gives 0 if parmtype='difference' and 1 otherwise

alternative

character, either 'two.sided','less', or 'greater'

conf.level

confidence level, e.g., 0.95

midp

logical, do mid-p tests and confidence intervals?

changeGroupOrder

logical, change the order of the groups?

control

list of control parameters, see bpcp2sampControl

add.eps

numeric value to add onto censored observations, default is 1e-10

zero.one.adjustment

default=FALSE, if true performs ad hoc modifications to the delta method when Kaplan-Meier estimators are 0 or 1.

method

the delta method for constructing estimates and confidence intervals. `standard` uses the KM estimate and greenwood variance; 'reg_hybrid' uses the KM estimate and Borkowf's regular hybrid variance; 'adj_hybrid' uses the KM estimate and Borkowf's adjusted hybrid variance; and 'sh_adj_hybrid' uses a shrunken KM estimate and Borkowf's adjusted hybrid variance

Author

Michael P. Fay

Details

There are two main functions for two-sample testing, bpcp2samp, which gives melded confidence intervals, and delta2samp, which gives confidence intervals based on the delta method and Borkowf's modifications to it.

The melded confidence interval method is a very general procedure to create confidence intervals for the two sample tests by combining one sample confidence intervals. If S1 and S2 are the survival value at testtime from sample 1 (first value of group) and sample 2 (second value of group) respectively, then we can get confidence intervals on the S2-S1 (parmtype='difference'), S2/S1 (parmtype='ratio'), (S2*(1-S1))/(S1*(1-S2)) (parmtype='oddsratio'), (1-S1))/(1-S2)=F1/F2 (parmtype='cdfratio'), 1-S2/S1 (parmtype='one.minus.ratio'), or 1-(1-S1))/(1-S2)=1-F1/F2(parmtype='one.minus.cdfratio'). Some parmtypes may return estimates that are NA (see note).

The resulting melded CIs appear to guarantee coverage as long as the one sample confidence intervals from which the melded CIs are derived have guaranteed coverage themselves. So since we use the BPCP for the one sample intervals and they appear to guarantee coverage (see Fay, Brittain, and Proschan, 2013), we expect the melded BPCP intervals to have at least nominal coverage. Note that when there is no censoring the melded CIs derived from the one-sample BPCPs, give matching inferences to Fisher's exact test (i.e., give theoretically identical p-values) when testing the null hypothesis of equality (S1=S2). For details see Fay, Proschan and Brittain (2015).

The original melded CIs focused on combining one sample CIs that that guarantee coverage. We can apply the melding to other CIs as well, such as the mid-p style CIs. The mid-p CIs are not designed to guarantee coverage, but are designed to have close to the nominal coverage 'on average' over all the possible values of the parameters. The usual p-value is derived from Pr[ see observed data or more extreme under null], while the mid p-value version comes from (1/2) Pr[see obs data] + Pr[ see more extreme data]. Mid-p CIs come from inverting the test that uses the mid p-value instead of the usual p-value.

The delta methods create confidence intervals for two sample tests by combining one-sample estimates for survival and variance, either using the Greenwood variance (method="standard"), or by substituting the Greenwood variance for ones developed by Borkowf (2005) which have been shown by simulation to be less biased than Greenwood. The zero.one modifications give more reasonable intervals when the Kaplan-Meier estimate of either of the groups is 0 or 1. Unlike the melded BPCP method, we have shown the delta methods to have coverage less than nominal in some situations.

For backwards compatibility we continue to allow the parmtype="one.minus.cdfratio", but it is the same as parmtype="effcdf". Additionally, parmtype="one.minus.ratio" is not an option for delta2samp.

Due to the assumption that censoring occurs after events in cases where there are ties, we have an add.eps option that will add a pseudo-increase to all censored observations for accurate p-values and confidence intervals at a given testtime.

References

Borkowf, C. B. (2005). A simple hybrid variance estimator for the Kaplan-Meier survival function. Statistics in Medicine 24, 827-851.

Fay, MP, Brittain, E, and Proschan, MA. (2013). Pointwise Confidence Intervals for a Survival Distribution with Small Samples or Heavy Censoring. Biostatistics 14(4): 723-736 doi: 10.1093/biostatistics/kxt016. (copy available at http://www.niaid.nih.gov/about/organization/dcr/brb/staff/Pages/michael.aspx).

Fay, MP, Proschan, MA, and Brittain, E (2015) Combining One Sample Confidence Procedures for Inferences in the Two Sample Case. Biometrics 71:146-156.

Examples

Run this code
data(leuk2)
# test difference of S(20) values
# S(20)=survival function at 20 weeks 
bpcp2samp(leuk2$time,leuk2$status,leuk2$treatment,
   20,parmtype="difference")
# test ratio of S(20) in two treatment groups, 
bpcp2samp(leuk2$time,leuk2$status,leuk2$treatment,
   20,parmtype="ratio")
# change the order of the group variable to get the other ratio 
bpcp2samp(leuk2$time,leuk2$status,leuk2$treatment,20,
   parmtype="ratio",changeGroupOrder=TRUE)
# estimate treatment effect= 1 - F(20,trt)/F(20,plac), 
#   where F(20)=1-S(20) = Pr(T <=20) is the 
#   cumulative distribution function 
# Test whether treatment effect is greater than 30 pct
bpcp2samp(leuk2$time,leuk2$status,leuk2$treatment,20,
    parmtype="one.minus.cdfratio",nullparm=0.30,
    alternative="greater",
    changeGroupOrder=FALSE)

# Output estimates and CIs for all intervals within the data
bpcp2samp(leuk2$time,leuk2$status,leuk2$treatment,testtime=NULL)

# Test delta method using Greenwood variance estimator and zero-one adjustment
delta2samp(leuk2$time,leuk2$status,leuk2$treatment,20,method="standard", zero.one.adjustment=TRUE)

Run the code above in your browser using DataLab