## Load datasets of trials on antidepressant drugs
data(dat.ad)
## Assess fragility of first 50 trials on antidepressant drugs
out1 <- frag.studies(e0, n0, e1, n1, data = dat.ad[1:50,], methods = "OR")
out1
## Visualize the results using the bar plot of fragility indexes
plot(out1)
## Additional arguments that can be passed to barplot()
plot(out1, cex.name = 0.7, mgp = c(2, 0.5, 0),
main = "Bar plot of fragility index")
## Reverse the bars that represent two directions of significance change
plot(out1, reverse = TRUE)
## Add space between bars, suppress borders, and change colors of bars
plot(out1, space = 0.5, col.border = NA, col.sig = c("blue", "red"),
cex.name = 0.7, mgp = c(2, 0.5, 0))
## More options, such as legends, can be added to the plot
legend("topright", fill = c("blue", "red"), border = NA,
legend = c("Non-significance altered to significance",
"Significance altered to non-significance"))
## Visualize the results using the histogram of fragility indexes
plot(out1, bar = FALSE)
## Present density, instead of frequencies (counts), in the histogram
plot(out1, bar = FALSE, freq = FALSE)
## Visualize the results using the histogram of fragility quotients
plot(out1, fragility = "FQ")
# \donttest{
## Assess fragility of the complete datasets of 347 trials;
## it takes longer time
out2 <- frag.studies(e0, n0, e1, n1, data = dat.ad)
out2
## Generate the bar plot for each method
plot(out2, method = "Fisher", cex.name = 0.7, mgp = c(2, 0.5, 0),
ylim = c(0, 60), main = "Fisher's exact Test")
plot(out2, method = "chisq", cex.name = 0.7, mgp = c(2, 0.5, 0),
ylim = c(0, 60), main = "Chi-squared test")
plot(out2, method = "OR", cex.name = 0.7, mgp = c(2, 0.5, 0),
ylim = c(0, 60), main = "Odds ratio")
plot(out2, method = "RR", cex.name = 0.7, mgp = c(2, 0.5, 0),
ylim = c(0, 60), main = "Relative risk")
plot(out2, method = "RD", cex.name = 0.7, mgp = c(2, 0.5, 0),
ylim = c(0, 60), main = "Risk difference")
## Restrict the bar plot to studies with
## significance altered to non-significance
plot(out2, dir = "sig2nonsig", method = "Fisher", cex.name = 0.7,
mgp = c(2, 0.5, 0), main = "Fisher's exact Test")
## Restrict the bar plot to studies with
## non-significance altered to significance
plot(out2, dir = "nonsig2sig", method = "Fisher", cex.name = 0.7,
mgp = c(2, 0.5, 0), main = "Fisher's exact Test")
## Truncate the fragility index at 16
plot(out2, method = "Fisher", max.f = 16, cex.name = 0.7,
mgp = c(2, 0.5, 0))
## A marker for the truncation will be presented in the histogram
plot(out2, method = "Fisher", bar = FALSE, max.f = 16,
mgp = c(2, 0.5, 0))
## Visualize the fragility quotients of all trials
plot(out2, method = "Fisher", fragility = "FQ", max.f = 16,
mgp = c(2, 0.5, 0))
## Use more breaks in the histogram
plot(out2, method = "Fisher", fragility = "FQ", max.f = 16,
breaks = 20, mgp = c(2, 0.5, 0))
# }
Run the code above in your browser using DataLab