function (content, measure, year, pmid, sortby, lefthand, righthand, type, cofactorlabel, topic, theme) { temp <- content temp <- gsub("\n", "", fixed = TRUE, temp, perl = TRUE) temp <- gsub("\t", " ", fixed = TRUE, temp) temp <- gsub(",", "\",\"", fixed = TRUE, temp) temp <- paste("\"", temp, "\"", sep = "") temp <- paste("Mymatrix <- matrix(c(", temp, "), ncol=8, byrow=TRUE, dimnames = list(NULL, c(\"Study\",\"year\", \"pmid\", \"TP\", \"FP\",\"FN\",\"TN\",\"cofactor\")))") x <- eval(parse(file = "", n = NULL, text = temp)) myframe <- data.frame(x) myframe$Study <- gsub("'", "", fixed = TRUE, myframe$Study) myframe$Study <- as.character(str_trim(myframe$Study)) myframe$year <- as.numeric(as.character(str_trim(myframe$year))) myframe$pmid <- as.numeric(as.character(str_trim(myframe$pmid))) myframe$TP <- as.numeric(as.character(str_trim(myframe$TP))) myframe$FP <- as.numeric(as.character(str_trim(myframe$FP))) myframe$FN <- as.numeric(as.character(str_trim(myframe$FN))) myframe$TN <- as.numeric(as.character(str_trim(myframe$TN))) myframe$studysize <- (myframe$TP + myframe$FP + myframe$FN + myframe$TN) myframe$prevalence <- (myframe$TP + myframe$FN)/myframe$studysize myframe$withoutcome <- (myframe$TP + myframe$FN) myframe$sensitivity <- myframe$TP/(myframe$TP + myframe$FN) myframe$specificity <- myframe$TN/(myframe$FP + myframe$TN) myframe$dor <- (myframe$TP/myframe$FP)/(myframe$FN/myframe$TN) msg = "" if (sortby == "study") { sortvalue <- myframe$Study } if (sortby == "year") { sortvalue <- myframe$year } if (sortby == "prevalence") { sortvalue <- myframe$prevalence } if (sortby == "sensitivity") { sortvalue <- myframe$sensitivity } if (sortby == "specificity") { sortvalue <- myframe$specificity } if (sortby == "cofactor") { sortvalue <- myframe$cofactor } if (sortby == "studysize") { sortvalue <- myframe$studysize } if (sortby == "weight") { sortvalue <- myframe$weight } myframe <- myframe[order(sortvalue), ] attach(myframe) KUBlue = "#0022B4" SkyBlue = "#6DC6E7" pubbiastext = "Test for funnel plot asymmetry" analyticmethod = "Hierarchical model (bivariate)" msg = "" meta1 <- madad(TP = TP, FN = FN, TN = TN, FP = FP, names = Study, data = myframe, correction = 0.5, correction.control = "all") height = 295 + length(myframe$Study) * 20 svgtext = paste("", sep = "") svgtext = paste(svgtext, "", topic, "", sep = "") svgtext = paste(svgtext, "StudyPrev. (%)Sensitivity (%)Specificity (%)", sep = "") for (i in 1:length(myframe$Study)) { svgtext = paste(svgtext, "", myframe$Study[i], ", ", myframe$year[i], "", sep = "") svgtext = paste(svgtext, "", round(myframe$prevalence[i] * 100, 0), "", sep = "") x = 375 + 100 * meta1$sens[[1]][i] svgtext = paste(svgtext, "", round(meta1$sens[[1]][i] * 100, 0), " (", round(meta1$sens$sens.ci[i, 1] * 100, 0), " - ", round(meta1$sens$sens.ci[i, 2] * 100, 0), ")", sep = "") svgtext = paste(svgtext, "", sep = "") cl.lower = 375 + 100 * meta1$sens$sens.ci[i, 1] ci.upper = 375 + 100 * meta1$sens$sens.ci[i, 2] svgtext = paste(svgtext, "", sep = "") x = 600 + 100 * meta1$spec[[1]][i] svgtext = paste(svgtext, "", round(meta1$spec[[1]][i] * 100, 0), " (", round(meta1$spec$spec.ci[i, 1] * 100, 0), " - ", round(meta1$spec$spec.ci[i, 2] * 100, 0), ")", sep = "") svgtext = paste(svgtext, "", sep = "") cl.lower = 600 + 100 * meta1$spec$spec.ci[i, 1] ci.upper = 600 + 100 * meta1$spec$spec.ci[i, 2] svgtext = paste(svgtext, "", sep = "") } svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") if (type == "ignore") { meta2 <- fit.bivar(TP = TP, FN = FN, TN = TN, FP = FP, study = Study, data = myframe) meta2 <- summary(meta2$bi.simple) sensitivity = c(meta2$coefficients[1, 1], meta2$coefficients[1, 1] - qnorm(0.975) * meta2$coefficients[1, 2], meta2$coefficients[1, 1] + qnorm(0.975) * meta2$coefficients[1, 2]) sensitivity = plogis(sensitivity) sensitivity = round(100 * sensitivity, 1) specificity = c(meta2$coefficients[2, 1], meta2$coefficients[2, 1] - qnorm(0.975) * meta2$coefficients[2, 2], meta2$coefficients[2, 1] + qnorm(0.975) * meta2$coefficients[2, 2]) specificity = plogis(specificity) specificity = round(100 * specificity, 1) meta2 <- perfect.trees(TP = TP, FN = FN, TN = TN, FP = FP, study = Study, data = myframe) svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "", sep = "") svgtext = paste(svgtext, "Summary", sep = "") pooledprevalence = (sum(TP) + sum(FN))/sum(studysize) svgtext = paste(svgtext, "", round(pooledprevalence * 100, 0), "", sep = "") svgtext = paste(svgtext, "", round(sensitivity[1], 0), " (", round(sensitivity[2], 0), " - ", round(sensitivity[3], 0), ")", sep = "") svgtext = paste(svgtext, "", round(sensitivity[1], 0), "", sep = "") svgtext = paste(svgtext, "", round(specificity[1], 0), " (", round(specificity[2], 0), " - ", round(specificity[3], 0), ")", sep = "") svgtext = paste(svgtext, "", round(specificity[1], 0), "", sep = "") LRpos = meta2$coef[[2]][1]/(1 - meta2$coef[[3]][1]) LRneg = (1 - meta2$coef[[2]][1])/meta2$coef[[3]][1] auc <- AUC(phm(myframe)) svgtext = paste(svgtext, "Area under the ROC curve: ", round(auc$AUC[[1]][1], 3), "", sep = "") meta3 <- madauni(myframe, correction = 0.5, correction.control = "all") I2 <- summary(meta3)$Isq svgtext = paste(svgtext, "Heterogeneity: ", round(I2, 1), "%", sep = "") svgtext = paste(svgtext, "(For diagnostic odds ratio: Q = ", round(meta3$CQ["Q"], 1), ", DF = ", meta3$CQ["df"], ")", sep = "") svgtext = paste(svgtext, "Predictive values:", sep = "") PreTestOdds = pooledprevalence/(1 - pooledprevalence) PostTestOdds = PreTestOdds * LRpos ppv = sprintf("%.1f", (PostTestOdds/(1 + PostTestOdds) * 100)) PostTestOdds = PreTestOdds * LRneg npv = PostTestOdds/(1 + PostTestOdds) npv = sprintf("%.1f", (npv * 100)) svgtext = paste(svgtext, "At the prevalences studied (mean ", round(pooledprevalence * 100, 0), "%, median ", round(median(prevalence * 100, ), 0), "%, range ", round(min(prevalence * 100), 0), " - ", round(max(prevalence * 100), 0), ", odds ", round(PreTestOdds, 2), "):", sep = "") svgtext = paste(svgtext, "Positive ", ppv, "%; negative ", 100 - as.numeric(npv), "%; 1- negative ", npv, "%", sep = "") svgtext = paste(svgtext, "Click here to recalculate predictive values at other prevalences", sep = "") svgtext = paste(svgtext, "About the studies:", sep = "") svgtext = paste(svgtext, "", prettyNum(sum(studysize), big.mark = ","), " persons (median ", prettyNum(median(studysize), big.mark = ","), ", range ", min(studysize), " - ", max(studysize), ") in ", length(myframe$Study), " studies.", sep = "") svgtext = paste(svgtext, "", prettyNum(sum(withoutcome), big.mark = ","), " persons with the outcome (median ", prettyNum(round(median(withoutcome, 0)), big.mark = ","), ", range ", min(withoutcome), " - ", max(withoutcome), ").", sep = "") } svgtext = paste(svgtext, "", sep = "") if (type == "subgroup") { msg = "Under construction (s)" } if (type == "metaregression (m)") { msg = "Under construction" } svgtext = paste(svgtext, "Sorry, your browser does not support inline SVG for dynamic graphics.") msg = svgtext msg = paste(msg, "
Select source code for graphics below (then press control and C together to copy.)
", sep = "") list(message = msg) }