Calculate ratio of two SIRs/SMRs and the confidence intervals of the ratio.
sir_ratio(
x,
y,
digits = 3,
alternative = "two.sided",
conf.level = 0.95,
type = "exact"
)
a sir-object or a vector of two; observed and expected cases.
a sir-object or a vector of two; observed and expected cases.
number of digits in the output
The null-hypothesis test: (default:) two.sided
, less
, greater
the type-I error in confidence intervals, default 0.95 for 95% CI.
How the binomial confidence intervals are calculated (default:) exact
or asymptotic
.
A vector length of three: sir_ratio, and lower and upper confidence intervals.
Function works with pooled sir-objects i.e. the print
argument in sir
is ignored.
Also x
and y
can be a vector of two where first index is the
observed cases and second is expected cases (see examples).
Note that the ratio of two SIR's is only applicable when the age distributions are similar
in both populations.
Formula
The observed number of first sir O1
is considered as a Binomial variable with sample
size of O1+O2
. The confidence intervals for Binomial proportion A
is solved using exact
or asymptotic
method. Now the CI for ratio O1/O2
is B = A/(1 - A)
. And further the CI for SIR/SMR
is B*E2/E1. (Ederer and Mantel)
Statistics with Confidence: Confidence Intervals and Statistical Guidelines, Douglas Altman, 2000. ISBN: 978-0-727-91375-3
sir
A SIR calculation vignette
Other sir functions:
lines.sirspline()
,
plot.sirspline()
,
sir_exp()
,
sirspline()
,
sir()
# NOT RUN {
## Ratio for sir-object and the same values given manually:
## create example dataset
dt1 <- data.frame(obs = rep(c(5,7), 10),
pyrs = rep(c(250,300,350,400), 5),
var = 1:20)
Ref <- data.frame(obs = rep(c(50,70,80,100), 5),
pyrs = rep(c(2500,3000,3500,4000), 5),
var = 1:20)
## sir using the function
s1 <- sir(coh.data = dt1, coh.obs = obs, coh.pyrs = pyrs,
ref.data = Ref, ref.obs = obs, ref.pyrs = pyrs,
adjust = var)
## Ratio is simply 1:
sir_ratio(s1, c(120, 150))
# }
Run the code above in your browser using DataLab