Description Usage Arguments Details Author(s) See Also Examples
stmh
calculates incidence rate ratios (IRR) of the cohort.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | stmh(
data = NULL,
time,
status,
by,
fail = 1,
ref_value = NULL,
strata = NULL,
per = 1,
rnd = 4,
plot = TRUE,
print.table = TRUE
)
## S3 method for class 'character'
stmh(
data = NULL,
time,
status,
by,
fail = 1,
ref_value = NULL,
strata = NULL,
per = 1,
rnd = 4,
plot = TRUE,
print.table = TRUE
)
## S3 method for class 'list'
stmh(
data = NULL,
time,
status,
by,
fail = 1,
ref_value = NULL,
strata = NULL,
per = 1,
rnd = 4,
plot = TRUE,
print.table = TRUE
)
calc_RR(t, ref_lvl, rnd)
|
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 |
ref_value |
a number or character representing reference value |
strata |
variable to stratify by Mantel-Haenszel method |
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 |
2x2 table input to calaculate odds ratio of non-reference |
ref_lvl |
logical vector to indicate where reference category is |
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 Ratios
is calcluated using the following formula:
RR = Rate of Exposured Group / Rate of Non-Exposed Group
Confidence interval of RR
is derived using the following formula:
95\% CI (RR) = Rate x Error Factor
Error Factor (rate) = exp(1.96 / √{1/D1 + 1/D2})
Test of null hypothesis
is calculated as follows:
E1 = ( D * Y1/Y)
where D = (D0 + D1) is the total number of events, and Y= (Y0 + Y1) is the total follow-up time.
The test is based on the difference between the observed number of events in the exposed group and its expected value, D1 – E1 , which we denote by U. The variance of U, this difference, is equal to:
V = D \* (Y1/Y) \* ( 1 – (Y1/Y) )
The square of the standardized difference
U^2 / V
which is referred to the χ2 distribution with 1 degree of freedom (df).
plot
, if TRUE
, produces a graph of the rate against
the numerical code used for categories of by
.
Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)
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 | ## Not run:
library(lung)
data(lung)
str(lung)
## incidence rates
strate(lung, time, status)
## stratified incidence rates
strate(lung, time, status, sex, per = 100000)
stmh(lung, time, status, sex, per = 100000)
## creating ageband
lung1 <- egen(lung, age, c(55,61,71), new.var = ageband)
strate(lung1, time, status, ageband, per = 100000)
stmh(lung1, time, status, geband, per = 100000)
data(pbc)
str(pbc)
strate(pbc, time, status, trt, per = 100000)
stmh(pbc, time, status, trt, per = 100000)
strate(pbc, time, status, sex, per = 100000)
stmh(pbc, time, status, sex, per = 100000)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.