SpindleCompare() draws side-by-side spindles comparing the marginal log likelihoods of paired models. Each spindle shows the distribution of log Bayes factors between the two models across datasets, with colours indicating which model is favoured. Areas of non-material difference (where absolute log Bayes factors are smaller than the propagated standard error) are shown in semitransparent “ghost” shading.

SpindleCompare(
  modelA,
  modelB,
  marginals,
  stdErr,
  nBin = 14,
  width = 1,
  xlab = "",
  ...
)

Arguments

modelA

Character vector naming the first set of models to compare.

modelB

Character vector naming the second set of models to compare; must be the same length as modelA.

marginals

Matrix of marginal log-likelihoods, with models as rows and datasets as columns.

stdErr

Matrix of standard errors corresponding to marginals.

nBin

Integer giving the number of histogram bins to use for each spindle (default 20).

width

Numeric scaling factor for the maximum spindle width (default 1).

xlab

Character label for the x-axis (default "Model comparison").

...

Additional graphical parameters passed to plot().

Value

SpindleCompare() returns a matrix whose rows correspond to the entries in modelA and whose columns count:

  • better: the number of times modelA outperforms modelB;

  • worse: the number of times modelA is outperformed by modelB;

  • n: the number of datasets compared, after removing NAs. The function is called for its side-effect of producing a comparative spindle plot.

Details

Each spindle is constructed from the histogram of Bayes factors \(bf = marginals[modelA[i], ] - marginals[modelB[i], ]\). Bars where \(|bf| < .DiffErr(stdErr[modelA[i], ], stdErr[modelB[i], ])\) are shown in semitransparent colour; other bars are fully opaque. Positive values (favouring modelA) are coloured by ModelCol(modelA), and negative values (favouring modelB) by ModelCol(modelB).