Learn R Programming

compeir (version 1.0)

irates: Competing events incidence rates

Description

This function computes event-specific incidence rates (a.k.a incidence densities) for competing risks data together with corresponding variances and confidence intervals. Incidence rates can be computed for separate covariate values of one binary or categorical covariate.

Usage

irates(data, time.code = NULL, no.event.code = NULL, no.event.lab = NULL, event.lab = NULL, covar.lab = NULL, full.sample.lab = "Full sample", ci.level = 0.95, ci.fun = "log")

Arguments

data
A data.frame, where columns contain the aggregated observation time (i.e., time.code), censored events (i.e., no.event.code) and aggregated count data for each event type (i.e., event.code); each row corresponds to a certain covariate value
time.code
A character or numerical value that specifies the time.code colname in data. If NULL, time.code is assumed to be the first colname in data
no.event.code
A character or numerical value that specifies the no.event.code colname in data. If NULL, no.event.code is assumed to be the second colname in data
no.event.lab
A character value that specifies a certain label for no.event.code column name in data. If NULL, no.event.lab equals no.event.code
event.lab
A character value (potentially vector with order and length according to order and number of competing events in data) that specifies a certain label for each event code in data. If NULL, event.lab equals the colname for each event code in data
covar.lab
A character value (potentially vector with order and length according to order and number of covariate values in data) that specifies a certain label for each event code (i.e. rowname) in data. If NULL, covar.lab equals the rowname for each covariate code in data
full.sample.lab
A character value that specifies a certain label for the full sample irates from data. Default is set to “Full sample”
ci.level
A numerical value between 0 and 1 that specifies the level for the two-sided confidence interval. Default is set to .95
ci.fun
A character value out of c(“lin”, “log”) that specifies the confidence interval function, either linear or log-transformed. Default is set to “log”

Value

An object of class irates. This object is implemented as a list of the (besides pre-specified) following items:
ir
Competing events incidence rates
var
Variance estimates for competing events incidence rates
conf.lower
Lower confidence interval corresponding to pre-specified function and level
conf.upper
Upper confidence interval corresponding to pre-specified function and level
N
Distribution of covariate values at baseline
n
data.frame with counts for each event according to covariate value as well as for the full sample

Details

The incidence rate is defined as the number of new cases of disease in a sample divided by the sample-time at risk.

References

Grambauer, N., Schumacher, M., Dettenkofer, M. and Beyersmann, J. (2010) Incidence densities in a competing events setting. American Journal of Epidemiology 172,1077--1084. http://aje.oxfordjournals.org/lookup/doi/10.1093/aje/kwq246

See Also

print.irates, summary.irates, plot.irates, data.reshape, grid

Examples

Run this code
### With individual patient data - sir.adm - using the function data.reshape
data(sir.adm)
dat1 <- data.reshape(
			times = sir.adm$time, 
			events = sir.adm$status, 
			covar = sir.adm$pneu, 
			no.event.code = "0")

### With aggregated count data
dat2 <- data.frame(
			time = c(7948,2899), 
			no.event = c(6,8), 
			event.1 = c(589,68), 
			event.2 = c(55,21), 
			row.names = c("covar0","covar1"))  

### Compute incidence rates from dat1 or dat2 (here dat2)
irates(dat2)

### Specify columns with time and no.event information
irates(
	dat2, 
	time.code = "time", 
	no.event.code = "no.event")

### Set specific labels
irates(
	dat2, 
	no.event.lab = "Admission", 
	event.lab = c("Discharge","Death"), 
	covar.lab = c("No pneumonia","Pneumonia"))

Run the code above in your browser using DataLab