Advanced workflow: dependence, evidence, agreement and ordinal outcomes

Correlated continuous changes

Let \(D_i=(D_{i1},D_{i2})^T\) be independent between subjects with a bivariate Gaussian distribution, mean \(\mu=(\beta,\beta+\gamma)^T\) and covariance \(\Sigma\). Raters within subjects need not be independent. The four models restrict \(\Sigma\) to a common independent variance (M0), unequal independent variances (M1), a common variance with correlation (M2), or an unrestricted positive-definite covariance (M3).

S <- matrix(c(1, 0.65, 0.65, 1.5), 2)
scenario <- bivariate_scenario(N = 12, beta = 0.6, gamma = 0.2,
                               covariance = S)
dat <- simulate_bivariate(scenario, seed = 22, format = "long")
head(dat, 8)
#>   id time rater          y
#> 1  1  pre    r1 0.00000000
#> 2  1  pre    r2 0.00000000
#> 3  1 post    r1 0.08786091
#> 4  1 post    r2 1.23839299
#> 5  2  pre    r1 0.00000000
#> 6  2  pre    r2 0.00000000
#> 7  2 post    r1 3.08518368
#> 8  2 post    r2 2.32815209
fit_model_id <- function(model) {
  fit_bivariate(dat, id, time, rater, y, model = model,
                time_order = c("pre", "post"),
                rater_order = c("r1", "r2"))
}
f3 <- fit_model_id("M3")
f3$sample_cov
#>           r1        r2
#> r1 0.9434430 0.8992972
#> r2 0.8992972 1.9512648

The simulated baseline is zero by construction because the target is paired change. It is not a simulation of four raw scores with realistic baseline structure.

Posterior inference and the role of priors

Reference priors are improper: flat on the mean vector and proportional to the inverse free variance(s) in M0–M2, or \(|\Sigma|^{-3/2}\) in M3. They are model-specific choices and are not universally optimal. M3 requires positive-definite scatter and at least three subjects. A Student distribution can exist without a finite posterior mean or variance.

ref <- posterior_bivariate(f3, prior = "reference")
contrast_bivariate(ref, "reference")
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: reference
#> Target: posterior
#> Contrast: reference
#> Method: Analytical Student
#> Degrees of freedom: 10.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>     1     0 
#> 
#> Median: 0.943
#> Mean: 0.943
#> Standard deviation: 0.329
#> 95% credible interval: [0.287, 1.598]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.995
#> Pr(contrast < 0): 0.005
contrast_bivariate(ref, "discrepancy")
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: reference
#> Target: posterior
#> Contrast: discrepancy
#> Method: Analytical Student
#> Degrees of freedom: 10.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>     0     1 
#> 
#> Median: -0.022
#> Mean: -0.022
#> Standard deviation: 0.354
#> 95% credible interval: [-0.728, 0.685]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.473
#> Pr(contrast < 0): 0.527

Proper priors permit regularisation and evidence. The following settings are hypothetical prior judgements on the units of the artificial data, not recommended defaults. kappa is relative mean precision and shape controls variance concentration. The covariance argument is the prior expected covariance. Choose these quantities before inspecting the outcomes when evidence is the goal. The same prior location and covariance expectation do not imply identical prior laws across covariance models.

prior <- bivariate_prior(location = c(0, 0), kappa = 0.5,
                         shape = 3, covariance = diag(2))
post <- posterior_bivariate(f3, prior)
contrast_bivariate(post, "reference", threshold = 0.3)
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: proper
#> Target: posterior
#> Contrast: reference
#> Method: Analytical Student
#> Degrees of freedom: 18.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>     1     0 
#> 
#> Median: 0.905
#> Mean: 0.905
#> Standard deviation: 0.272
#> 95% credible interval: [0.366, 1.444]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.999
#> Pr(contrast < 0): 0.001
#> 
#> Practical relevance
#> -------------------
#> Threshold: 0.300
#> Pr(contrast > threshold): 0.985
#> Pr(contrast < -threshold): 0.000
#> Pr(abs(contrast) > threshold): 0.985
contrast_bivariate(post, "average", rope = c(-0.2, 0.2))
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: proper
#> Target: posterior
#> Contrast: average
#> Method: Analytical Student
#> Degrees of freedom: 18.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>   1.0   0.5 
#> 
#> Median: 0.895
#> Mean: 0.895
#> Standard deviation: 0.277
#> 95% credible interval: [0.346, 1.443]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.999
#> Pr(contrast < 0): 0.001
#> 
#> Region of practical equivalence
#> -------------------------------
#> Bounds: [-0.200, 0.200]
#> Pr(contrast within bounds): 0.008
contrast_bivariate(post, "weighted", weight = 0.25)
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: proper
#> Target: posterior
#> Contrast: weighted
#> Method: Analytical Student
#> Degrees of freedom: 18.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>  1.00  0.25 
#> 
#> Median: 0.900
#> Mean: 0.900
#> Standard deviation: 0.263
#> 95% credible interval: [0.379, 1.420]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.999
#> Pr(contrast < 0): 0.001
contrast_bivariate(post, "discrepancy", target = "predictive")
#> 
#> babebi Bayesian contrast
#> ------------------------
#> Model: M3
#> Prior: proper
#> Target: predictive
#> Contrast: discrepancy
#> Method: Analytical Student
#> Degrees of freedom: 18.000
#> 
#> Contrast coefficients
#> ---------------------
#>  beta gamma 
#>     0     1 
#> 
#> Median: -0.021
#> Mean: -0.021
#> Standard deviation: 1.164
#> 95% predictive interval: [-2.326, 2.284]
#> 
#> Directional probabilities
#> -------------------------
#> Pr(contrast > 0): 0.493
#> Pr(contrast < 0): 0.507

weight is the second-rater weight. The posterior contrast concerns a population mean; the predictive contrast concerns a new subject. They answer different questions. Under M0 and M3, contrasts have univariate Student distributions. M1 and M2 can require convolution of independent Student components. draw_bivariate() provides independent joint posterior draws, useful for functions of parameters not covered by the analytical contrast interface.

head(draw_bivariate(post, n_draws = 1000, seed = 23, predictive = TRUE))
#>         mu1       mu2      beta       gamma sigma1_sq sigma2_sq   sigma12
#> 1 0.8067514 0.7487448 0.8067514 -0.05800663 0.7762537  1.777487 0.6152300
#> 2 0.7115622 0.4194411 0.7115622 -0.29212117 0.9560443  2.018502 0.6766468
#> 3 1.3733557 1.4008245 1.3733557  0.02746884 0.9821990  3.908077 1.2140736
#> 4 0.8845669 1.2846734 0.8845669  0.40010647 0.6076196  1.620966 0.3605542
#> 5 0.8759590 1.1777603 0.8759590  0.30180136 0.5954553  1.335535 0.5071882
#> 6 0.8676449 1.2060216 0.8676449  0.33837668 1.0360755  3.899404 1.3049220
#>         rho     d1_new    d2_new
#> 1 0.5237602  0.3817443 1.0567286
#> 2 0.4870891 -1.0007639 0.8455128
#> 3 0.6196746  1.5505915 1.9767685
#> 4 0.3633019  0.5836119 1.8997301
#> 5 0.5687441  1.3072040 1.1216194
#> 6 0.6492167  0.1302193 2.6709002

Evidence and sensitivity

bayesfactor_bivariate(post, "reference", null = 0)
#> $model
#> [1] "M3"
#> 
#> $contrast
#> [1] "reference"
#> 
#> $coefficients
#>  beta gamma 
#>     1     0 
#> 
#> $hypothesis
#> [1] "point"
#> 
#> $null
#> [1] 0
#> 
#> $bounds
#> NULL
#> 
#> $H1
#> [1] "Unrestricted continuous contrast"
#> 
#> $H0
#> [1] "Contrast = 0"
#> 
#> $prior_method
#> [1] "student"
#> 
#> $posterior_method
#> [1] "student"
#> 
#> $prior_log_density
#> [1] -1.104259
#> 
#> $posterior_log_density
#> [1] -4.565976
#> 
#> $prior_probability
#> [1] NA
#> 
#> $posterior_probability
#> [1] NA
#> 
#> $log_prior_probability
#> [1] NA
#> 
#> $log_posterior_probability
#> [1] NA
#> 
#> $log_prior_complement
#> [1] NA
#> 
#> $log_posterior_complement
#> [1] NA
#> 
#> $log_bf10
#> [1] 3.461716
#> 
#> $log_bf01
#> [1] -3.461716
#> 
#> $bf10
#> [1] 31.87164
#> 
#> $bf01
#> [1] 0.03137586
#> 
#> $rel_tol
#> [1] 1e-08
#> 
#> $subdivisions
#> [1] 1000
bayesfactor_bivariate(post, "discrepancy", null = 0)
#> $model
#> [1] "M3"
#> 
#> $contrast
#> [1] "discrepancy"
#> 
#> $coefficients
#>  beta gamma 
#>     0     1 
#> 
#> $hypothesis
#> [1] "point"
#> 
#> $null
#> [1] 0
#> 
#> $bounds
#> NULL
#> 
#> $H1
#> [1] "Unrestricted continuous contrast"
#> 
#> $H0
#> [1] "Contrast = 0"
#> 
#> $prior_method
#> [1] "student"
#> 
#> $posterior_method
#> [1] "student"
#> 
#> $prior_log_density
#> [1] -1.450833
#> 
#> $posterior_log_density
#> [1] 0.2733745
#> 
#> $prior_probability
#> [1] NA
#> 
#> $posterior_probability
#> [1] NA
#> 
#> $log_prior_probability
#> [1] NA
#> 
#> $log_posterior_probability
#> [1] NA
#> 
#> $log_prior_complement
#> [1] NA
#> 
#> $log_posterior_complement
#> [1] NA
#> 
#> $log_bf10
#> [1] -1.724207
#> 
#> $log_bf01
#> [1] 1.724207
#> 
#> $bf10
#> [1] 0.1783143
#> 
#> $bf01
#> [1] 5.608074
#> 
#> $rel_tol
#> [1] 1e-08
#> 
#> $subdivisions
#> [1] 1000
bayesfactor_bivariate(post, "discrepancy", hypothesis = "interval",
                      bounds = c(-0.2, 0.2))
#> $model
#> [1] "M3"
#> 
#> $contrast
#> [1] "discrepancy"
#> 
#> $coefficients
#>  beta gamma 
#>     0     1 
#> 
#> $hypothesis
#> [1] "interval"
#> 
#> $null
#> NULL
#> 
#> $bounds
#> [1] -0.2  0.2
#> 
#> $H1
#> [1] "-0.2 < contrast < 0.2"
#> 
#> $H0
#> [1] "Contrast outside the specified interval"
#> 
#> $prior_method
#> [1] "student"
#> 
#> $posterior_method
#> [1] "student"
#> 
#> $prior_log_density
#> [1] NA
#> 
#> $posterior_log_density
#> [1] NA
#> 
#> $prior_probability
#> [1] 0.09347748
#> 
#> $posterior_probability
#> [1] 0.4875108
#> 
#> $log_prior_probability
#> [1] -2.370035
#> 
#> $log_posterior_probability
#> [1] -0.7184428
#> 
#> $log_prior_complement
#> [1] -0.09813941
#> 
#> $log_posterior_complement
#> [1] -0.6684757
#> 
#> $log_bf10
#> [1] 2.221928
#> 
#> $log_bf01
#> [1] -2.221928
#> 
#> $bf10
#> [1] 9.225101
#> 
#> $bf01
#> [1] 0.1083999
#> 
#> $rel_tol
#> [1] 1e-08
#> 
#> $subdivisions
#> [1] 1000
prior_wide <- bivariate_prior(c(0, 0), kappa = 0.1,
                             shape = 3, covariance = 2 * diag(2))
sensitivity_bivariate(f3, list(initial = prior, wider = prior_wide),
                      contrast = "reference", null = 0)
#>   scenario log_marginal log_marginal_difference log_bf10  log_bf01      bf10
#> 1  initial    -40.27072                0.000000 3.461716 -3.461716 31.871636
#> 2    wider    -41.53109               -1.260373 1.745411 -1.745411  5.728258
#>         bf01 prior_probability posterior_probability
#> 1 0.03137586                NA                    NA
#> 2 0.17457315                NA                    NA

BF10 is evidence for H1 relative to H0. For a point null, the nuisance prior under H0 is the conditional prior induced by the encompassing prior; changing this definition changes the BF. Directional and interval hypotheses use posterior odds divided by prior odds. The interval hypothesis above treats practical equivalence as H1. The reference prior cannot be used for ordinary marginal likelihoods or these Bayes factors.

models <- c("M0", "M1", "M2", "M3")
posts <- lapply(models, function(m) posterior_bivariate(fit_model_id(m), prior))
compare_bivariate(posts, reference = "M0",
                  model_prior = c(M0 = 1, M1 = 1, M2 = 1, M3 = 1))
#>   model reference log_marginal      log_bf        bf prior_probability
#> 1    M0      TRUE    -42.33036  0.00000000 1.0000000              0.25
#> 2    M1     FALSE    -42.34748 -0.01711453 0.9830311              0.25
#> 3    M2     FALSE    -40.36683  1.96353363 7.1244579              0.25
#> 4    M3     FALSE    -40.27072  2.05964343 7.8431727              0.25
#>   posterior_probability
#> 1            0.05899475
#> 2            0.05799367
#> 3            0.42030559
#> 4            0.46270599

Equal model weights here are illustrative. Evidence depends on model-specific prior distributions. Do not select a covariance structure solely on a BF or a non-significant test of correlation; consider substantive plausibility and sensitivity.

Agreement on change

Let \(A_i=D_{i2}-D_{i1}\). Its population mean is \(\gamma\), and variance is \(\Sigma_{11}+\Sigma_{22}-2\Sigma_{12}\). A zero mean can coexist with substantial individual disagreement.

ag <- agreement_bivariate(post, margin = 0.5, min_coverage = 0.8,
                          n_draws = 2000, seed = 24)
print(ag)
#> 
#> babebi Bayesian agreement analysis
#> ---------------------------------
#> Model: M3
#> N: 12
#> Prior: proper
#> Discrepancy: r2 - r1
#> Posterior draws: 2000
#> 
#> Descriptive agreement
#> ---------------------
#> Mean discrepancy: -0.022
#> Discrepancy SD: 1.047
#> 95% descriptive limits of agreement: [-2.074, 2.030]
#> 
#> Posterior summaries (95% credible intervals)
#> --------------------------------------------
#>  parameter median  lower  upper      method
#>      gamma -0.021 -0.648  0.606     student
#>   variance  1.157  0.636  2.437  analytical
#>         sd  1.076  0.798  1.561  analytical
#>  loa_lower -2.107 -3.245 -1.395 monte_carlo
#>  loa_upper  2.094  1.305  3.277 monte_carlo
#>   coverage  0.346  0.237  0.460 monte_carlo
#> Expected discrepancy variance: 1.254
#> 
#> Posterior predictive agreement
#> ------------------------------
#> 95% predictive interval: [-2.326, 2.284]
#> 
#> Practical agreement
#> -------------------
#> Margin: +/- 0.500
#> Pr(mean discrepancy within margin): 0.888
#> Pr(new subject discrepancy within margin): 0.346
#> Pr(population limits within margin): 0.000 (MCSE 0.000)
#> Pr(population coverage >= 0.800): 0.000 (MCSE 0.000)
ag$practical
#> $mean_equivalence
#> [1] 0.8879742
#> 
#> $predictive_probability
#> [1] 0.3459418
#> 
#> $coverage_mean_mc
#> [1] 0.3464864
#> 
#> $coverage_mean_mcse
#> [1] 0.001271399
#> 
#> $prob_coverage_at_least
#> [1] 0
#> 
#> $mcse_coverage_at_least
#> [1] 0
#> 
#> $prob_limits_within_margin
#> [1] 0
#> 
#> $mcse_limits_within_margin
#> [1] 0

The margin of 0.5 is illustrative. Mean equivalence is \(P(|\gamma|\leq 0.5\mid data)\). Individual predictive agreement is \(P(|A_{new}|\leq 0.5\mid data)\). A population-level criterion instead concerns the posterior probability that conditional population coverage exceeds 0.8. Population limits of agreement, uncertainty intervals for those limits, and predictive intervals are distinct. These summaries concern observed change and do not separate true change from measurement error.

Compare methods on the same simulated data

methods <- list(legacy = "legacy", paired_t = "paired_t",
                exact_M0 = list(model = "M0", prior = "reference"),
                exact_M3 = list(model = "M3", prior = "reference"),
                proper_M3 = list(model = "M3", prior = prior))
val <- validate_bivariate(scenario, methods, contrast = "reference",
                          R = 20, n_draws = 1000, seed = 25)
subset(summarise_validation(val), metric %in% c("bias", "rmse", "coverage"))
#>        method   metric     estimate       mcse n_used n_total mcse_method
#> 1      legacy     bias  0.008195955 0.07031020     20      20   empirical
#> 3      legacy coverage  0.950000000 0.04873397     20      20   bernoulli
#> 34     legacy     rmse  0.306584634 0.03786923     20      20       delta
#> 37   paired_t     bias  0.008195955 0.07031020     20      20   empirical
#> 39   paired_t coverage  1.000000000 0.00000000     20      20   bernoulli
#> 70   paired_t     rmse  0.306584634 0.03786923     20      20       delta
#> 73   exact_M0     bias  0.008195955 0.07031020     20      20   empirical
#> 75   exact_M0 coverage  0.950000000 0.04873397     20      20   bernoulli
#> 106  exact_M0     rmse  0.306584634 0.03786923     20      20       delta
#> 109  exact_M3     bias  0.008195955 0.07031020     20      20   empirical
#> 111  exact_M3 coverage  1.000000000 0.00000000     20      20   bernoulli
#> 142  exact_M3     rmse  0.306584634 0.03786923     20      20       delta
#> 145 proper_M3     bias -0.016131883 0.06749779     20      20   empirical
#> 147 proper_M3 coverage  0.950000000 0.04873397     20      20   bernoulli
#> 178 proper_M3     rmse  0.294657984 0.03546683     20      20       delta
compare_validation(val, "exact_M3", "legacy", metric = "mse")
#>   method_a method_b metric     mean_a     mean_b   difference         mcse
#> 1 exact_M3   legacy    mse 0.09399414 0.09399414 9.888601e-18 2.408518e-17
#>   n_pairs n_total mcse_method
#> 1      20      20   empirical

The paired-t benchmark applies a one-sample Student interval to the subject-level contrast. M0 exact versus legacy isolates the normal approximation under M0; M3 addresses dependence and heterogeneity. The number of repetitions above is a demonstration only. Report failure rates, the number of usable repetitions and MCSE alongside coverage and error. Bias and coverage depend on the specified generative mechanism and cannot validate a particular empirical effect.

empirical <- scenario_from_fit(f3)
empirical$location
#>        r1        r2 
#> 0.9427319 0.9210930
empirical$covariance
#>           r1        r2
#> r1 0.9434430 0.8992972
#> r2 0.8992972 1.9512648
heavy <- bivariate_scenario(12, 0.6, 0.2, S,
                            distribution = "student", df = 5)
scenario_truth(heavy, "discrepancy", margin = 0.5)
#> $contrast
#> [1] "discrepancy"
#> 
#> $coefficients
#>  beta gamma 
#>     0     1 
#> 
#> $value
#> [1] 0.2
#> 
#> $contrast_variance
#> [1] 1.2
#> 
#> $gamma
#> [1] 0.2
#> 
#> $disagreement_variance
#> [1] 1.2
#> 
#> $content
#> [1] 0.95
#> 
#> $limits
#>     lower     upper 
#> -1.981211  2.381211 
#> 
#> $margin
#> [1] 0.5
#> 
#> $agreement_probability
#> [1] 0.4074776

Empirical calibration uses the observed means and unrestricted sample covariance; the fitted values are treated as fixed. Explicit ridge regularisation changes the target covariance. The Student mechanism uses the actual covariance, not the scale matrix. A scientific evaluation should vary sample size, effect, covariance, tails and prior specification (ADEMP; Morris et al., 2019). For a specified proper prior, SBC evaluates prior-predictive rank behaviour, not fixed-parameter coverage or model adequacy.

sbc <- sbc_bivariate(N = 8, model = "M3", prior = prior,
                     contrast = "reference", R = 20,
                     n_draws = 100, bins = 5, seed = 26)
names(sbc)
#>  [1] "model"        "prior"        "N"            "R"            "n_draws"     
#>  [6] "bins"         "seed"         "coefficients" "replicates"   "histograms"  
#> [11] "n_success"    "n_failed"

Twenty repetitions cannot support a calibration conclusion; use substantially larger studies for that purpose.

Ordinal outcomes

The cumulative probit model assumes \(Z_{itj}=\alpha+\delta I(j=2)+\beta I(t=post)+\gamma I(t=post,j=2)+b_{it}+e_{itj}\), with bivariate Gaussian occasion effects \((b_{i,pre}, b_{i,post})\) and independent standard normal residuals. Observed categories are defined by common ordered thresholds; the first threshold is zero and residual variance is fixed to one. The covariance of the occasion effects does not allow every possible residual dependence structure. Threshold invariance is an assumption, not a tested result. The latent effects are not numeric rating-score changes.

ord <- simulate_ordinal(N = 20, coefficients = c(-0.3, 0.1, 0.5, 0.2),
                        random_covariance = matrix(c(0.5, 0.2, 0.2, 0.6), 2),
                        cutpoints = c(0, 1),
                        category_order = c("low", "middle", "high"), seed = 27)
op <- ordinal_prior(coefficient_mean = rep(0, 4), coefficient_sd = rep(1, 4),
                    random_df = 6, random_covariance = 0.5 * diag(2),
                    cutpoint_mean = 1, cutpoint_sd = 0.5)

The following code is executable, but is not run during vignette building to keep package checks tractable. It is not a claim that the example chains converge. Use model-wide and contrast-specific diagnostics; if they are inadequate, investigate the model and sampling before reporting estimates. Increasing draws alone may not resolve poor mixing.

of <- fit_ordinal(ord, id, time, rater, y,
                  category_order = c("low", "middle", "high"),
                  time_order = c("pre", "post"), rater_order = c("r1", "r2"),
                  prior = op, chains = 4, warmup = 1000, draws = 2000, seed = 28)
ordinal_diagnostics(of)
oc <- contrast_ordinal(of, "reference")
oc$diagnostics
if (all(ordinal_diagnostics(of)$adequate) && isTRUE(oc$diagnostics$adequate)) {
  print(oc)
  print(predict_ordinal(of))
}

The predictive summary integrates over subject occasion effects and describes marginal category probabilities and changes in cumulative exceedance. It does not identify individual transitions. For repeated-sampling evaluation use validate_ordinal() with specified generative parameters and proper priors, and report diagnostic failures as well as statistical performance.

References

Albert, J. H., & Chib, S. (1993). Bayesian analysis of binary and polychotomous response data. Journal of the American Statistical Association, 88(422), 669–679. https://doi.org/10.1080/01621459.1993.10476321

Bland, J. M., & Altman, D. G. (1986). Statistical methods for assessing agreement between two methods of clinical measurement. The Lancet, 327(8476), 307–310. https://doi.org/10.1016/S0140-6736(86)90837-8

Morris, T. P., White, I. R., & Crowther, M. J. (2019). Using simulation studies to evaluate statistical methods. Statistics in Medicine, 38(11), 2074–2102. https://doi.org/10.1002/sim.8086

Talts, S., Betancourt, M., Simpson, D., Vehtari, A., & Gelman, A. (2018). Validating Bayesian inference algorithms with simulation-based calibration. arXiv. https://arxiv.org/abs/1804.06788

Vehtari, A., Gelman, A., Simpson, D., Carpenter, B., & Bürkner, P.-C. (2021). Rank-normalization, folding, and localization: An improved R-hat for assessing convergence of MCMC (with discussion). Bayesian Analysis, 16(2), 667–718. https://doi.org/10.1214/20-BA1221