File: sir_ratio.Rd

package info (click to toggle)
r-cran-popepi 0.4.13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,656 kB
  • sloc: sh: 13; makefile: 2
file content (92 lines) | stat: -rw-r--r-- 2,930 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sir_utils.R
\name{sir_ratio}
\alias{sir_ratio}
\title{Confidence intervals for the ratio of two SIRs/SMRs}
\usage{
sir_ratio(
  x,
  y,
  digits = 3,
  alternative = "two.sided",
  conf.level = 0.95,
  type = "exact"
)
}
\arguments{
\item{x}{a sir-object or a vector of two; observed and expected cases.}

\item{y}{a sir-object or a vector of two; observed and expected cases.}

\item{digits}{number of digits in the output}

\item{alternative}{The null-hypothesis test: (default:) \code{two.sided}, \code{less}, \code{greater}}

\item{conf.level}{the type-I error in confidence intervals, default 0.95 for 95\% CI.}

\item{type}{How the binomial confidence intervals are calculated (default:) \code{exact} or \code{asymptotic}.}
}
\value{
A vector length of three: sir_ratio, and lower and upper confidence intervals.
}
\description{
Calculate ratio of two SIRs/SMRs and the confidence intervals of the ratio.
}
\details{
Function works with pooled sir-objects i.e. the \code{print} argument in \code{sir} is ignored.
Also \code{x} and \code{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.

\strong{Formula}

The observed number of first sir \code{O1} is considered as a Binomial variable with sample
size of \code{O1+O2}. The confidence intervals for Binomial proportion \code{A}
is solved using \code{exact} or \code{asymptotic}
method. Now the CI for ratio \code{O1/O2} is \code{B = A/(1 - A)}. And further the CI for SIR/SMR
is B*E2/E1. (Ederer and Mantel)
}
\note{
Parameter \code{alternative} is always \code{two.sided} when parameter
\code{type} is set to \code{asymptotic}.
}
\examples{
## 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))

}
\references{
Statistics with Confidence: Confidence Intervals and Statistical Guidelines,
Douglas Altman, 2000. ISBN: 978-0-727-91375-3
}
\seealso{
\verb{[sir]}
\href{../doc/sir.html}{A SIR calculation vignette}

Other sir functions: 
\code{\link{lines.sirspline}()},
\code{\link{plot.sirspline}()},
\code{\link{sir}()},
\code{\link{sir_exp}()},
\code{\link{sirspline}()}
}
\author{
Matti Rantanen
}
\concept{sir functions}