# Reproduce Fig 4.7 (right panel), p.71
library(dplyr)
df <- vzv_be_2001_2003 %>%
mutate(age = round(age)) %>%
group_by(age) %>%
summarise(pos = sum(seropositive), tot = n())
plot(df$age, df$pos / df$tot,
cex = 0.036 * df$tot, pch = 19, xlab = "age", ylab = "seroprevalence",
xlim = c(0, 45), ylim = c(0, 1)
)
Run the code above in your browser using DataLab