biv.rec.np {BivRec}R Documentation

Non-Parametric Analysis of Bivariate Alternating Recurrent Event Gap Time Data

Description

This function allows the user to apply a non-parametric method to estimate the joint cumulative distribution function (cdf) for the two alternating events gap times (xij and yij) as well as the marginal survival function for type I gap times (xij) and the conditional cdf of the type II gap times (yij) given an interval of type I gap times (xij). See Huang and Wang (2005) for more details.

Usage

biv.rec.np(formula, data, CI, ai, u1, u2, conditional, given.interval,
  jointplot, marginalplot, condiplot)

Arguments

formula

A formula with six variables indicating the bivariate alternating gap time response on the left of the ~ operator and a 1 on the right. The six variables on the left must have the same length and be given as ID + episode + xij + yij + delta_x + delta_y ~ 1, where

  • ID: A vector of subjects' unique identifier which can be numeric or character.

  • episode: A vector indicating the episode of the bivariate alternating gap time pairs, e.g.: 1, 2, ..., m_i where m_i indicates the last episode for subject i.

  • xij: A vector with the lengths of the type I gap times.

  • yij: A vector with the lengths of the type II gap times.

  • delta_x: An optional vector of indicators with values:

    • 0 for the last episode for subject i (m_i) if subject was censored during period xij.

    • 1 otherwise.

    A subject with only one episode (m_i = 1) could have a 0 if he was censored during period xi1 or 1 if he was censored during period yi1. If delta_x is not provided estimation proceeds with the assumption that no subject was censored during period xij.

  • delta_y: A vector of indicators with values:

    • 0 for the last episode of subject i (m_i).

    • 1 otherwise.

    A subject with only one episode (m_i = 1) will have one 0.

data

A data frame that includes all the vectors listed in the formula.

CI

The level for confidence intervals for joint cdf plot, marginal plot and conditional cdf. Must be between 0.50 and 0.99, where 0.99 would give 99% CI. Default is 0.95.

ai

A real non-negative function of censoring time. See details.

u1

A vector or single number to be used for estimation of joint cdf P(X0 ≤ u1, Y0 ≤ u2) in the non-parametric method.

u2

A vector or single number to be used for estimation of joint cdf P(X0 ≤ u1, Y0 ≤ u2) in the non-parametric method.

conditional

A logical value. If TRUE, this function will calculate the conditional cdf for the type II gap time given an interval of the type I gap time and the bootstrap standard error and confidence interval at the specified confidence level. Default is FALSE.

given.interval

A vector c(v1, v2) that must be specified if conditional = TRUE. The vector indicates an interval for the type I gap time to use for estimation of the cdf of the type II gap time given this interval. If given.interval = c(v1, v2), the function calculates P(Y0 ≤ y | v1 ≤ X0 ≤ v2). The given values v1 and v2 must be in the range of gap times in the estimated marginal survival. Valid values for these times are given in the "Time" column of the marginal survival data frame that results from biv.rec.np().

jointplot

A logical value. If TRUE (default), this function will create a 3D plot of the joint cdf for the two gap times with pointwise large sample confidence interval at the specified confidence level.

marginalplot

A logical value. If TRUE (default), this function will plot the marginal survival function for the type I gap times with pointwise large sample confidence interval at the specified confidence level.

condiplot

A logical value. Can only be TRUE if conditional=TRUE. If TRUE, this function will plot the conditional cdf with bootstrap confidence interval at the specified confidence level. Default is FALSE.

Details

ai indicates a real non-negative function of censoring times to be used as weights in the non-parametric method. This variable can take on values of 1 or 2 which indicate:

For further information, see Huang and Wang (2005).

Value

Plots as specified from jointplot, marginalplot, conditional and a BivRec list object containing:

References

Huang CY, Wang MC (2005). Nonparametric estimation of the bivariate recurrence time distribution. Biometrics, 61: 392-402. doi.org/10.1111/j.1541-0420.2005.00328.x

Examples

library(BivRec)
# Simulate bivariate alternating recurrent event data
set.seed(1234)
biv.rec.data <- biv.rec.sim(nsize=150, beta1=c(0.5,0.5), beta2=c(0,-0.5), tau_c=63, set=1.1)
# Apply the non-parametric method of Huang and Wang (2005) and
# Visualize joint cdf and marginal survival results
nonpar.result <- biv.rec.np(formula = id + epi + xij + yij + d1 + d2 ~ 1,
          data=biv.rec.data, ai=1, u1 = c(2, 5, 10, 20), u2 = c(1, 5, 10, 15),
          conditional = FALSE, given.interval=c(0, 10), jointplot=TRUE,
          marginalplot = TRUE, condiplot = FALSE)
head(nonpar.result$joint.cdf)
head(nonpar.result$marginal.survival)

## Not run: 
#This is an example with longer runtime.
library(BivRec)
# Simulate bivariate alternating recurrent event data
set.seed(1234)
biv.rec.data <- biv.rec.sim(nsize=150, beta1=c(0.5,0.5), beta2=c(0,-0.5), tau_c=63, set=1.1)

# Apply the non-parametric method of Huang and Wang (2005) and Visualize all results
nonpar.result <- biv.rec.np(formula = id + epi + xij + yij + d1 + d2 ~ 1,
          data=biv.rec.data, ai=1, u1 = c(2, 5, 10, 20), u2 = c(1, 5, 10, 15),
          conditional = TRUE, given.interval=c(0, 10), jointplot=TRUE,
          marginalplot = TRUE, condiplot = TRUE)
head(nonpar.result$joint.cdf)
head(nonpar.result$marginal.survival)
head(nonpar.result$conditional.cdf)

## End(Not run)

[Package BivRec version 1.0.0 Index]