Skip to content

Instantly share code, notes, and snippets.

@thanhlamm2806
Created April 3, 2024 06:43
Show Gist options
  • Save thanhlamm2806/6b03380cb56a8a4812048791a4531ced to your computer and use it in GitHub Desktop.
Save thanhlamm2806/6b03380cb56a8a4812048791a4531ced to your computer and use it in GitHub Desktop.
Measles data analysis
library(dplyr)
library(ggplot2)
library(mcstats)
install.packages("mcstats")
load("C:\\Users\\Admin\\OneDrive\\Desktop\\YTCC20\\Khóa luận\\Data sởi - OUCRU\\measles11RS\\data\\igg.rda")
View(igg)
anova2(glm(concentration > 200 ~ site + age + site:age, binomial,
+ mutate(igg, age = mean_age(age))))
# Seroprevalence of each age group in Ho Chi Minh City
## Threshold >= 200IU/ml
tmp$conc200 <- ifelse(tmp$concentration >= 200, 1, 0)
grouped_tmp <- tmp %>%
filter(location == "Ho Chi Minh") %>%
group_by(age) %>%
summarise(prop = sum(conc200)/length(conc200))
ggplot(grouped_tmp, aes(x = age, y = prop)) +
geom_point(size = 4, shape = 1) +
ylim(0:1) +
theme_bw()
## Threshold >= 275IU/ml
tmp$conc275 <- ifelse(tmp$concentration >= 275, 1, 0)
grouped_tmp <- tmp %>%
filter(location == "Ho Chi Minh") %>%
group_by(age) %>%
summarise(prop = sum(conc275)/length(conc275))
ggplot(grouped_tmp, aes(x = age, y = prop)) +
geom_point(size = 4, shape = 1) +
ylim(0:1) +
theme_bw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment