knitr::opts_chunk$set(echo = FALSE) library(dplyr) library(reshape2) library(ggplot2) library(gemtc) library(pander)
The NMA was run via the gemtc package.
## read in results from Bayesian fit files_all <- dir(system.file("extdata", "results", package = "gemtcPlus")) files_rda <- grep("out-[0-9].RData", files_all, value = TRUE) out_all <- vector(mode = "list", length = length(files_rda)) for(i in seq_along(files_rda)){ out_i <- system.file("extdata", "results", files_rda[i], package = "gemtcPlus") load(out_i) out_all[[i]] <- out rm(out) }
Table Input data
dhr <- out_all[[1]]$data.raw #pandoc.table(dhr, row.names = FALSE, split.tables = Inf, justify = rep("right", ncol(dhr)), digits = 3)
Figure Network
plot(out_all[[1]]$model)
Table Model fit statistics
dsum <- data.frame(Name = unlist(lapply(out_all, FUN = function(x) x$name)), do.call(rbind, lapply(out_all, get_mtc_sum)) ) pandoc.table(dsum, row.names = FALSE)
\newline \newline
Table Model descriptions
descr <- data.frame(Name = unlist(lapply(out_all, FUN = function(x) x$name)), Type = unlist(lapply(out_all, FUN = function(x) x$model$linearModel)), RE.prior = unlist(lapply(out_all, FUN = function(x) paste(x$model$hy.prior))) ) pandoc.table(descr, row.names = FALSE)
Comparison vs ref treatment "A".
for(i in seq_along(out_all)){ out_i <- out_all[[i]] title_i <- paste("Model:", out_i$name) HR_i <- get_mtc_newVsAll(out_i, new.lab = "A", transform = "exp", digits = 2) pBetter_i <- get_mtc_probBetter(x = out_i, new.lab = "A", smaller.is.better = TRUE, sort.by = "effect") HR_i <- HR_i %>% left_join(pBetter_i[, c("Comparator", "probNewBetter")], by = "Comparator") cat("###", title_i, "\n") cat("__Table__ Hazard ratios ", attr(HR_i, "comparison"), "and probability of new treatment being better\n") pandoc.table(HR_i[order(HR_i$Med),], row.names = FALSE) cat("\\linebreak\n\n") cat("__Figure__ Hazard ratios ", attr(HR_i, "comparison"), "\n") plot_mtc_forest(x = HR_i, lab = paste("Hazard ratio", attr(HR_i, "comparison")), sort.by = "effect") cat("\n\n") }
for(i in seq_along(out_all)){ out_i <- out_all[[i]] title_i <- paste("Model:", out_i$name) ctab_i <- round(exp(relative.effect.table(out_i)), 2) cat("###", title_i, "\n") cat("__Table__ Cross-table of hazard ratios (column to row)\n") pandoc.table(as.data.frame(ctab_i), split.tables = Inf) cat("\n\n") }
for(i in seq_along(out_all)){ out_i <- out_all[[i]] title_i <- paste("Model:", out_i$name) cat("###", title_i, "\n") cat("```\n") cat(out_i$model$code) cat("\n") cat("```\n\n") }
BEE repository: r getwd()
date() sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.