Package 'WA'

Title: While-Alive Loss Rate for Recurrent Event in the Presence of Death
Description: Contains inferential and graphical routines for multi-group analysis of while-alive loss (or event) rate for possibly recurrent nonfatal event in the presence of death.
Authors: Lu Mao
Maintainer: Lu Mao <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2025-02-10 03:13:03 UTC
Source: https://github.com/cran/WA

Help Index


A dataset from the HF-ACTION trial

Description

The Heart Failure: A Controlled Trial Investigating Outcomes of Exercise Training (HF-ACTION) study was conducted between 2003–2007 to investigate whether adding exercise training to the usual care of heart failure patients improves their cardiovascular outcomes (O'Conner et al., 2009). This dataset is for a high-risk subgroup consisting of 741 nonischemic patients with baseline cardiopulmonary test duration less than or equal to 12 minutes and analyze recurrent hospitalizations as well as overall survival.

Usage

hfaction_cpx12

Format

A data frame with 2,132 rows and 4 variables:

id

Unique patient ID.

time

Event time (years).

status

Event type; 1 = hospitalization, 2 = death, 0 = censoring.

trt

1 = exercise training, 0 = usual care.

References

O'CONNOR, C. M., WHELLAN, D. J., LEE, K. L., KETEYIAN, S. J., COOPER, L. S., ELLIS, S. J., LEIFER, E. S., KRAUS, W. E., KITZMAN, D. W., BLUMENTHAL, J. A. et al. (2009). Efficacy and safety of exercise training in patients with chronic heart failure: Hf-action randomized controlled trial. J. Am. Med. Assoc. 301, 1439–1450.


Estimate the while-alive loss (event) rate

Description

Estimate and make inference on the while-alive loss (or event) rate across JJ groups under a user-specified loss function

Usage

LRfit(id, time, status, trt, Dweight = 0, wH = NULL, wD = NULL)

Arguments

id

A vector of id variable.

time

A vector of follow-up times.

status

A vector of event type variable; 1 = recurrent event, 2 = death, and 0 = censoring.

trt

A vector of categorical (binary or multiclass) variable for treatment group.

Dweight

A non-negative weight for death relative to the recurrent event; Default is 0.

wH

A function of tt and mm to weight recurrent event; tt: time; mm: existing number of recurrent event; Default is the constant function of 1.

wD

A function of tt and mm to weight death; tt: time; mm: existing number of recurrent event; Default is the constant function of 0.

Value

An object of class LRfit. See LRfit.object for details.

See Also

LRfit.object, summary.LRfit, plot.LRfit.

Examples

# load the HF-ACTION trial data
head(hfaction_cpx12)
# fit the data
dat<-hfaction_cpx12
obj<-LRfit(dat$id,dat$time,dat$status,dat$trt)
# print the event numbers by group
obj
# summarize the inference results for tau=3.5 years
# with joint test with RMST
summary(obj,tau=3.5,joint.test=TRUE)
# plot the estimated survival-completed cumulative loss
# by group, with 95% confidence intervals
plot(obj,conf=TRUE,xlab="Time (years)",xlim=c(0, 3.5),ylim=c(0,3),
    ylab="Survival-completed cumulative frequency")

Estimated while-alive loss rates

Description

This class of objects is returned by the LRfit functions. Objects of this class have methods for the functions print, summary, and plot.

Value

All numerical results of an object obj are contained in obj$content, which is organized in a two-dimensional array with each column containing the results for one group. Below are the row variables.

t

A vector of follow-up times τ\tau.

llr

A vector of log-loss rate estimates at t.

se_llr

A vector of standard error estimates for the log-loss rates in llr.

lmuR

A vector of log-raw cumulative loss estimates at t.

se_lmuR

A vector of standard error estimates for the log-raw cumulative losses in lmuR.

lmuD

A vector of log-RMST estimates at t.

se_lmuD

A vector of standard error estimates for the log-RMST in lmuD.

St

A vector of overall survival probabilities at t.

...

See Also

LRfit, summary.LRfit, plot.LRfit.


Plot the estimated survival-completed cumulative loss curve

Description

Plot the estimated survival-completed cumulative loss (while-alive loss rate times the length of follow-up) as a function of the time horizon.

Usage

## S3 method for class 'LRfit'
plot(
  x,
  group = NULL,
  conf = FALSE,
  main = NULL,
  xlim = NULL,
  ylim = NULL,
  xlab = "Follow-up time",
  ylab = "Survival-completed cumulative loss",
  group.col = NULL,
  conf.lty = 3,
  lwd = 2,
  legend = TRUE,
  ...
)

Arguments

x

An object returned by LRfit.

group

Specifies the group to be plotted.

conf

If TRUE, 95% confidence limits for the target curve are overlaid.

main

A main title for the plot.

xlim

The x limits of the plot.

ylim

The y limits of the plot.

xlab

A label for the x axis, defaults to a description of x.

ylab

A label for the y axis, defaults to a description of y.

group.col

A vector of colors for the group-specific curves; must be commensurate with the number of groups.

conf.lty

Line type for the confidence limits if conf=TRUE.

lwd

Line width.

legend

If TRUE, a crude legend for the group-specific curves will appear on the bottom right corner of the graph.

...

Other arguments that can be passed to the underlying plot method.

Value

No return value, called for side effects.

See Also

LRfit, summary.LRfit.

Examples

# load the HF-ACTION trial data
head(hfaction_cpx12)
# fit the data
dat<-hfaction_cpx12
obj<-LRfit(dat$id,dat$time,dat$status,dat$trt)
# print the event numbers by group
obj
# summarize the inference results for tau=3.5 years
# with joint test with RMST
summary(obj,tau=3.5,joint.test=TRUE)
# plot the estimated survival-completed cumulative loss
# by group, with 95% confidence intervals
plot(obj,conf=TRUE,xlab="Time (years)",xlim=c(0, 3.5),ylim=c(0,3),
    ylab="Survival-completed cumulative frequency")

Print a short summary of LRfit objects

Description

Print the results for the restricted mean times in favor of treatment.

Usage

## S3 method for class 'LRfit'
print(x, ...)

Arguments

x

An object returned by LRfit.

...

Further arguments passed to or from other methods

Value

No return value, called for side effects.


Print method for summary.LRfit objects

Description

Produces a printed summary of the results for the while-alive loss rate

Usage

## S3 method for class 'summary.LRfit'
print(x, ...)

Arguments

x

An object returned by summary.LRfit.

...

Further arguments passed to or from other methods

Value

No return value, called for side effects.


Summary of the analysis results

Description

Summarize the inferential results for group-specific while-alive loss rates and the loss rate ratios at a user-specified length of follow-up.

Usage

## S3 method for class 'LRfit'
summary(object, tau = NULL, ref = NULL, joint.test = FALSE, ...)

Arguments

object

An object returned by LRfit.

tau

A positive real number for the follow-up time; Default is the maximum event time in the data.

ref

The label of the group to be set as the reference; Default is the first level by numerical or alphabetical order

joint.test

If TRUE, joint analysis with the restricted mean survival time (RMST) will be performed; Default is FALSE.

...

Additional arguments affecting the summary produced.

Value

An object of class summary.LRfit with components

LRtab

A (J×4)(J\times 4)-dimensional matrix containing the inference results for the log-loss rate; Columns include Estimate, Std.Err, Z value, and Pr(>|z|).

Rtab

A (J×4)(J\times 4)-dimensional matrix containing the inference results for the log-raw cumulative loss if joint.test=TRUE; Columns include Estimate, Std.Err, Z value, and Pr(>|z|).

Dtab

A (J×4)(J\times 4)-dimensional matrix containing the inference results for the log-RMST if joint.test=TRUE; Columns include Estimate, Std.Err, Z value, and Pr(>|z|).

LRpval

pp-value for the (J1)(J-1)-df chi-square test of group difference in the loss rate.

LRDpval

pp-value for the 2(J1)2(J-1)-df joint chi-square test of group difference in the loss rate and RMST.

...

See Also

LRfit, plot.LRfit.

Examples

#See examples for LRfit().