Skip to contents

Plot fitted values from MBNMA model


  treat.labs = NULL,
  disp.obs = TRUE,
  n.iter = round(mbnma$BUGSoutput$n.iter/4),
  n.thin = mbnma$BUGSoutput$n.thin,



An S3 object of class "mbnma" generated by running a time-course MBNMA model


A character vector of treatment labels with which to name graph panels. Can use[["treatments"]] with original dataset if in doubt.


A boolean object to indicate whether raw data responses should be plotted as points on the graph


number of total iterations per chain (including burn in; default: 2000)


thinning rate. Must be a positive integer. Set n.thin > 1 to save memory and computation time if n.iter is large. Default is max(1, floor(n.chains * (n.iter-n.burnin) / 1000)) which will only thin if there are at least 2000 simulations.


Arguments to be sent to ggplot2::ggplot()


Generates a plot of fitted values from the MBNMA model and returns a list containing the plot (as an object of class c("gg", "ggplot")), and a data.frame of posterior mean fitted values for each observation.


Fitted values should only be plotted for models that have converged successfully. If fitted values (theta) have not been monitored in mbnma$ then additional iterations will have to be run to get results for these.


# \donttest{
# Make network
painnet <-
#> Reference treatment is `Pl_0`
#> Studies reporting change from baseline automatically identified from the data

mbnma <-,
  fun=temax(pool.emax="rel", method.emax="common",
    pool.et50="abs", method.et50="random"))
#> 'et50' parameters must take positive values.
#>  Default half-normal prior restricts posterior to positive values.
#> Compiling model graph
#>    Resolving undeclared variables
#>    Allocating nodes
#> Graph information:
#>    Observed stochastic nodes: 417
#>    Unobserved stochastic nodes: 194
#>    Total graph size: 8210
#> Initializing model

# Plot fitted values from the model
# Monitor fitted values for 500 additional iterations
fitplot(mbnma, n.iter=500)
#> `theta` not monitored in mbnma$
#> additional iterations will be run in order to obtain results

# }