### Install MBNMAdose from GitHub Source: https://hugaped.github.io/MBNMAdose/index.html Install the development version of the MBNMAdose package directly from GitHub using the devtools R package. Ensure devtools is installed first. ```r # First install devtools install.packages("devtools") # Then install MBNMAdose directly from GitHub devtools::install_github("hugaped/MBNMAdose") ``` -------------------------------- ### Example: Node-splitting with Binomial Likelihood Source: https://hugaped.github.io/MBNMAdose/reference/nma.nodesplit.html Demonstrates how to perform node-splitting on a prepared MBNMA network object using a binomial likelihood and logit link function. This example uses the triptans dataset. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering split <- nma.nodesplit(network, likelihood = "binomial", link="logit", method="common") #> | | | 0% | |=== | 4% | |===== | 8% | |======== | 12% | |=========== | 15% #> | |============= | 19% #> | |================ | 23% | |=================== | 27% | |====================== | 31% | |======================== | 35% | |=========================== | 38% ``` -------------------------------- ### Meta-analyse Placebo Studies (Random Effects) Source: https://hugaped.github.io/MBNMAdose/reference/ref.synth.html This example shows how to meta-analyse placebo studies using random treatment effects. It follows the same setup as the fixed effects example but uses `synth = "random"` in the `ref.synth` function, which also returns the between-study standard deviation for E0. ```R # Meta-analyse placebo studies using random treatment effects E0 <- ref.synth(ref.df, emax, synth="random") #> [1] "Data frame must contain only data from reference treatment" #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 66 #> Unobserved stochastic nodes: 68 #> Total graph size: 1222 #> #> Initializing model #> names(E0) #> [1] "jagsmod" "m.mu" "sd.mu" # } ``` -------------------------------- ### Example: Obtain Model Prior Values with Exponential Function Source: https://hugaped.github.io/MBNMAdose/reference/get.prior.html Shows how to run an MBNMA model using an exponential function and then print the associated prior values. This example also uses the triptans dataset. ```R # Priors when using mbnma.run with an exponential function result <- mbnma.run(network, fun=dexp(), method="random") #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 190 #> Total graph size: 4087 #> #> Initializing model #> print(result$model.arg$priors) #> $mu #> [1] "dnorm(0,0.0001)" #> #> $emax #> [1] "dnorm(0,0.0001)" #> #> $sd #> [1] "dunif(0, 6.021)" #> ``` -------------------------------- ### Example: Obtain Model Prior Values with Emax Function Source: https://hugaped.github.io/MBNMAdose/reference/get.prior.html Demonstrates how to run an Emax dose-response MBNMA model and then print the prior values used. This example uses the triptans dataset. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Run an Emax dose-response MBNMA result <- mbnma.run(network, fun=demax(), method="random") #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 197 #> Total graph size: 4115 #> #> Initializing model #> # Obtain model prior values print(result$model.arg$priors) #> $mu #> [1] "dnorm(0,0.0001)" #> #> $ed50 #> [1] "dnorm(0,0.0001) T(0,)" #> #> $emax #> [1] "dnorm(0,0.0001)" #> #> $sd #> [1] "dunif(0, 6.021)" #> ``` -------------------------------- ### Example output of dloglin() Source: https://hugaped.github.io/MBNMAdose/reference/dloglin.html Demonstrates the structure and components of the object returned by the dloglin() function, including its name, formula, parameters, and JAGS representation. ```r dloglin() #> $name #> [1] "loglin" #> #> $fun #> ~rate * log(dose + 1) #> #> #> $params #> [1] "rate" #> #> $nparam #> [1] 1 #> #> $jags #> [1] "s.beta.1[agent[i,k]] * log(dose[i,k] + 1)" #> #> $apool #> rate #> "rel" #> #> $bname #> rate #> "beta.1" #> #> attr(,"class") #> [1] "dosefun" ``` -------------------------------- ### Example: Performing node-splitting on triptans data Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.nodesplit.html This example demonstrates how to use the `mbnma.nodesplit` function with the triptans dataset to check for consistency. It specifies a dose-response function, likelihood, link function, and method. ```R # Using the triptans data network <- mbnma.network(triptans) split <- mbnma.nodesplit(network, fun=demax(), likelihood = "binomial", link="logit", method="common") ``` -------------------------------- ### Install MBNMAdose from CRAN Source: https://hugaped.github.io/MBNMAdose/index.html Install the current release version of the MBNMAdose package from CRAN. ```r install.packages("MBNMAdose") ``` -------------------------------- ### Example: Rank all predictions from a log-linear dose-response MBNMA Source: https://hugaped.github.io/MBNMAdose/reference/rank.mbnma.predict.html This example demonstrates how to rank all predictions from a fitted log-linear dose-response MBNMA model using the triptans dataset. It includes model fitting, prediction, and ranking. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Rank all predictions from a log-linear dose-response MBNMA loglin <- mbnma.run(network, fun=dloglin()) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 77 #> Total graph size: 3644 #> #> Initializing model #> pred <- predict(loglin, E0 = 0.5) rank <- rank(pred) summary(rank) ``` -------------------------------- ### Example usage of genspline Source: https://hugaped.github.io/MBNMAdose/reference/genspline.html An example demonstrating the basic usage of the genspline function by defining a numeric vector 'x' from 0 to 100. ```R x <- 0:100 ``` -------------------------------- ### Example Usage of norm2lnorm Source: https://hugaped.github.io/MBNMAdose/reference/norm2lnorm.html Demonstrates how to use the norm2lnorm function to obtain log-normal parameters from normal distribution parameters and verifies the equivalence of means and standard deviations. ```R norm <- rnorm(1000, mean=5, sd=2) params <- norm2lnorm(5, 2^2) lnorm <- rlnorm(1000, meanlog=params[1], sdlog=params[2]^0.5) # Mean and SD of lnorm is equivalent to mean and sd of norm mean(lnorm) sd(lnorm) ``` -------------------------------- ### Example Usage of dmulti Source: https://hugaped.github.io/MBNMAdose/reference/dmulti.html Demonstrates how to use the dmulti function by creating a list of various dose-response functions (demax, dloglin, dexp) and passing them to dmulti. The output shows the structure of the combined dosefun object. ```R funs <- c(rep(list(demax()),3), rep(list(dloglin()),2), rep(list(demax(ed50="common")),3), rep(list(dexp()),2)) dmulti(funs) ``` -------------------------------- ### Meta-analyse Placebo Studies (Fixed Effects) Source: https://hugaped.github.io/MBNMAdose/reference/ref.synth.html This example demonstrates how to meta-analyse placebo studies using fixed treatment effects. It first sets up a network, runs an Emax dose-response MBNMA, and then uses the `ref.synth` function with `synth = "fixed"`. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Run an Emax dose-response MBNMA emax <- mbnma.run(network, fun=demax(), method="random") #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 197 #> Total graph size: 4115 #> #> Initializing model #> # Data frame for synthesis can be taken from placebo arms ref.df <- triptans[triptans$agent=="placebo",] # Meta-analyse placebo studies using fixed treatment effects E0 <- ref.synth(ref.df, emax, synth="fixed") #> [1] "Data frame must contain only data from reference treatment" #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 66 #> Unobserved stochastic nodes: 1 #> Total graph size: 1066 #> #> Initializing model #> names(E0) #> [1] "jagsmod" "m.mu" ``` -------------------------------- ### Run Network Meta-Analysis Source: https://hugaped.github.io/MBNMAdose/articles/nma_in_mbnmadose.html Initiates a Network Meta-Analysis using the specified network object and number of iterations. This is the primary function to start the NMA process. ```R nma <- nma.run(network, n.iter = 50000) ``` -------------------------------- ### Example: Dropping studies from a connected network Source: https://hugaped.github.io/MBNMAdose/reference/drop.disconnected.html Demonstrates using drop.disconnected on a fully connected network. In this case, no studies are dropped. ```r network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering drops <- drop.disconnected(network) # No studies have been dropped since network is fully connected length(unique(network$data.ab$studyID))==length(unique(drops$data.ab$studyID)) #> [1] TRUE ``` -------------------------------- ### Calculate pD for Binomial Data Source: https://hugaped.github.io/MBNMAdose/reference/pDcalc.html Example demonstrating how to calculate pD using the plugin method for a binomial likelihood MBNMA model. Ensure that 'psi' and 'resdev' are monitored during model fitting. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Fit a dose-response MBNMA, monitoring "psi" and "resdev" result <- mbnma.run(network, fun=dloglin(), method="random", parameters.to.save=c("psi", "resdev")) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 190 #> Total graph size: 4074 #> #> Initializing model #> #### Calculate pD for binomial data #### # Prepare data for pD calculation r <- result$model$data()$r n <- result$model$data()$n narm <- result$model$data()$narm NS <- result$model$data()$NS psi <- result$BUGSoutput$median$psi resdevs <- result$BUGSoutput$median$resdev # Calculate pD via plugin method pD <- pDcalc(obs1=r, obs2=n, narm=narm, NS=NS, theta.result=psi, resdev.result=resdevs, likelihood="binomial", type="dose") # } ``` -------------------------------- ### Run MBNMA with Tighter SD Priors Source: https://hugaped.github.io/MBNMAdose/articles/runmbnmadose-2.html Modify prior distributions for MBNMA models by providing a list of replacements to the 'priors' argument in mbnma.run(). This example tightens the precision for half-normal SD parameters. ```r # Define replacement prior new.priors <- list(sd = "dnorm(0, 1) T(0,)") # Run an MBNMA model with new priors emax <- mbnma.run(alognet, fun = demax(), method = "random", priors = new.priors) ``` -------------------------------- ### Example: Keeping studies connecting via dose-response Source: https://hugaped.github.io/MBNMAdose/reference/drop.disconnected.html Shows how setting connect.dose to TRUE retains studies that connect through dose-response relationships, preventing them from being dropped. ```r # Studies are not dropped if they connect via the dose-response function drops <- drop.disconnected(net.noplac, connect.dose=TRUE) length(unique(net.noplac$data.ab$studyID))==length(unique(drops$data.ab$studyID)) #> [1] TRUE ``` -------------------------------- ### Comparing MBNMA and NMA Models with get.relative Source: https://hugaped.github.io/MBNMAdose/reference/get.relative.html This example shows how to compare relative effects between an MBNMA model ('lower.diag') and an NMA model ('upper.diag'). It also customizes the direction of effect presentation for the upper-right diagonal. ```R # Run an NMA model nma <- nma.run(network, method="random") #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 74 #> Unobserved stochastic nodes: 100 #> Total graph size: 1077 #> #> Initializing model #> # Compare results between MBNMA and NMA models rel.eff <- get.relative(lower.diag=expon, upper.diag=nma, treatments=list("Celebrex"=c(100,200), "Tramadol"=100), upper.direction="colvrow") ``` -------------------------------- ### Run MBNMA with Emax Dose-Response and Common Effects Source: https://hugaped.github.io/MBNMAdose/articles/runmbnmadose-2.html This example demonstrates running an MBNMA model using the triptans dataset. It specifies an Emax dose-response function and common treatment effects, pooling relative effects for Emax and ED50 parameters separately for each agent. ```r mbnma.run(triptans, fun = 'emax', method = 'common', dose.units = 'mg', traits = c('age', 'sex'), class.effect = 'random', class.effect.sd = 'random', dose.response = c('emax' = 'rel', 'ed50' = 'rel')) ``` -------------------------------- ### Fit model with agent-specific dose-response functions Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.run.html Fit a model where each agent has a different dose-response function. This example defines a list of functions for multiple agents, including placebo, eletriptan, sumatriptan, frovatriptan, almotriptan, zolmitriptan, naratriptan, and rizatriptan. ```r multifun <- dmulti(list(dloglin(), # for placebo (can be any function) demax(), # for eletriptan demax(), # for sumatriptan dloglin(), # for frovatriptan demax(), # for almotriptan demax(), # for zolmitriptan dloglin(), # for naratriptan demax())) # for rizatriptan multidose <- mbnma.run(network, fun=multifun) ``` -------------------------------- ### Fit Piecewise Linear B-spline with Quantile Knots and Mixed Beta Pooling Source: https://hugaped.github.io/MBNMAdose/reference/dspline.html Example of fitting a piecewise linear B-spline with knots at specified quantiles. Demonstrates mixed beta pooling, with the first coefficient having random effects and subsequent coefficients having relative effects. ```r dspline(type="bs", degree=1, knots=c(0.1,0.5), betas=c("random", "rel", "rel")) ``` -------------------------------- ### Compare residual deviance contributions from linear and Emax models Source: https://hugaped.github.io/MBNMAdose/reference/devdev.html This example demonstrates comparing the residual deviance contributions between a linear and an Emax dose-response model using the devdev function. It suggests that the model fits are significantly different. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Run an poorly fitting linear dose-response lin <- mbnma.run(network, fun=dpoly(degree=1)) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 77 #> Total graph size: 3630 #> #> Initializing model #> # Run a better fitting Emax dose-response emax <- mbnma.run(network, fun=demax()) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 84 #> Total graph size: 3684 #> #> Initializing model #> # Run a standard NMA with unrelated mean effects (UME) ume <- nma.run(network, UME=TRUE) #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 323 #> Total graph size: 3641 #> #> Initializing model #> # Compare residual deviance contributions from linear and Emax devdev(lin, emax) # Suggests model fit is very different #> `resdev` not monitored in mod1$parameters.to.save. #> additional iterations will be run in order to obtain results for `resdev` #> `resdev` not monitored in mod2$parameters.to.save. #> additional iterations will be run in order to obtain results for `resdev` ``` -------------------------------- ### Linear Model with Relative Effects Source: https://hugaped.github.io/MBNMAdose/reference/dpoly.html Example of a linear polynomial dose-response model where the first coefficient (beta.1) uses relative effects. This is a common starting point for dose-response modeling. ```r # Linear model with random effects dpoly(beta.1="rel") #> $name #> [1] "poly" #> #> $fun #> ~beta.1 * dose #> #> #> $params #> [1] "beta.1" #> #> $nparam #> [1] 1 #> #> $jags #> [1] "s.beta.1[agent[i,k]] * dose[i,k]" #> #> $apool #> beta.1 #> "rel" #> #> $bname #> beta.1 #> "beta.1" #> #> attr(,"class") #> [1] "dosefun" ``` -------------------------------- ### Prepare Network Data Source: https://hugaped.github.io/MBNMAdose/articles/dataexploration-1.html Initializes a network object from the gout dataset. Use this to begin network analysis. ```r goutnet <- mbnma.network(gout) summary(goutnet) ``` -------------------------------- ### get.prior() Source: https://hugaped.github.io/MBNMAdose/reference/index.html Get current priors from JAGS model code. ```APIDOC ## get.prior() ### Description Retrieves current priors from JAGS model code. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` get.prior() ``` ### Response None explicitly documented. ``` -------------------------------- ### Prepare and Check Network Consistency Source: https://hugaped.github.io/MBNMAdose/articles/consistencychecking-3.html Prepares the MBNMA network and identifies comparisons where node-splitting is possible. Use this to understand potential inconsistencies in the data. ```r psoriasis$r <- psoriasis$r75 psorinet <- mbnma.network(psoriasis) # Identify comparisons on which node-splitting is possible splitcomps <- inconsistency.loops(psorinet$data.ab, incldr = TRUE) print(splitcomps) ``` -------------------------------- ### mbnma.run() Source: https://hugaped.github.io/MBNMAdose/reference/index.html Run MBNMA dose-response models. ```APIDOC ## mbnma.run() ### Description Runs MBNMA dose-response models. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` mbnma.run() ``` ### Response None explicitly documented. ``` -------------------------------- ### Emax Model Without Hill Parameter Source: https://hugaped.github.io/MBNMAdose/reference/demax.html Example of specifying an Emax dose-response model without a Hill parameter, where Emax is relative and ED50 is common. ```R demax(emax="rel", ed50="common") #> $name #> [1] "emax" #> #> $fun #> ~(emax * dose)/(ed50 + dose) #> #> #> $p.expon #> [1] FALSE #> #> $params #> [1] "emax" "ed50" #> #> $nparam #> [1] 2 #> #> $jags #> [1] "(s.beta.1[agent[i,k]] * dose[i,k]) / (s.beta.2[agent[i,k]] + dose[i,k])" #> #> $apool #> emax ed50 #> "rel" "common" #> #> $bname #> emax ed50 #> "beta.1" "beta.2" #> #> attr(,"class") #> [1] "dosefun" ``` -------------------------------- ### print(__) Source: https://hugaped.github.io/MBNMAdose/reference/index.html Print mbnma.network information to the console. ```APIDOC ## print(__) ### Description Prints the information contained within an `mbnma.network` object to the console. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` print(network_object) ``` ### Response None explicitly documented. ``` -------------------------------- ### Initialize MBNMA Network with Triptans Data Source: https://hugaped.github.io/MBNMAdose/reference/predict.mbnma.html Initializes an MBNMA network using the triptans dataset. This step is typically performed before fitting or predicting with MBNMA models. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering ``` -------------------------------- ### mbnma.network() Source: https://hugaped.github.io/MBNMAdose/reference/index.html Create an mbnma.network object. ```APIDOC ## mbnma.network() ### Description Creates an `mbnma.network` object. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` mbnma.network() ``` ### Response None explicitly documented. ``` -------------------------------- ### Fit Natural Cubic Spline with 1 Knot Source: https://hugaped.github.io/MBNMAdose/reference/dspline.html Example of fitting a natural cubic spline with a single internal knot and relative effects for all beta parameters. ```r dspline(type="bs", knots=1, betas="rel") ``` -------------------------------- ### Monitor Theta in MBNMA Model Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.update.html Example of using mbnma.update to monitor the 'theta' parameter (fitted values) after fitting a dose-response MBNMA model using the triptans dataset. ```R # Using the triptans data network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering # Fit a dose-response MBNMA, monitoring "psi" and "resdev" result <- mbnma.run(network, fun=dloglin(), method="random", parameters.to.save=c("psi", "resdev")) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 190 #> Total graph size: 4074 #> #> Initializing model #> mbnma.update(result, param="theta") # monitor theta ``` -------------------------------- ### Prepare Data for MBNMA Network Source: https://hugaped.github.io/MBNMAdose/articles/runmbnmadose-2.html Initialize the MBNMA network using the triptans dataset. This step recodes agents with dose=0 to 'Placebo' and enforces sequential numbering for agents. ```r tripnet <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering ``` -------------------------------- ### Example: Dropping studies connecting only via dose-response Source: https://hugaped.github.io/MBNMAdose/reference/drop.disconnected.html Illustrates dropping studies when connect.dose is FALSE, meaning studies that only connect through dose-response functions are removed. This results in studies being dropped. ```r noplac.df <- network$data.ab[network$data.ab$narm>2 & network$data.ab$agent!=1,] net.noplac <- mbnma.network(noplac.df) #> agent is being recoded to enforce sequential numbering # Studies are dropped as some only connect via the dose-response function drops <- drop.disconnected(net.noplac, connect.dose=FALSE) length(unique(net.noplac$data.ab$studyID))==length(unique(drops$data.ab$studyID)) #> [1] FALSE ``` -------------------------------- ### Emax Model With Hill Parameter Source: https://hugaped.github.io/MBNMAdose/reference/demax.html Example of specifying an Emax dose-response model including a Hill parameter, with Emax, ED50, and Hill parameters set to relative or common pooling. ```R demax(hill="common") #> $name #> [1] "emax" #> #> $fun #> ~(emax * (dose^hill))/((ed50^hill) + (dose^hill)) #> #> #> $p.expon #> [1] FALSE #> #> $params #> [1] "emax" "ed50" "hill" #> #> $nparam #> [1] 3 #> #> $jags #> [1] "(s.beta.1[agent[i,k]] * (dose[i,k] ^ s.beta.3[agent[i,k]])) / ((s.beta.2[agent[i,k]] ^ s.beta.3[agent[i,k]]) + (dose[i,k] ^ s.beta.3[agent[i,k]])) #> #> $apool #> emax ed50 hill #> "rel" "rel" "common" #> #> $bname #> emax ed50 hill #> "beta.1" "beta.2" "beta.3" #> #> attr(,"class") #> [1] "dosefun" ``` -------------------------------- ### Prepare Data and Draw Network Plot Source: https://hugaped.github.io/MBNMAdose/articles/dataexploration-1.html Prepare data using `mbnma.network()` and then visualize the network structure with `plot()`. The plot shows study connections and treatment comparisons. ```R # Prepare data using the triptans dataset tripnet <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering summary(tripnet) #> Description: Network #> Number of studies: 70 #> Number of treatments: 23 #> Number of agents: 8 #> Median (min, max) doses per agent (incl placebo): 4 (3, 6) #> Agent-level network is CONNECTED #> #> Treatment-level network is CONNECTED #> # Draw network plot plot(tripnet) ``` -------------------------------- ### Print mbnma.network Object Source: https://hugaped.github.io/MBNMAdose/reference/print.mbnma.network.html This is the S3 method for printing objects of class 'mbnma.network'. It displays information about the network object to the console. No specific setup is required beyond having an object of this class. ```R # S3 method for class 'mbnma.network' print(x, ...) ``` -------------------------------- ### Quadratic Model with Mixed Pooling Source: https://hugaped.github.io/MBNMAdose/reference/dpoly.html Example of a quadratic polynomial dose-response model. It uses relative effects for the first coefficient (beta.1) and an exchangeable (random) effect for the second coefficient (beta.2). ```r # Quadratic model dose-response function # with an exchangeable (random) absolute parameter estimated for the 2nd coefficient dpoly(beta.1="rel", beta.2="random") #> $name #> [1] "poly" #> #> $fun #> ~beta.1 * dose #> #> #> $params #> [1] "beta.1" #> #> $nparam #> [1] 1 #> #> $jags #> [1] "s.beta.1[agent[i,k]] * dose[i,k]" #> #> $apool #> beta.1 #> "rel" #> #> $bname #> beta.1 #> "beta.1" #> #> attr(,"class") #> [1] "dosefun" ``` -------------------------------- ### nma.run() Source: https://hugaped.github.io/MBNMAdose/reference/index.html Run an NMA model. ```APIDOC ## nma.run() ### Description Runs a Network Meta-Analysis (NMA) model. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` nma.run() ``` ### Response None explicitly documented. ``` -------------------------------- ### Compare deviance contributions from Emax and UME models Source: https://hugaped.github.io/MBNMAdose/reference/devdev.html This example compares the deviance contributions between an Emax model and an unrelated mean effects (UME) model, suggesting that their model fits are similar. ```R # Compare deviance contributions from Emax and UME devdev(emax, ume) # Suggests model fit is similar #> `resdev` not monitored in mod1$parameters.to.save. #> additional iterations will be run in order to obtain results for `resdev` #> `resdev` not monitored in mod2$parameters.to.save. #> additional iterations will be run in order to obtain results for `resdev` ``` -------------------------------- ### Create Network Object Source: https://hugaped.github.io/MBNMAdose/articles/metaregression-6.html Initializes a network object from regression data. This is a prerequisite for running MBNMA models. ```r ssrinet <- mbnma.network(ssri.reg) ``` -------------------------------- ### Default MBNMA JAGS Code Generation Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.write.html Generates default JAGS code for a polynomial dose-response model with common relative effects. This is a starting point for creating custom MBNMA models. ```R mbnma.write( fun = dpoly(degree = 1), method = "common", regress.mat = NULL, regress.effect = "common", sdscale = FALSE, cor = FALSE, cor.prior = "wishart", omega = NULL, om = list(rel = 5, abs = 10), class.effect = list(), UME = FALSE, likelihood = "binomial", link = NULL ) ``` -------------------------------- ### Calculate Relative Treatment Comparisons Source: https://hugaped.github.io/MBNMAdose/articles/outputs-4.html Calculates relative treatment comparisons using MBNMA models. Ensure the 'mbnma' package is installed and loaded. The output provides log-odds ratios with credible intervals. ```r inconsistency <- get.relative(lower.diag = trip.emax, upper.diag = ume, treatments = treats, eform = FALSE) print(inconsistency) ``` -------------------------------- ### Load and Prepare Data for NMA Source: https://hugaped.github.io/MBNMAdose/articles/nma_in_mbnmadose.html Loads the Dong2013 dataset from the netmeta package and renames columns to match MBNMAdose requirements. ```R library(netmeta) #> Loading required package: meta #> Loading required package: metabook #> Loading 'meta' package (version 8.5-0). #> Type 'help(meta)' for a brief overview. #> Loading 'netmeta' package (version 3.6-1). #> Type 'help("netmeta-package")' for a brief overview. data("Dong2013") # Rename column names to match those used in MBNMAdose Dong2013 <- Dong2013 %>% rename(studyID = id, r = death, n = randomized) ``` -------------------------------- ### Load Psoriasis75 Dataset Source: https://hugaped.github.io/MBNMAdose/reference/psoriasis75.html This snippet shows how to load the psoriasis75 dataset. Ensure the dataset is available in your environment. ```R psoriasis75 ``` -------------------------------- ### Forest Plots with Class Effects Source: https://hugaped.github.io/MBNMAdose/reference/plot.mbnma.html Generates forest plots for MBNMA models that include class effects. This example demonstrates setting up classes and running an Emax model with common class effects for 'ed50'. ```R #### Forest plots including class effects #### # Generate some classes for the data class.df <- triptans class.df$class <- ifelse(class.df$agent=="placebo", "placebo", "active1") class.df$class <- ifelse(class.df$agent=="eletriptan", "active2", class.df$class) netclass <- mbnma.network(class.df) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering #> Values for `class` with dose = 0 have been recoded to `Placebo` #> class is being recoded to enforce sequential numbering emax <- mbnma.run(netclass, fun=demax(), method="random", class.effect=list("ed50"="common")) #> `likelihood` not given by user - set to `binomial` based on data provided #> `link` not given by user - set to `logit` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 182 #> Unobserved stochastic nodes: 192 #> Total graph size: 4108 #> #> Initializing model #> # } ``` -------------------------------- ### MBNMA Model Relative Effects Calculation Source: https://hugaped.github.io/MBNMAdose/reference/get.relative.html This example demonstrates calculating relative effects for an MBNMA model. It specifies the MBNMA model object and a list of treatments to compare. The results are stored in the 'rel.eff' object. ```R # Using the osteoarthritis data network <- mbnma.network(osteopain) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering #> Values for `class` with dose = 0 have been recoded to `Placebo` #> class is being recoded to enforce sequential numbering # Run an MBNMA model expon <- mbnma.run(network, fun=dexp(), method="random") #> `likelihood` not given by user - set to `normal` based on data provided #> `link` not given by user - set to `identity` based on assigned value for `likelihood` #> Compiling model graph #> Resolving undeclared variables #> Allocating nodes #> Graph information: #> Observed stochastic nodes: 74 #> Unobserved stochastic nodes: 83 #> Total graph size: 1126 #> #> Initializing model #> # Calculate relative effects for MBNMA between: # Celebrex 100mg/d, Celebrex 200mg/d, Tramadol 100mg/d rel.eff <- get.relative(lower.diag=expon, treatments=list("Celebrex"=c(100,200), "Tramadol"=100)) ``` -------------------------------- ### print(__) Source: https://hugaped.github.io/MBNMAdose/reference/index.html Prints summary information about an mbnma.rank object. ```APIDOC ## print(__) ### Description Prints summary information pertaining to an `mbnma.rank` object. ### Method Not applicable (function call) ### Endpoint Not applicable (function call) ### Parameters None explicitly documented. ### Request Example ``` print(ranking_object) ``` ### Response None explicitly documented. ``` -------------------------------- ### Initialize Network Meta-Analysis Node Split Source: https://hugaped.github.io/MBNMAdose/reference/nma.nodesplit.html Use this function to initialize a node split analysis for a network meta-analysis. Specify the network object, likelihood function, link function, estimation method, and the comparisons to be made. This is typically used for binomial data with a logit link and random-effects model. ```R single.split <- nma.nodesplit(network, likelihood = "binomial", link="logit", method="random", comparisons=rbind(c(6, 12))) ``` -------------------------------- ### Run Random Effects NMA and UME Models Source: https://hugaped.github.io/MBNMAdose/articles/consistencychecking-3.html Initializes an MBNMA network and runs both a standard random-effects NMA model and a random-effects UME model for comparison. ```r alognet <- mbnma.network(alog_pcfb) nma <- nma.run(alognet, method = "random") ume <- nma.run(alognet, method = "random", UME = TRUE) ``` -------------------------------- ### Plot with Smoother Predicted Responses Source: https://hugaped.github.io/MBNMAdose/reference/plot.mbnma.predict.html Generates a plot of predicted dose-response curves with a higher number of estimated doses for a smoother curve. This example demonstrates how to increase smoothness by adjusting the `n.doses` argument in the `predict` function. ```R # If insufficient predictions are made across dose-response function # then the plotted responses are less smooth and can be misleading pred <- predict(emax, E0 = 0.5, n.doses=3) plot(pred) ``` -------------------------------- ### Generate JAGS Model Code for Class Effects Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.write.html Use mbnma.write to generate JAGS code for a dose-response model. This example models class effects on ED50 with common effects, suitable for a normal likelihood and identity link. ```R model <- mbnma.write( fun=demax(), likelihood="normal", link="identity", class.effect=list("ed50"="common") ) ``` ```text names(model) <- NULL print(model) ``` ```jagsc model{ # Begin Model Code s.beta.2[1] <- 0.00001 s.beta.1[1] <- 0 for(i in 1:NS){ # Run through all NS trials delta[i,1] <- 0 mu[i] ~ dnorm(0,0.0001) for (k in 1:narm[i]){ # Run through all arms within a study resdev[i,k] <- pow((y[i,k] - psi[i,k]),2) * prec[i,k] # residual deviance for normal likelihood y[i,k] ~ dnorm(psi[i,k], prec[i,k]) prec[i,k] <- pow(se[i,k], -2) psi[i,k] <- theta[i,k] theta[i,k] <- mu[i] + delta[i,k] DR[i,k] <- ((s.beta.1[agent[i,k]] * dose[i,k]) / (s.beta.2[agent[i,k]] + dose[i,k])) - ((s.beta.1[agent[i,1]] * dose[i,1]) / (s.beta.2[agent[i,1]] + dose[i,1])) } resstudydev[i] <- sum(resdev[i, 1:narm[i]]) for(k in 2:narm[i]){ # Treatment effects delta[i,k] <- DR[i,k] } } for (k in 2:Nagent){ # Priors on relative agent effects ed50[k] <- ED50[class[k]] s.beta.2[k] <- ed50[k] emax[k] ~ dnorm(0,0.0001) s.beta.1[k] <- emax[k] } for (k in 2:Nclass){ # Priors on relative class effects ED50[k] ~ dnorm(0,0.0001) T(0,) } ``` -------------------------------- ### Create Network Object from Triptans Dataset Source: https://hugaped.github.io/MBNMAdose/articles/dataexploration-1.html Use `mbnma.network()` to prepare the triptans dataset for MBNMAdose. This function checks data integrity and creates a network object. ```R # Using the triptans dataset network <- mbnma.network(triptans) #> Values for `agent` with dose = 0 have been recoded to `Placebo` #> agent is being recoded to enforce sequential numbering summary(network) #> Description: Network #> Number of studies: 70 #> Number of treatments: 23 #> Number of agents: 8 #> Median (min, max) doses per agent (incl placebo): 4 (3, 6) #> Agent-level network is CONNECTED #> #> Treatment-level network is CONNECTED #> ``` -------------------------------- ### Fit model with natural cubic splines Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.run.html Fit a dose-response model using natural cubic splines with 3 knots placed at the 10%, 30%, and 60% quartiles of the dose range. This example uses the sSRI depression dataset. ```r depnet <- mbnma.network(ssri) result <- mbnma.run(depnet, fun=dspline(type="ns", knots=c(0.1,0.3,0.6))) ``` -------------------------------- ### Create and Plot Network Without Placebo Data Source: https://hugaped.github.io/MBNMAdose/reference/mbnma.network.html Demonstrates creating and plotting a network that excludes placebo data. This is useful for analyzing networks where placebo comparisons are not relevant or available. ```R noplac.df <- network$data.ab[network$data.ab$narm>2 & network$data.ab$agent!=1,] net.noplac <- mbnma.network(noplac.df) #> agent is being recoded to enforce sequential numbering plot(net.noplac) #> Warning: The following treatments/agents are not connected #> to the network reference: #> 4_1 #> 4_2 ``` -------------------------------- ### Define 2nd Order Fractional Polynomial Source: https://hugaped.github.io/MBNMAdose/reference/dfpoly.html Constructs a 2nd-order fractional polynomial dose-response function. This example uses relative effects for both coefficients and specifies fractional powers of -0.5 and 2. This allows for more complex, non-linear dose-response curves. ```R dfpoly(degree=2, beta.1="rel", beta.2="rel", power.1=-0.5, power.2=2) ```