rmtfit {rmt} | R Documentation |
Estimate restricted mean times in favor of treatment
Description
Estimate and make inference on the overall and component-wise restricted mean times in favor of treatment.
Usage
rmtfit(...)
## Default S3 method:
rmtfit(id, time, status, trt, type = "multistate", ...)
## S3 method for class 'formula'
rmtfit(formula, data, ...)
Arguments
... |
Further arguments. |
id |
A vector of id variable. |
time |
A vector of follow-up times. |
status |
For |
trt |
A vector of binary variable for treatment group. |
type |
|
formula |
A formula object. For multistate data, use |
data |
A data frame, which contains the variables names in the formula. |
Value
An object of class rmtfit
. See rmtfit.object
for details.
Methods (by class)
-
default
: Default -
formula
: Formula
See Also
rmtfit.object
,
summary.rmtfit
, plot.rmtfit
, bouquet
.
Examples
#######################
# Multistate outcome #
#######################
# load the colon cancer trial data
library(rmt)
head(colon_lev)
# fit the data
obj=rmtfit(ms(id,time,status)~rx,data=colon_lev)
# print the event numbers by group
obj
# summarize the inference results for tau=7.5 years
summary(obj,tau=7.5)
############################
# Recurrent event outcome #
############################
# load the HF-ACTION trial data
library(rmt)
head(hfaction)
# fit the data
obj=rmtfit(rec(patid,time,status)~trt_ab,data=hfaction)
# print the event numbers by group
obj
# summarize the inference results for tau=3.5 years
summary(obj,tau=3.5,Kmax=4) # aggregating results for recurrent-event
# frequency >=4.