| Title: | A 'shiny' Application for Network Meta-Analysis |
|---|---|
| Description: | Conduct network meta-analyses through a graphical user interface using 'bnma', 'gemtc' and 'netmeta' with additional analysis provided by 'meta' and 'metafor'. Frequentist, Bayesian, meta-regression and baseline risk meta-regression analyses can all be conducted using a consistent data structure and terminology. Many options are provided for downloading publication-ready outputs and analyses can be reproduced outside of the application by downloading a 'quarto' file. The interface was generated using 'shinyscholar'. The initial version of the app was described by Owen et al. (2018) <doi:10.1002/jrsm.1373>, Bayesian ranking visualisations were described by Nevill et al. (2023) <doi:10.1016/j.jclinepi.2023.02.016> and metaregression was described by Morris et al. (2025) <doi:10.1016/j.jclinepi.2025.111839>. |
| Authors: | Alex Sutton [aut, cre], Naomi Bradbury [aut], Ryan Field [aut], Tom Morris [aut], Clareece Nevill [aut], Janion Nevill [aut], Rhiannon Owen [aut], Simon E. H. Smart [aut], Yiqiao Xin [aut], Nicola Cooper [ctb], Suzanne Freeman [ctb] |
| Maintainer: | Alex Sutton <[email protected]> |
| License: | GPL-3 |
| Version: | 7.1.0 |
| Built: | 2026-06-15 15:59:38 UTC |
| Source: | https://github.com/cran/metainsight |
Run the application via the
function run_metainsight
Produce a table of comparisons of all treatment pairs for baseline risk
models using bnma::relative.effects.table()
baseline_compare(model, logger = NULL)baseline_compare(model, logger = NULL)
model |
list. Object produced by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
Relative effects table
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_compare(model = fitted_baseline_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_compare(model = fitted_baseline_model)
Produce deviance plotly plots for baseline risk models. Unlike for
bayes_model output, only stem and leverage plots are produced.
baseline_deviance(model, async = FALSE)baseline_deviance(model, async = FALSE)
model |
Output model produced by |
async |
Whether or not the function is being used asynchronously. Default |
list containing:
deviance_mtc |
equivalent summary to that produced by |
stem_plot |
plotly object |
lev_plot |
plotly object |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_deviance(model = fitted_baseline_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_deviance(model = fitted_baseline_model)
Produce a forest plot for a baseline risk model using gemtc::blobbogram()
baseline_forest( model, xmin = NULL, xmax = NULL, title = "Baseline risk regression analysis", ranking = FALSE, logger = NULL )baseline_forest( model, xmin = NULL, xmax = NULL, title = "Baseline risk regression analysis", ranking = FALSE, logger = NULL )
model |
Output produced by |
xmin |
numeric. Minimum x-axis value. Default |
xmax |
numeric. Maximum x-axis value. Default |
title |
character. Title for the plot. Defaults to |
ranking |
logical. Whether the function is being used in |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_forest(model = fitted_baseline_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) baseline_forest(model = fitted_baseline_model)
Fit a baseline risk regression model using bnma::network.run().
The output is consistent with outputs produced by gemtc.
baseline_model( configured_data, regressor_type, n_iter = 20000, max_iter = 60000, check_iter = 10000, async = FALSE )baseline_model( configured_data, regressor_type, n_iter = 20000, max_iter = 60000, check_iter = 10000, async = FALSE )
configured_data |
list. Input dataset created by |
regressor_type |
character. Type of regression coefficient, either |
n_iter |
numeric. Number of simulation iterations.
Defaults to |
max_iter |
numeric. The maximum number of iterations.
Defaults to |
check_iter |
numeric. The number of iterations after which convergence
is checked for. Defaults to |
async |
Whether or not the function is being used asynchronously. Default |
List of bnma related output:
mtcResults |
model object itself carried through (needed to match existing code) |
covariate_value |
The mean covariate value, used for centring |
reference_treatment |
character. The |
comparator_names |
Vector containing the names of the comparators |
a |
text output stating whether fixed or random effects |
cov_value_sentence |
text output stating the value for which the covariate has been set to for producing output |
slopes |
named list of slopes for the regression equations (unstandardised - equal to one 'increment') |
intercepts |
named list of intercepts for the regression equations at cov_value |
outcome |
character. The |
outcome_measure |
character. The |
effects |
character. The |
covariate_min |
Vector of minimum covariate values directly contributing to the regression |
covariate_max |
Vector of maximum covariate values directly contributing to the regression |
dic |
Summary of model fit |
sumresults |
Output of summary(model) |
regressor |
Type of regression coefficient |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10)
Generate data required to produce a metaregression plot for a baseline risk model.
baseline_regression(model, configured_data, async = FALSE)baseline_regression(model, configured_data, async = FALSE)
model |
Output produced by |
configured_data |
list. Input dataset created by |
async |
Whether or not the function is being used asynchronously. Default |
List containing:
directness |
list. Output from |
credible_regions |
list. Output from |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) regression_data <- baseline_regression(model = fitted_baseline_model, configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) regression_data <- baseline_regression(model = fitted_baseline_model, configured_data = configured_data)
Produce a plot summarising baselink risk for each study arm
baseline_summary(configured_data, logger = NULL)baseline_summary(configured_data, logger = NULL)
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) baseline_summary(configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) baseline_summary(configured_data)
Produce a table of comparisons of all treatment pairs for Bayesian
models using gemtc::relative.effect.table()
bayes_compare(model, logger = NULL) covariate_compare(...)bayes_compare(model, logger = NULL) covariate_compare(...)
model |
list. Object created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
... |
Parameters passed to |
Relative effects table
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_compare(model = fitted_bayes_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_compare(model = fitted_bayes_model)
Produce a summary of a Bayesian model
bayes_details(model, logger = NULL) covariate_details(...) baseline_details(...)bayes_details(model, logger = NULL) covariate_details(...) baseline_details(...)
model |
Output produced by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
... |
Parameters passed to |
HTML summary of the model
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_details(model = fitted_bayes_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_details(model = fitted_bayes_model)
Produce deviance plots using the output of gemtc::mtc.deviance()
for Bayesian and covariate models. Because these plots are interactive, it is
not currently possible to download them, although they can be included in
html reports.
bayes_deviance(model, n_adapt = 5000, n_iter = 20000, async = FALSE) covariate_deviance(...)bayes_deviance(model, n_adapt = 5000, n_iter = 20000, async = FALSE) covariate_deviance(...)
model |
Bayesian model produced by |
n_adapt |
numeric. Number of adaptation iterations.
Defaults to |
n_iter |
numeric. Number of simulation iterations.
Defaults to |
async |
Whether or not the function is being used asynchronously. Default |
... |
Parameters passed to |
A list containing different elements depending on the input model:
When model was created by bayes_model() containing:
deviance_mtc |
results from |
deviance_ume |
results from |
scat_plot |
plotly object |
stem_plot |
plotly object |
lev_plot |
plotly object |
When model was created by covariate_model() containing:
deviance_mtc |
results from |
stem_plot |
plotly object |
lev_plot |
plotly object |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_deviance(model = fitted_bayes_model, n_adapt = 100, n_iter = 100)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_deviance(model = fitted_bayes_model, n_adapt = 100, n_iter = 100)
Produce a Bayesian forest plot with gemtc::forest()
bayes_forest( model, xmin = NULL, xmax = NULL, title = "", ranking = FALSE, logger = NULL ) covariate_forest(...)bayes_forest( model, xmin = NULL, xmax = NULL, title = "", ranking = FALSE, logger = NULL ) covariate_forest(...)
model |
list. Object created by |
xmin |
numeric. Minimum x-axis value. Default |
xmax |
numeric. Maximum x-axis value. Default |
title |
character. Title for the plot. Default is no title |
ranking |
logical. Whether the function is being used in |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
... |
Parameters passed to |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_forest(model = fitted_bayes_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_forest(model = fitted_bayes_model)
Produce Markov chain Monte Carlo plots for Bayesian models
bayes_mcmc(model, async = FALSE) covariate_mcmc(...) baseline_mcmc(...)bayes_mcmc(model, async = FALSE) covariate_mcmc(...) baseline_mcmc(...)
model |
Output from |
async |
Whether or not the function is being used asynchronously. Default |
... |
Parameters passed to |
list containing:
gelman_plots |
Gelman plots |
trace_plots |
Trace plots |
density_plots |
Density plots |
n_rows |
The number of rows for each plot |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_mcmc(model = fitted_bayes_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_mcmc(model = fitted_bayes_model)
Fit a Bayesian model using gemtc
bayes_model(configured_data, n_adapt = 5000, n_iter = 20000, async = FALSE)bayes_model(configured_data, n_adapt = 5000, n_iter = 20000, async = FALSE)
configured_data |
list. Input dataset created by |
n_adapt |
numeric. Number of adaptation iterations.
Defaults to |
n_iter |
numeric. Number of simulation iterations.
Defaults to |
async |
Whether or not the function is being used asynchronously. Default |
List containing:
mtcResults |
mtc.result. Output from |
mtcRelEffects |
mtc.result. Output from |
rel_eff_tbl |
mtc.relative.effect.table. Output from |
sumresults |
summary.mtc.result. Output from |
mtcNetwork |
mtc.network. Output from |
dic |
dataframe. Containing the statistics 'Dbar', 'pD', 'DIC', and 'data points' |
outcome |
character. The |
outcome_measure |
character. The |
reference_treatment |
character. The |
effects |
character. The |
seed |
numeric. The |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100)
Fit a Bayesian nodesplitting model with gemtc::mtc.nodesplit().
This is not possible for all networks and the function will return an error
if the nodes cannot be split.
bayes_nodesplit(configured_data, n_adapt = 5000, n_iter = 20000, async = FALSE)bayes_nodesplit(configured_data, n_adapt = 5000, n_iter = 20000, async = FALSE)
configured_data |
list. Input dataset created by |
n_adapt |
numeric. Number of adaptation iterations.
Defaults to |
n_iter |
numeric. Number of simulation iterations.
Defaults to |
async |
Whether or not the function is being used asynchronously. Default |
mtc.nodesplit object containing an mtc.result object for each node
nodesplit_path <- system.file("extdata", "continuous_nodesplit.csv", package = "metainsight") loaded_data <- setup_load(data_path = nodesplit_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "Placebo", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use nodesplit_model <- bayes_nodesplit(configured_data, n_adapt = 100, n_iter = 100)nodesplit_path <- system.file("extdata", "continuous_nodesplit.csv", package = "metainsight") loaded_data <- setup_load(data_path = nodesplit_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "Placebo", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use nodesplit_model <- bayes_nodesplit(configured_data, n_adapt = 100, n_iter = 100)
Produce a forest plot from nodesplitting results
bayes_nodesplit_plot(nodesplit, main_analysis = TRUE, logger = NULL)bayes_nodesplit_plot(nodesplit, main_analysis = TRUE, logger = NULL)
nodesplit |
|
main_analysis |
logical. Whether the analysis is the main or sensitivity analysis. Default |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
nodesplit_path <- system.file("extdata", "continuous_nodesplit.csv", package = "metainsight") loaded_data <- setup_load(data_path = nodesplit_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "Placebo", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123) nodesplit_model <- bayes_nodesplit(configured_data, n_adapt = 100, n_iter = 100) bayes_nodesplit_plot(nodesplit_model)nodesplit_path <- system.file("extdata", "continuous_nodesplit.csv", package = "metainsight") loaded_data <- setup_load(data_path = nodesplit_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "Placebo", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123) nodesplit_model <- bayes_nodesplit(configured_data, n_adapt = 100, n_iter = 100) bayes_nodesplit_plot(nodesplit_model)
Generate treatment ranking data required to produce SUCRA plots from Bayesian models
bayes_ranking(model, configured_data, logger = NULL) baseline_ranking(...) covariate_ranking(...)bayes_ranking(model, configured_data, logger = NULL) baseline_ranking(...) covariate_ranking(...)
model |
list. Output produced by |
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
... |
Parameters passed to |
List of output created by rankdata()
SUCRA |
Dataframe of SUCRA data |
Colour |
Dataframe of colours |
Cumulative |
Dataframe of cumulative ranking probabilities |
Probabilities |
Dataframe of ranking probabilities |
Network |
Dataframe of network characteristics |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) ranking_data <- bayes_ranking(fitted_bayes_model, configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) ranking_data <- bayes_ranking(fitted_bayes_model, configured_data)
Produce a table summarising Bayesian models
bayes_results(model, logger = NULL) covariate_results(...) baseline_results(...)bayes_results(model, logger = NULL) covariate_results(...) baseline_results(...)
model |
list. Output produced by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
... |
Parameters passed to |
HTML summary of the model
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_results(fitted_bayes_model)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) bayes_results(fitted_bayes_model)
Fit a covariate regression model using gemtc.
covariate_model( configured_data, covariate_value, regressor_type, covariate_model_output = NULL, n_adapt = 5000, n_iter = 20000, async = FALSE )covariate_model( configured_data, covariate_value, regressor_type, covariate_model_output = NULL, n_adapt = 5000, n_iter = 20000, async = FALSE )
configured_data |
list. Input dataset created by |
covariate_value |
numeric. The value at which to fit the model. Must be greater
than or equal to the minimum value and less than or equal to the maximum
value in |
regressor_type |
character. Type of regression coefficient, either |
covariate_model_output |
list. The output of the function. Default |
n_adapt |
numeric. Number of adaptation iterations.
Defaults to |
n_iter |
numeric. Number of simulation iterations.
Defaults to |
async |
Whether or not the function is being used asynchronously. Default |
List of gemtc related output:
mtcResults |
model object from |
mtcRelEffects |
data relating to presenting relative effects |
rel_eff_tbl |
table of relative effects for each comparison |
covariate_value |
The covariate value originally passed into this function |
reference_treatment |
character. The |
comparator_names |
Vector containing the names of the comparators |
a |
text output stating whether fixed or random effects |
sumresults |
summary output of relative effects |
dic |
data frame of model fit statistics |
cov_value_sentence |
text output stating the value for which the covariate has been set to for producing output |
slopes |
named list of slopes for the regression equations (unstandardised - equal to one 'increment') |
intercepts |
named list of intercepts for the regression equations at covariate_value |
outcome |
character. The |
outcome_measure |
character. The |
effects |
character. The |
mtcNetwork |
The network object from GEMTC |
covariate_min |
Vector of minimum covariate values directly contributing to the regression |
covariate_max |
Vector of maximum covariate values directly contributing to the regression |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use # initial model fitted_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 98, regressor_type = "shared", n_adapt = 100, n_iter = 100) # updated for new covariate value updated_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 97, regressor_type = "shared", covariate_model_output = fitted_covariate_model, n_adapt = 100, n_iter = 100)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use # initial model fitted_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 98, regressor_type = "shared", n_adapt = 100, n_iter = 100) # updated for new covariate value updated_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 97, regressor_type = "shared", covariate_model_output = fitted_covariate_model, n_adapt = 100, n_iter = 100)
Generate data from a covariate model required to produce a metaregression plot
covariate_regression(model, configured_data, async = FALSE)covariate_regression(model, configured_data, async = FALSE)
model |
list. Output created by |
configured_data |
list. Input dataset created by |
async |
Whether or not the function is being used asynchronously. Default |
List containing:
directness |
list. Output from |
credible_regions |
list. Output from |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 98, regressor_type = "shared", n_adapt = 100, n_iter = 100) regression_data <- covariate_regression(model = fitted_covariate_model, configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_covariate_model <- covariate_model(configured_data = configured_data, covariate_value = 98, regressor_type = "shared", n_adapt = 100, n_iter = 100) regression_data <- covariate_regression(model = fitted_covariate_model, configured_data = configured_data)
Produce a plot summarising the covariate value for each study arm
covariate_summary(configured_data, logger = NULL)covariate_summary(configured_data, logger = NULL)
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) covariate_summary(configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) covariate_summary(configured_data)
Creates posterior density plots of MCMC samples.
density_plots(model, parameters)density_plots(model, parameters)
model |
Model output. |
parameters |
Vector of parameters to create density plots for. |
List of ggplot density plots.
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) density_plots(fitted_bayes_model$mtcResults, mcmc$parameters)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) density_plots(fitted_bayes_model$mtcResults, mcmc$parameters)
Create a summary table of deviance information criterion stats for Bayesian models
dic_table(dic, analysis = "all")dic_table(dic, analysis = "all")
dic |
dataframe of DIC stats from |
analysis |
Whether the analysis is using all studies ( |
Prepare project into a JSON format that CINeMA can read.
export_cinema(configured_data, gemtc_results = NULL, logger = NULL)export_cinema(configured_data, gemtc_results = NULL, logger = NULL)
configured_data |
list. Input dataset created by |
gemtc_results |
Output from |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
JSON string with the following structure: A named list of lists. The top level list contains items:
"project" Information for CINeMA project
"CM" Contribution matrices
"contributionMatrices" output from .PrepareAnalysisForCinema()
"format" Data format. Always "long"
"type" Outcome type. Either "binary" or "continuous"
"Studies" Study data
"long" Output from .PrepareDataForCinema()
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) cinema_project <- export_cinema(configured_data = configured_data) writeLines(cinema_project, tempfile(fileext = ".json"))configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) cinema_project <- export_cinema(configured_data = configured_data) writeLines(cinema_project, tempfile(fileext = ".json"))
Produce a comparison table of treatments using
netmeta::netleague().
freq_compare(configured_data, logger = NULL)freq_compare(configured_data, logger = NULL)
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
Dataframe of comparisons with one row and one column per treatment
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_compare(configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_compare(configured_data = configured_data)
Produce an annotated frequentist forest plot using
meta::forest()
freq_forest( configured_data, xmin = NULL, xmax = NULL, title = "", logger = NULL )freq_forest( configured_data, xmin = NULL, xmax = NULL, title = "", logger = NULL )
configured_data |
list. Input dataset created by |
xmin |
numeric. Minimum x-axis value. Default |
xmax |
numeric. Maximum x-axis value. Default |
title |
character. Title for the plot. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_forest(configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_forest(configured_data = configured_data)
Produce inconsistency tables using netmeta::netsplit()
freq_inconsistency(configured_data, logger = NULL)freq_inconsistency(configured_data, logger = NULL)
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
Dataframe of inconsistency data:
Comparison |
Treatment comparison |
No.Studies |
Number of studies |
NMA |
NMA treatment effect estimate |
Direct |
Direct treatment effect estimate |
Indirect |
Indirect treatment effect estimate |
Difference |
Difference between treatment effects |
Diff_95CI_lower |
2.5% limit of difference in treatment effects |
Diff_95CI_upper |
97.5% limit of difference in treatment effects |
pValue |
p-value for test of "difference in treatment effects == 0" |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_inconsistency(configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_inconsistency(configured_data = configured_data)
Produce a summary forest plot matrix with treatments ranked by SUCRA score,
determined by netmeta::rankogram(). This function can only be used when
configured_data contains between 3 and 10 treatments.
freq_summary(configured_data, plot_title = "", logger = NULL)freq_summary(configured_data, plot_title = "", logger = NULL)
configured_data |
list. Input dataset created by |
plot_title |
character. Title of the plot. Default is no title. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_summary(configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) freq_summary(configured_data = configured_data)
Creates Gelman plots for a gemtc or bnma model.
gelman_plots(gelman_data, parameters)gelman_plots(gelman_data, parameters)
gelman_data |
List of outputs from |
parameters |
Vector of parameters mentioned in the previous argument. |
List of ggplot Gelman plots
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) gelman_plots(mcmc$gelman_data, mcmc$parameters)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) gelman_plots(mcmc$gelman_data, mcmc$parameters)
Creates network connectivity info displayed under network plots
make_netconnect(freq)make_netconnect(freq)
freq |
List of NMA results created by freq_wrap(). |
Vector summarising network connectivity created by netmeta::netconnection().
Produce a composite meta-regression plot which comprises plots showing direct and indirect evidence from baseline or covariate models. The design was adapted from Donegan et al. (2018) https://onlinelibrary.wiley.com/doi/10.1002/jrsm.1292
metaregression_plot( model, configured_data, regression_data, comparators, include_covariate = FALSE, include_ghosts = FALSE, include_extrapolation = FALSE, include_credible = FALSE, credible_opacity = 0.2, covariate_symbol = "circle open", covariate_symbol_size = 10, legend_position = "BR", logger = NULL )metaregression_plot( model, configured_data, regression_data, comparators, include_covariate = FALSE, include_ghosts = FALSE, include_extrapolation = FALSE, include_credible = FALSE, credible_opacity = 0.2, covariate_symbol = "circle open", covariate_symbol_size = 10, legend_position = "BR", logger = NULL )
model |
Output from |
configured_data |
list. Input dataset created by |
regression_data |
Output from |
comparators |
Vector of treatments to plot in colour. Cannot include the
|
include_covariate |
logical. Whether the value of the covariate should
be plotted as a vertical line. Defaults to |
include_ghosts |
logical. Whether the other comparator studies should
be plotted in grey in the background of the plot. Defaults to |
include_extrapolation |
logical. Whether the regression lines should be
extrapolated beyond the range of the given data as dashed lines.
Defaults to |
include_credible |
logical. Whether the credible regions should be
plotted for the specified comparators. These will be partially transparent
regions. Defaults to |
credible_opacity |
numeric. The opacity of the credible regions.
Can be any value between |
covariate_symbol |
character. The selected symbol for displaying
covariates. Defaults to
|
covariate_symbol_size |
numeric. Size of the covariate symbols.
Defaults to |
legend_position |
character. The position of the legend. Defaults to
|
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) regression_data <- baseline_regression(model = fitted_baseline_model, configured_data = configured_data) metaregression_plot(model = fitted_baseline_model, configured_data = configured_data, regression_data = regression_data, comparators = c("the_Younger", "the_Little"))configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_iter, max_iter and check_iter are set low to run quickly, but should # be left as the default values in real use fitted_baseline_model <- baseline_model(configured_data = configured_data, regressor_type = "shared", n_iter = 120, max_iter = 120, check_iter = 10) regression_data <- baseline_regression(model = fitted_baseline_model, configured_data = configured_data) metaregression_plot(model = fitted_baseline_model, configured_data = configured_data, regression_data = regression_data, comparators = c("the_Younger", "the_Little"))
Calculate edge.weights for network
network_structure(freq, order = NA)network_structure(freq, order = NA)
freq |
list. Output from |
order |
character. Vector of treatments names in rank order. |
data.frame containing the number of studies that compare each treatment against the reference treatment.
Produce either a rankogram or radial SUCRA plot ranking the treatments
ranking_plot( ranking_data, style, colourblind = FALSE, simple = FALSE, regression_text = "", logger = NULL )ranking_plot( ranking_data, style, colourblind = FALSE, simple = FALSE, regression_text = "", logger = NULL )
ranking_data |
list created by |
style |
character. The style of plot to produce. Either |
colourblind |
logical. Whether to use a colourblind-friendly palette. Defaults to |
simple |
logical. Whether to display a simplified version of the radial plot. Does
not affect the rankogram plot. Defaults to |
regression_text |
Text to show for regression. Defaults to no text. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
Ranking probability table
ranking_table(ranking_data)ranking_table(ranking_data)
ranking_data |
list created by bayes_ranking(). |
dataframe
This function runs the "metainsight" application in the user's default web browser.
run_metainsight( launch.browser = TRUE, port = getOption("shiny.port"), load_file = NULL )run_metainsight( launch.browser = TRUE, port = getOption("shiny.port"), load_file = NULL )
launch.browser |
Whether or not to launch a new browser window. |
port |
The port for the shiny server to listen on. Defaults to a random available port. |
load_file |
Path to a saved session file which will be loaded when the app is opened |
Jamie Kass [email protected]
Gonzalo E. Pinilla-Buitrago [email protected]
Simon E. H. Smart [email protected]
if(interactive()) { run_metainsight() }if(interactive()) { run_metainsight() }
Checks the connectivity of the loaded data and converts it into formats for
later analyses. Conducts a frequentist analysis using netmeta::netmeta().
The output can be passed to many other functions - all summary_ and freq_
functions and bayes_model(), baseline_model() and covariate_model().
setup_configure( loaded_data, reference_treatment, effects, outcome_measure, ranking_option, seed, logger = NULL )setup_configure( loaded_data, reference_treatment, effects, outcome_measure, ranking_option, seed, logger = NULL )
loaded_data |
list. Output from |
reference_treatment |
character. The reference treatment of the dataset |
effects |
character. Type of model to fit, either |
outcome_measure |
character. Outcome measure of the dataset. Either
|
ranking_option |
character. |
seed |
numeric. Seed used to fit the models. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
configured_data containing:
treatments |
dataframe. Treatment names and IDs |
reference_treatment |
character. The selected reference treatment |
disconnected_indices |
vector. Indices of studies that are not connected to the main network |
connected_data |
dataframe. A subset of the data containing only connected studies |
non_covariate_data |
dataframe. The uploaded data with covariates removed |
covariate |
A list containing these items if covariate data exists or else empty:
|
freq |
list. Processed data for frequentist analyses created by |
outcome |
character. Whether the data is |
outcome_measure |
character. Outcome measure of the dataset. |
effects |
character. Whether the models are |
ranking_option |
character. Whether higher values in the data are |
seed |
numeric. A seed value to be passed to models |
minimal_data_path <- system.file("extdata", "continuous_minimal.csv", package = "metainsight") loaded_data <- setup_load(data_path = minimal_data_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "the Great", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123)minimal_data_path <- system.file("extdata", "continuous_minimal.csv", package = "metainsight") loaded_data <- setup_load(data_path = minimal_data_path, outcome = "continuous") configured_data <- setup_configure(loaded_data = loaded_data, reference_treatment = "the Great", effects = "random", outcome_measure = "MD", ranking_option = "good", seed = 123)
Create a table summarising how the analysis has been configured
setup_configure_table(configured_data)setup_configure_table(configured_data)
configured_data |
list. Input dataset created by |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) setup_configure_table(configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) setup_configure_table(configured_data)
Takes the configured data, removes any excluded studies and returns subsets of the data to be passed to other functions.
setup_exclude(configured_data, exclusions, async = FALSE)setup_exclude(configured_data, exclusions, async = FALSE)
configured_data |
list. Input dataset created by |
exclusions |
character. Vector of study names to exclude. |
async |
Whether or not the function is being used asynchronously. Default |
configured_data containing:
treatments |
dataframe. Treatment names and IDs |
reference_treatment |
character. The selected reference treatment |
connected_data |
dataframe. A subset of the data containing only connected studies |
covariate |
A list containing these items if covariate data exists or else empty: |
cross: Crosses
circle_open: Open circles
none: No symbols in which case only the plot of direct evidence is
freq |
list. Processed data for frequentist analyses created by |
outcome |
character. Whether the data is |
outcome_measure |
character. Outcome measure of the dataset. |
effects |
character. Whether the models are |
ranking_option |
character. Whether higher values in the data are |
seed |
numeric. A seed value to be passed to models |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) subsetted_data <- setup_exclude(configured_data = configured_data, exclusions = c("Leo", "Minerva"))configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) subsetted_data <- setup_exclude(configured_data = configured_data, exclusions = c("Leo", "Minerva"))
summary_study() plot for use in the
interface for excluding studies. Inside the app this is interactive,
but it can also be rendered for non-interactive use.Produce an version of the summary_study() plot for use in the
interface for excluding studies. Inside the app this is interactive,
but it can also be rendered for non-interactive use.
setup_exclude_plot(configured_data, exclusions = NULL, hover = FALSE)setup_exclude_plot(configured_data, exclusions = NULL, hover = FALSE)
configured_data |
list. Input dataset created by |
exclusions |
character. Vector of excluded studies. Defaults to |
hover |
logical. Whether change the cursor on clickable lines.
Defaults to |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
Load data from a spreadsheet or a default dataset and assess the
data for validity. This checks the column names for required columns and
balanced wide format numbered columns. Data can be in either a long or wide
format; long data has one row per study arm whereas wide data has one row
per study. For continuous outcomes, long data should contain the columns:
Study - an identifier, e.g. author and year, T - treatment,
N - number of participants, Mean - mean value of the outcome,
SD - standard deviation of the outcome. Wide data for continuous outcomes
should contain: Study, N.1, N.2, Mean.1, Mean.2, SD.1, SD.2
where the number refers to the arm of the study and extra columns should be
added depending on the number of arms. For binary outcomes, long data should
contain: Study, T, N (as for continuous data) and R - the number of
participants with the outcome of interest. Wide data for binary outcomes
should follow the same convention: Study, T.1, T.2, R.1, R.2,
N.1, N.2. Additionally, a covar.<name> column can be added to all
formats containing covariate data where <name> should be replaced with
the name of the covariate. For long data, covariate values must be equal
for every study arm. Risk of bias data can also be included with all columns
containing values ranging from 1 (low risk) to 3 (high risk): rob for the
overall risk of bias, indirectness for indirectness and rob.<name> for up
to ten individual components.
setup_load(data_path = NULL, outcome, logger = NULL)setup_load(data_path = NULL, outcome, logger = NULL)
data_path |
character. Path to the file (either a |
outcome |
character. Outcome type for the dataset. Either |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
List containing:
is_data_valid |
logical. Whether the data is valid |
is_data_uploaded |
logical. Whether the data is uploaded |
data |
dataframe. The data that was uploaded or the default data if no data_path was provided |
treatments |
Dataframe of the treatments in the data. |
outcome |
character. Whether the data is |
# load data from a file minimal_data_path <- system.file("extdata", "continuous_minimal.csv", package = "metainsight") loaded_data <- setup_load(data_path = minimal_data_path, outcome = "continuous") # load default data loaded_data <- setup_load(outcome = "binary")# load data from a file minimal_data_path <- system.file("extdata", "continuous_minimal.csv", package = "metainsight") loaded_data <- setup_load(data_path = minimal_data_path, outcome = "continuous") # load default data loaded_data <- setup_load(outcome = "binary")
Loads a .csv file and converts it into a suitable format
for use by setup_load.
setup_upgrade(data_path, treatments, logger = NULL)setup_upgrade(data_path, treatments, logger = NULL)
data_path |
character. Path to the file to be upgraded |
treatments |
character. The treatments in the data separated by commas. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
Dataframe containing the upgraded data
old_data_path <- system.file("extdata", "old_data.csv", package = "metainsight") upgraded_data <- setup_upgrade(data_path = old_data_path, treatments = "A,B,C,D,E")old_data_path <- system.file("extdata", "old_data.csv", package = "metainsight") upgraded_data <- setup_upgrade(data_path = old_data_path, treatments = "A,B,C,D,E")
Produce summaries of network characteristics, treatments and
treatment pairs such as the number of participants and and the mean outcome.
Inspired by BUGSnet::net.tab()
summary_char(configured_data, logger = NULL)summary_char(configured_data, logger = NULL)
configured_data |
list. Input dataset created by |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
List containing:
network |
network characteristics |
treatments |
treatment characteristics |
pairs |
treatment pair characteristics |
netmeta::netgraph()
Produce a plot of the network using netmeta::netgraph()
summary_network( configured_data, style, label_size = 1, title = "", logger = NULL )summary_network( configured_data, style, label_size = 1, title = "", logger = NULL )
configured_data |
list. Input dataset created by |
style |
character. The plot to produce, either |
label_size |
numeric. The size of labels in the plots. Default of |
title |
character. Title of plot. Default of no title. |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) summary_network(configured_data = configured_data, style = "netgraph")configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) summary_network(configured_data = configured_data, style = "netgraph")
Produce a forest plot of pairwise comparisons, grouped by treatment pairs. If risk of bias data was loaded these are also included.
summary_study( configured_data, plot_area_width = 6, colourblind = FALSE, x_min = NULL, x_max = NULL, interactive = FALSE, logger = NULL )summary_study( configured_data, plot_area_width = 6, colourblind = FALSE, x_min = NULL, x_max = NULL, interactive = FALSE, logger = NULL )
configured_data |
list. Input dataset created by |
plot_area_width |
numeric. The width of the plot area containing the
treatment effects in inches. Defaults to |
colourblind |
logical. Whether to use a colourblind-friendly palette. Defaults to |
x_min |
numeric. Minimum value for the x-axis. Defaults to |
x_max |
numeric. Maximum value for the x-axis. Defaults to |
interactive |
logical. Whether the plot should be altered for preparation
into an interactive interface. Defaults to |
logger |
Stores all notification messages to be displayed in the Log
Window. Insert the logger reactive list here for running in
shiny, otherwise leave the default |
html. Contains the svg string to generate the plot. This will display
the plot when at the end of a quarto or rmarkdown chunk. To view in the viewer
panel of Rstudio, use htmltools::browsable(). The output can be saved
using write_plot().
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) summary_study(configured_data = configured_data)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) summary_study(configured_data = configured_data)
Creates trace plots of MCMC samples.
trace_plots(model, parameters)trace_plots(model, parameters)
model |
Model output. |
parameters |
Vector of parameters to create trace plots for. |
List of ggplot trace plots.
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) trace_plots(fitted_bayes_model$mtcResults, mcmc$parameters)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) # n_adapt and n_iter are set low to run quickly, but should be left as the # default values in real use fitted_bayes_model <- bayes_model(configured_data = configured_data, n_adapt = 100, n_iter = 100) mcmc <- bayes_mcmc(model = fitted_bayes_model) trace_plots(fitted_bayes_model$mtcResults, mcmc$parameters)
Write an svg plot to either a png, pdf or svg file.
write_plot(svg, file)write_plot(svg, file)
svg |
html. containing the svg string, returned from |
file |
character. The file to which to write. |
configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) tmp <- tempfile(fileext = ".png") summary_network(configured_data = configured_data, style = "netgraph") |> write_plot(tmp) unlink(tmp)configured_data_path <- system.file("extdata", "configured_data.Rds", package = "metainsight") configured_data <- readRDS(configured_data_path) tmp <- tempfile(fileext = ".png") summary_network(configured_data = configured_data, style = "netgraph") |> write_plot(tmp) unlink(tmp)