### Install BUGSnet Package Source: https://bugsnetsoftware.github.io/instructions.html Install BUGSnet and its dependencies from GitHub using the remotes package. ```R install.packages(c("remotes", "knitr")) remotes::install_github("audrey-b/BUGSnet@v1.1.2", upgrade = TRUE, build_vignettes = TRUE, dependencies = TRUE) ``` -------------------------------- ### Verify Rtools Installation Source: https://bugsnetsoftware.github.io/instructions.html Check if build tools are correctly configured for R package development. ```R install.packages("pkgbuild") pkgbuild::has_build_tools() ``` -------------------------------- ### Update R on Windows Source: https://bugsnetsoftware.github.io/instructions.html Use the installr package to quickly update the R version on Windows systems. ```R install.packages("installr") installr::updateR(TRUE) ``` -------------------------------- ### BUGSnet Analysis Workflow Source: https://bugsnetsoftware.github.io/testscript.txt A complete sequence of operations for performing a network meta-analysis using BUGSnet, from data preparation to model comparison. ```R library(BUGSnet) data(diabetes.sim) ## prepare the data for use in bugsnet diabetes.data <- data.prep(arm.data = diabetes.sim, varname.t = "Treatment", varname.s = "Study") ## network Plot net.plot(diabetes.data, node.scale = 3, edge.scale=1.5) ##Network characteristic summary tables network.char <- net.tab(data = diabetes.data, outcome = "diabetes", N = "n", type.outcome = "rate2", time = "followup") ## assessing patient covariates data.plot(data = diabetes.data, covariate = "age", half.length = "age_SD", #comment this line out to remove error bars by = "treatment", #change to "study" to plot characteristics by study fill.str = "age_type", #comment this line out to remove colors avg.hline=TRUE) #add overall average line? ## choosing an NMA model: fixed vs random effects FE_model <- nma.model(data=diabetes.data, outcome="diabetes", N="n", reference="Diuretic", family="binomial", link="cloglog", time = "followup", effects="fixed") RE_model <- nma.model(data=diabetes.data, outcome="diabetes", N="n", reference="Diuretic", family="binomial", link="cloglog", time = "followup", effects= "random") cat(RE_model$bugs) ## running the models, will take ~30-60 seconds FE_results <- nma.run(FE_model, n.adapt=101, n.burnin=0, n.iter=101) RE_results <- nma.run(RE_model, n.adapt=101, n.burnin=0, n.iter=101) par(mar=c(1,1,1,1)) nma.diag(RE_results, plot_prompt = FALSE) ## model fit par(mfrow = c(1,2)) fe_model_fit <- nma.fit(FE_results, main = "Fixed Effects Model") re_model_fit <- nma.fit(RE_results, main= "Random Effects Model") ## Synthesis of results #Forest Plot nma.forest(RE_results, central.tdcy="median", comparator = "Placebo", #change this option any treatment of interest, e.g "ARB" log.scale = FALSE) # SUCRA Plot sucra.out <- nma.rank(RE_results, largerbetter=FALSE, sucra.palette= "Set1") # League table league.out <- nma.league(RE_results, central.tdcy="median", order = sucra.out$order, log.scale = FALSE, low.colour = "springgreen4", mid.colour = "white", high.colour = "red") ## Run inconsistency model re_inconsistency_model <- nma.model(data=diabetes.data, outcome="diabetes", N="n", reference="Diuretic", family="binomial", link="cloglog", time = "followup", type = "inconsistency", #specifies inconsistency model effects="random") re_inconsistency_results <- nma.run(re_inconsistency_model, n.adapt=101, n.burnin=0, n.iter=101) re_model_fit <- nma.fit(RE_results, main = "Consistency Model" ) inconsist_model_fit <- nma.fit(re_inconsistency_results, main= "Inconsistency Model") graphics.off() nma.compare(re_model_fit, inconsist_model_fit) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.