## EXAMPLE 1
dat <- rnorm(n = 100, mean = 0, sd = 1)
epi.conf(dat, method = "mean.single")
## EXAMPLE 2
group <- c(rep(1, times = 5), rep(2, times = 5))
val = round(c(rnorm(n = 5, mean = 10, sd = 5),
rnorm(n = 5, mean = 7, sd = 5)), digits = 0)
dat <- as.data.frame(cbind(group, val))
epi.conf(dat, method = "mean.unpaired")
## EXAMPLE 3
grp1 <- as.vector(round(rnorm(n = 100, mean = 10, sd = 5), digits = 0))
grp2 <- as.vector(round(rnorm(n = 100, mean = 7, sd = 5), digits = 0))
dat <- as.data.frame(cbind(grp1, grp2))
epi.conf(dat, method = "mean.paired")
## EXAMPLE 4
## Single sample (Altman et al. 2000, page 47):
## Out of 263 giving their views on the use of personal computers in
## general practice, 81 thought that the privacy of their medical file
## had been reduced.
pos <- 81
neg <- (263 - 81)
dat <- as.matrix(cbind(pos, neg))
round(epi.conf(dat, method = "prop.single"), digits = 3)
## The 95\% confidence interval for the population value of the proportion
## of patients thinking their privacy was reduced was from 0.255 to 0.366.
## EXAMPLE 5
## Two samples, unpaired (Altman et al. 2000, page 49):
## Goodfield et al. report adverse effects in 85 patients receiving either
## terbinafine or placebo treatment for dermatophyte onchomychois.
## Out of 56 patients receiving terbinafine, 5 patients experienced
## adverse effects. Out of 29 patients receiving a placebo, none experienced
## adverse effects.
grp1 <- matrix(cbind(5, 51), ncol = 2)
grp2 <- matrix(cbind(0, 29), ncol = 2)
dat <- as.matrix(cbind(grp1, grp2))
round(epi.conf(dat, method = "prop.unpaired"), digits = 3)
## The 95\% confidence interval for the difference between the two groups is
## from -0.038 to +0.193.
## EXAMPLE 6
## Two samples, paired (Altman et al. 2000, page 53):
## In a reliability exercise, 41 patients were randomly selected from those
## who had undergone a thalium-201 stress test. The 41 sets of images were
## classified as normal or not by the core thalium laboratory and,
## independently, by clinical investigators from different centres.
## Of the 19 samples identified as ischaemic by clinical investigators
## 5 were identified as ischaemic by the laboratory. Of the 22 samples
## identified as normal by clinical investigators 0 were identified as
## ischaemic by the laboratory.
dat <- as.matrix(cbind(14, 5, 0, 22))
round(epi.conf(dat, method = "prop.paired", conf.level = 0.95), digits = 3)
## The 95\% confidence interval for the population difference in
## proportions is 0.011 to 0.226 or approximately +1\% to +23\%.
## EXAMPLE 7
## A herd of cattle were tested for brucellosis. Two samples out of 200
## test returned a positive result. Assuming 100\% test sensitivity and
## specificity, what is the estimated prevalence of brucellosis in this
## group of animals?
pos <- 4
pop <- 200
dat <- as.matrix(cbind(pos, pop))
epi.conf(dat, method = "prevalence") * 100
## The estimated prevalence of brucellosis in this herd is 2 cases
## per 100 cattle (95\% CI 0.54 -- 5.0 cases per 100 cattle).
## EXAMPLE 8
## The observed disease counts and population size in four areas are provided
## below. What are the the standardised morbidity ratios of disease for each
## area and their 95\% confidence intervals?
obs <- c(5, 10, 12, 18)
pop <- c(234, 189, 432, 812)
dat <- as.matrix(cbind(obs, pop))
round(epi.conf(dat, method = "smr"), digits = 2)Run the code above in your browser using DataLab