knitr::opts_chunk$set(echo=FALSE, fig.width=10, fig.height=12) load_all("..") library(dplyr) library(ggplot2) library(plotly) library(meta)
Include all studies, not just those with complete reporting.
Control groups only, either placebo or observation-only.
Include 2 studies from healthy women (Control arms of the HORIZON, FIT studies) and compare between healthy and cancer
events <- unique(nmadata$aetype) notevents <- c("ANY ADVERSE EVENT","SERIOUS ADVERSE EVENTS", "Withdrawals because of AEs") events <- setdiff(events, notevents) nev <- length(events) mares <- data.frame(aetype=events) mares$totncon <- mares$totrcon <- mares$p <- mares$pl <- mares$pu <- NA for (i in 1:nev){ bpma <- bpaeriskdiff %>% filter(trtcon %in% c("100","101","103")) %>% filter(aetype==events[i]) if (nrow(bpma) > 0){ mres <- metaprop(rcon, ncon, studlab=`Trial name`, data=bpma, sm="PLN") mares[i,"totncon"] <- sum(bpma$ncon) mares[i,"totrcon"] <- sum(bpma$rcon) mares[i,c("p","pl","pu")] <- exp(unlist(mres[c("TE.fixed","lower.fixed","upper.fixed")])) } else mares[i,c("totncon","totrcon")] <- 0 } hmares <- data.frame(aetype=events) hmares$totncon <- hmares$totrcon <- hmares$p <- hmares$pl <- hmares$pu <- NA for (i in 1:nev){ bpma <- bpaeprevma %>% filter(`Trial name` %in% c("FIT","HORIZON")) %>% filter(aetype==events[i]) if (nrow(bpma) > 0){ mres <- metaprop(rcon, ncon, studlab=`Trial name`, data=bpma, sm="PLN") hmares[i,"totncon"] <- sum(bpma$ncon) hmares[i,"totrcon"] <- sum(bpma$rcon) hmares[i,c("p","pl","pu")] <- exp(unlist(mres[c("TE.fixed","lower.fixed","upper.fixed")])) } else hmares[i,c("totncon","totrcon")] <- 0 } mares$patient <- "Cancer" hmares$patient <- "Healthy" baseres <- rbind(mares, hmares) baseres <- baseres %>% mutate(label = sprintf("\nPooled baseline rate = %s (from total %s/%s)\n", round(p,3), totrcon,totncon)) ## Put healthy result and cancer result side by side in long-form data cp <- baseres$p[baseres$patient=="Cancer"] names(cp) <- baseres$aetype[baseres$patient=="Cancer"] baseres$cp <- cp[as.character(baseres$aetype)] hp <- baseres$p[baseres$patient=="Healthy"] names(hp) <- baseres$aetype[baseres$patient=="Healthy"] baseres$hp <- hp[as.character(baseres$aetype)] p <- baseres %>% mutate(aetype = factor(baseres$aetype, levels=unique(baseres$aetype[order(baseres$p)]))) %>% filter(!is.na(p)) %>% ggplot(aes(y=p, x=aetype, col=patient, label=label)) + coord_flip(ylim=c(0, 1)) + geom_hline(aes(yintercept=1), col="gray") + geom_point(aes(size=totrcon), position=position_dodge(-0.4)) + geom_errorbar(aes(ymin=pl, ymax=pu), width=0, position=position_dodge(-0.4)) + scale_y_continuous(breaks=seq(0, 1, by=0.05)) + ylab("Baseline event rate: pooled estimate from meta-analysis") + xlab("") ggplotly(p)
Events with baseline estimates for both cancer patients and healthy women.
Pooled estimates of baseline event rates from meta-analysis.
pc <- with(mares, sprintf("%s (%s,%s)", round(p,2), round(pl,2), round(pu,2))) ph <- with(hmares, sprintf("%s (%s,%s)", round(p,2), round(pl,2), round(pu,2))) pc <- ifelse(is.na(mares$p), NA, pc) ph <- ifelse(is.na(hmares$p), NA, ph) dat <- data.frame(Event=as.character(mares$aetype), Cancer=pc, Healthy=ph) dat[!is.na(dat$Healthy),]
Seven events where no studies report rates from control group. These shouldn't be relevant, they are rare and there's no evidence of an effect of bisphosphonates.
as.character(mares$aetype[is.na(mares$p)])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.