strate: Calculate Incidence Rates from time-to-event data

Description Usage Arguments Details Author(s) See Also Examples

View source: R/strate.R

Description

strate calculates incidence rates of the cohort.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
strate(
  data = NULL,
  time,
  status,
  by = NULL,
  fail = 1,
  per = 1,
  rnd = 4,
  plot = TRUE,
  print.table = TRUE
)

strate.calc(t, s, f, p, r, v)

Arguments

data

an optional data frame

time

specify the timer interval when the subject is at risk

status

event of interest to calculate incidence: 1 for event, 0 for censored

by

specify variable to calculate stratified rates

fail

failure event

per

units to be used in reported rates

rnd

Rounding of numbers

plot

logical value to display plots of rates across a categorical variable

print.table

logical value to display formatted outputs

t

time var

s

status var

f

failure var

p

person-time var

r

rnd var

v

vector

Details

Rates of event occurrences, known as incidence rates are outcome measures in longitudinal studies. In most longitudinal studies, follow-up times vary due to logistic resasons, different periods of recruitment, delay enrolment into the study, lost-to-follow-up, immigration or emigration and death.

Follow-up time in longitudinal studies

Period of observation (called as follow-up time) starts when individuals join the study and ends when they either have an outcome of interest, are lost-to- follow-up or the follow-up period ends, whichever happens first. This period is called person-year-at-risk. This is denoted by PY in strate function's output and numer of event by D.

Rate

is calcluated using the following formula:

λ = D / PY

Confidence interval of rate

is derived using the following formula:

95\% CI (rate) = rate x Error Factor

Error Factor (rate) = exp(1.96 / √{D})

plot, if TRUE, produces a graph of the rates against the numerical code used for categories of by.

References:

  1. Essential Medical Statistics, Betty R. Kirkwood & Jonathan A.C. Sterne, Second Edition. Chapter 22, page 229 & 239

Author(s)

Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)

See Also

stmh

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
library(survival)
data(lung)

## incidence rates
strate(lung, time, status)
strate(lung, time, status, fail = 2)

## stratified incidence rates
strate(lung, time, status, by = sex)
strate(lung, time, status, by = sex, fail = 2)
strate(lung, time, status, by = sex, fail = 2, per = 1000)
strate(lung, time, status, by = sex, fail = 2, per = 100000, rnd = 1)
strate(time, status, data = lung, per = 100000)

## create ageband
lung1 <- egen(lung, age, c(56, 61, 71), new.var = ageband)
tab(ageband, lung1)

strate(lung1, time, status, by = ageband, per = 100000)

data(pbc)
str(pbc)
strate(pbc, time, status)
strate(pbc, time, status, trt)
strate(pbc, time, status, sex)
strate(pbc, time, status, stage, per = 100000)

## End(Not run)

myominnoo/mStats_beta documentation built on Feb. 29, 2020, 8:17 a.m.