### **Module:** ***Bayes deviance***

#### Residual deviance

These scatter plots represent each data point's contribution to the residual deviance for the
NMA with consistency (horizontal axis) and the unrelated mean effect (ume) inconsistency models
(vertical axis) along with the line of equality. The points on the equality line means there is no
improvement in model fit when using the inconsistency model, suggesting that there is no evidence of inconsistency.
Points above the equality line means they have a smaller residual deviance for the consistency model indicating a
better fit in the NMA consistency model and points below the equality line
means they have a better fit in the ume inconsistency model. Please note that the unrelated mean effects model
may not handle multi-arm trials correctly.

#### Per-arm residual deviance

These stem plots represent the posterior residual deviance per study arm. The total number of stems equals
the total number of data points in the network meta analysis. Going from left to right, the alternating symbols
on the stems indicate the different studies. Each stem corresponds to the residual deviance ($dev.ab) associated with each
arm in each study. The smaller residual deviance (the shorter stem), dev.ab, the better model fit for each
data point. You can identify which stem corresponds to which study arm by hovering on the stem symbols.

#### Leverage 
These plots show the average leverage across the arms for each study ({sum($lev.ab)}/{number of arms}
for each study) versus the square root of the average residual deviance across the arms for each study
(sqrt({sum($dev.ab)}/{number of arms}) for each study).
The leverage for each data point, is calculated as the posterior mean of the residual
deviance, minus the deviance at the posterior mean of the fitted values. The leverage plot may be used to
identify influential and/or poorly fitting studies and can be used to check how each study is affecting
the overall model fit and DIC. Curves of the form x2 + y = c, c = 1, 2, 3, ., where x represents square root
of residual deviance, and y represents the leverage, are marked on the plot. Points lying on such parabolas
each contribute an amount c to the DIC (Spiegelhalter et al., 2002). Points that lie outside the line with
c = 3 can generally be identified as contributing to the model's poor fit. Points with a high leverage are
influential, which means that they have a strong influence on the model parameters that generate their fitted
values.

**REFERENCES**

* Dias S, Ades AE, Welton NJ, Jansen JP, Sutton AJ. Network meta-analysis for decision-making. Chapter 3 Model fit, model comparison and outlier detection. @2018 John Wiley & Sons Ltd.
* Spiegelhalter et al. (2002) Bayesian measures of model complexity and fit. J. R. Statist. Soc.B 64, Part4,  pp.583-639)
