# Multiple linear regression

``` python
%config InlineBackend.figure_format = "retina"
%config InlineBackend.print_figure_kwargs = {'bbox_inches': None}

import arviz as az
import bambi as bmb
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import statsmodels.api as sm
import xarray as xr

plt.style.use("bambi.mplstyle")
seed = sum(map(ord, "ESCS linear regression"))
rng = np.random.default_rng(seed)
```

## Load and examine Eugene-Springfield community sample data

Bambi comes with several datasets. These can be accessed via the [load_data()](../reference/load_data.md) function.

``` python
data = bmb.load_data("ESCS")
data.describe().round(2)
```

|  | drugs | n | e | o | a | c | hones | emoti | extra | agree | consc | openn |
|----|----|----|----|----|----|----|----|----|----|----|----|----|
| count | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 | 604.00 |
| mean | 2.21 | 80.04 | 106.52 | 113.87 | 124.63 | 124.23 | 3.89 | 3.18 | 3.21 | 3.13 | 3.57 | 3.41 |
| std | 0.65 | 23.21 | 19.88 | 21.12 | 16.67 | 18.69 | 0.45 | 0.46 | 0.53 | 0.47 | 0.44 | 0.52 |
| min | 1.00 | 23.00 | 42.00 | 51.00 | 63.00 | 44.00 | 2.56 | 1.47 | 1.62 | 1.59 | 2.00 | 1.28 |
| 25% | 1.71 | 65.75 | 93.00 | 101.00 | 115.00 | 113.00 | 3.59 | 2.88 | 2.84 | 2.84 | 3.31 | 3.06 |
| 50% | 2.14 | 76.00 | 107.00 | 112.00 | 126.00 | 125.00 | 3.88 | 3.19 | 3.22 | 3.16 | 3.56 | 3.44 |
| 75% | 2.64 | 93.00 | 120.00 | 129.00 | 136.00 | 136.00 | 4.20 | 3.47 | 3.56 | 3.44 | 3.84 | 3.75 |
| max | 4.29 | 163.00 | 158.00 | 174.00 | 171.00 | 180.00 | 4.94 | 4.62 | 4.75 | 4.44 | 4.75 | 4.72 |

It's always a good idea to start off with some basic plotting. Here's what our outcome variable `drugs` (some index of self-reported illegal drug use) looks like:

``` python
fig, ax = plt.subplots()
ax.hist(data["drugs"], density=True)
ax.set(xlabel="Drug use index")
```

![](ESCS_multiple_regression_files/figure-html/cell-4-output-1.png)

The five numerical predictors that we'll use are sum-scores measuring participants' standings on the Big Five personality dimensions. The dimensions are:

- O = Openness to experience
- C = Conscientiousness
- E = Extraversion
- A = Agreeableness
- N = Neuroticism

Here's what our predictors look like:

``` python
data[["o", "c", "e", "a", "n"]].to_xarray()
```

![](data:image/svg+xml;base64,PHN2ZyBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB3aWR0aDogMDsgaGVpZ2h0OiAwOyBvdmVyZmxvdzogaGlkZGVuIj4KPGRlZnM+CjxzeW1ib2wgaWQ9Imljb24tZGF0YWJhc2UiIHZpZXdib3g9IjAgMCAzMiAzMiI+CjxwYXRoIGQ9Ik0xNiAwYy04LjgzNyAwLTE2IDIuMjM5LTE2IDV2NGMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di00YzAtMi43NjEtNy4xNjMtNS0xNi01eiIgLz4KPHBhdGggZD0iTTE2IDE3Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPHBhdGggZD0iTTE2IDI2Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9Imljb24tZmlsZS10ZXh0MiIgdmlld2JveD0iMCAwIDMyIDMyIj4KPHBhdGggZD0iTTI4LjY4MSA3LjE1OWMtMC42OTQtMC45NDctMS42NjItMi4wNTMtMi43MjQtMy4xMTZzLTIuMTY5LTIuMDMwLTMuMTE2LTIuNzI0Yy0xLjYxMi0xLjE4Mi0yLjM5My0xLjMxOS0yLjg0MS0xLjMxOWgtMTUuNWMtMS4zNzggMC0yLjUgMS4xMjEtMi41IDIuNXYyN2MwIDEuMzc4IDEuMTIyIDIuNSAyLjUgMi41aDIzYzEuMzc4IDAgMi41LTEuMTIyIDIuNS0yLjV2LTE5LjVjMC0wLjQ0OC0wLjEzNy0xLjIzLTEuMzE5LTIuODQxek0yNC41NDMgNS40NTdjMC45NTkgMC45NTkgMS43MTIgMS44MjUgMi4yNjggMi41NDNoLTQuODExdi00LjgxMWMwLjcxOCAwLjU1NiAxLjU4NCAxLjMwOSAyLjU0MyAyLjI2OHpNMjggMjkuNWMwIDAuMjcxLTAuMjI5IDAuNS0wLjUgMC41aC0yM2MtMC4yNzEgMC0wLjUtMC4yMjktMC41LTAuNXYtMjdjMC0wLjI3MSAwLjIyOS0wLjUgMC41LTAuNSAwIDAgMTUuNDk5LTAgMTUuNSAwdjdjMCAwLjU1MiAwLjQ0OCAxIDEgMWg3djE5LjV6IiAvPgo8cGF0aCBkPSJNMjMgMjZoLTE0Yy0wLjU1MiAwLTEtMC40NDgtMS0xczAuNDQ4LTEgMS0xaDE0YzAuNTUyIDAgMSAwLjQ0OCAxIDFzLTAuNDQ4IDEtMSAxeiIgLz4KPHBhdGggZD0iTTIzIDIyaC0xNGMtMC41NTIgMC0xLTAuNDQ4LTEtMXMwLjQ0OC0xIDEtMWgxNGMwLjU1MiAwIDEgMC40NDggMSAxcy0wLjQ0OCAxLTEgMXoiIC8+CjxwYXRoIGQ9Ik0yMyAxOGgtMTRjLTAuNTUyIDAtMS0wLjQ0OC0xLTFzMC40NDgtMSAxLTFoMTRjMC41NTIgMCAxIDAuNDQ4IDEgMXMtMC40NDggMS0xIDF6IiAvPgo8L3N5bWJvbD4KPC9kZWZzPgo8L3N2Zz4=)

``` xr-text-repr-fallback
<xarray.Dataset> Size: 29kB
Dimensions:  (index: 604)
Coordinates:
  * index    (index) int64 5kB 0 1 2 3 4 5 6 7 ... 597 598 599 600 601 602 603
Data variables:
    o        (index) int64 5kB 122 142 117 130 100 150 ... 151 95 134 97 174 105
    c        (index) int64 5kB 89 132 173 134 130 145 ... 130 136 110 124 102
    e        (index) int64 5kB 102 92 101 99 116 130 ... 153 132 128 112 158 98
    a        (index) int64 5kB 115 140 148 135 117 97 ... 149 159 132 155 126
    n        (index) int64 5kB 117 69 69 87 50 62 69 ... 67 100 93 69 133 33 121
```

xarray.Dataset

Dimensions:

- index: 604

Coordinates: (1)

index

(index)

int64

0 1 2 3 4 5 ... 599 600 601 602 603

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    [604 values with dtype=int64]

Data variables: (5)

o

(index)

int64

122 142 117 130 ... 134 97 174 105

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([122, 142, 117, 130, 100, 150, 105,  92, 129,  85, 111,  92, 111,
           152,  82, 120,  73, 115, 114, 116,  98, 107, 102, 115, 101, 107,
           127, 108,  90, 123, 106,  92, 131,  96,  83, 122, 128, 114, 114,
           140,  65, 109, 138,  84, 142, 100, 127, 124, 121, 131, 103,  89,
            82, 174, 110, 131, 111, 111, 115, 129, 146, 124, 117,  86, 112,
           110, 129, 107, 142, 124,  99, 122, 141, 107, 140, 144, 108, 126,
           122, 127, 116, 121, 137, 125, 106, 137, 100,  84, 110, 138, 114,
           107, 124,  92,  78, 124, 103, 123,  78,  90, 103, 122,  92, 127,
           137,  97, 109, 108, 103,  89, 144, 136, 161, 111, 109, 119,  80,
           102, 115, 119, 119, 131,  74, 112,  78, 104, 115,  82, 166, 138,
           106, 106, 118, 111, 113,  88, 117, 157, 130, 108, 114, 104, 110,
           123, 120, 102, 105, 107, 106, 137, 124, 131, 103,  77, 139, 122,
            87, 111, 111,  95, 105, 114, 137, 131, 146, 142, 130,  90, 108,
           114, 109, 105, 109, 139, 136,  92, 140, 101, 145,  98, 132, 114,
           136,  76, 118, 114, 120, 122, 112, 157, 113, 132,  96,  95, 130,
           120, 103, 105,  84, 101, 107, 106, 102,  96, 117, 108, 138, 101,
            54, 104,  92, 132, 159,  97,  99, 141, 116, 110, 101, 119, 128,
           115, 125, 143, 121, 115, 137, 117, 125,  97, 114, 114, 105,  95,
           104,  92, 100,  91, 105, 136,  64,  79,  96,  83, 120, 110,  98,
            80,  64, 108, 131, 141,  51, 103,  98, 100, 109, 129,  52,  88,
    ...
           114, 142, 103, 125, 108,  81, 103,  91, 101, 128,  88, 137, 111,
           159, 112, 105, 159, 134,  73, 110, 132, 106, 140,  78,  89, 120,
           110, 115,  91, 127, 145, 133, 127,  97,  99, 135, 135, 146,  94,
           157, 123,  95, 159, 129, 108, 129, 131, 121, 116, 126, 107, 135,
           135, 120, 117, 109, 135, 111, 116, 127, 137, 124, 127, 117,  72,
           139, 112, 117, 131,  99, 138,  80, 132, 103,  98, 129,  93,  73,
           165, 135, 105, 122, 120, 133, 110, 107, 132, 124, 138,  91, 156,
           113, 111, 134, 108, 104,  74, 126, 116, 125, 116,  91,  99,  94,
            84,  70, 109,  93,  90, 146, 131, 132, 139, 104, 120, 124, 108,
           126, 108, 151,  75, 102, 110, 115, 131,  59, 106, 141, 110, 118,
           107, 123, 154,  98,  93, 107, 135, 118, 131, 131, 122, 137, 128,
            77, 126,  78,  95, 100, 106, 138, 131, 109, 122, 150, 111, 162,
           154,  93,  97, 122, 111,  73, 133, 112, 119, 119, 124,  92, 156,
           126, 106, 145, 133, 104,  88, 101,  91, 134, 117, 161, 123, 102,
           122,  99, 126, 109, 132, 114,  87, 106, 132, 151, 104,  89,  94,
           110, 137, 114, 104, 105, 108, 146, 106, 113, 147, 104, 142, 152,
           111, 119, 108, 105, 133, 100,  94, 113, 102, 112, 104, 101,  94,
            96, 129, 129, 130, 142,  84, 140,  93, 134,  81,  91, 100, 152,
           143, 127, 112, 122, 128, 135, 123,  86, 104, 161, 125, 129, 163,
           151,  95, 134,  97, 174, 105])

c

(index)

int64

89 132 173 134 ... 136 110 124 102

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([ 89, 132, 173, 134, 130, 145, 129, 125, 137, 108,  84, 112, 125,
            97, 154, 101, 127, 117, 114, 111, 128, 139, 154, 129, 120, 111,
            91, 112, 137, 152, 133, 108, 122, 130, 141, 137, 121, 109, 116,
           131, 146, 145, 112, 123, 106, 155, 103, 123, 149,  96, 151, 126,
           126, 133, 131, 114, 122, 129, 144, 101, 141, 127, 144, 120, 123,
           124, 145, 151, 130, 129, 143, 145, 128, 108, 114, 129, 110, 105,
           135,  91, 136, 113, 128, 125, 124,  91, 125, 143, 123, 163, 124,
           121, 124, 112, 119, 122, 134, 115, 155, 140, 130, 155, 149, 122,
           114, 119, 127, 145, 158, 111, 127, 160, 136, 118, 129, 127, 154,
           115, 109, 116, 141, 128, 123, 126, 135, 157, 126, 128, 118,  97,
           136, 104, 130, 137, 141, 131, 121,  97, 133,  67, 112,  91, 128,
           140, 135,  93, 119, 130, 139, 112, 157, 138, 125, 103, 138, 125,
           135, 136, 111, 111, 146, 119, 130, 111, 143, 123, 141,  91, 160,
           153,  97, 130, 126, 117,  99, 116, 125, 130, 118, 139, 113, 102,
           132, 133, 102, 140, 107, 120, 139, 158, 127, 130, 121, 104, 125,
           130,  89, 132,  97, 110, 124,  97, 140, 106, 122, 140, 132,  97,
           121, 109, 158, 109,  98, 127, 151, 104, 120, 117, 126, 161, 137,
           122, 155, 108, 131, 115, 133, 159, 118, 120, 131, 148, 127, 152,
           133, 115, 108, 123, 123, 109,  78,  92, 156, 123, 137, 104, 131,
           156, 135, 143,  96, 127, 136,  99, 127, 130, 126, 142, 155, 117,
    ...
           119, 164, 108, 125, 113, 163, 151, 127, 121, 100, 122, 101, 117,
           101, 125, 127, 180, 140, 155, 146, 107, 125, 125, 136, 126, 121,
           117, 140, 129, 124, 119, 145, 132, 129, 136, 113, 120,  95, 144,
           115, 123, 158, 126, 133, 119, 121, 129,  44, 133, 128, 113,  93,
            81, 121, 156, 116, 132, 111, 159, 127, 145, 119, 142, 141, 131,
           136, 134, 118,  94,  99, 114, 147,  76, 130, 149, 153, 126, 141,
           137, 115, 168, 133, 115, 103, 131, 122, 132, 119, 108, 117, 124,
           112, 122, 136, 129,  85, 156, 142, 118, 123, 131, 114, 122, 141,
           130, 125, 122, 107, 131, 107, 120, 129, 121, 128, 105, 119, 107,
           100, 127, 132, 127, 112, 150, 132, 146, 154, 139, 120, 130, 102,
           105, 144, 111, 132, 146, 136, 109, 148, 103, 121, 118, 128,  95,
           148, 134, 120, 118, 106, 119, 136,  75, 124, 100, 131,  86, 122,
           113, 115, 129, 114, 115, 151, 140, 143, 136, 152, 102, 116, 112,
           133, 131, 107,  86,  93, 129,  73, 115, 148, 152, 114,  81,  83,
           134, 137, 130, 136, 137, 148, 129, 155, 118,  97, 134, 104, 125,
           132, 109, 126, 134, 120, 123, 130, 125, 117, 136, 142, 136,  73,
           129, 119, 106, 141, 135, 131, 145, 120, 119, 121, 108, 107, 100,
            98, 149, 172, 136, 101, 109,  51, 144, 113, 129,  92,  90, 123,
           116, 150, 125, 113, 122, 110, 124,  92,  70, 136, 131, 103, 145,
           132, 130, 136, 110, 124, 102])

e

(index)

int64

102 92 101 99 ... 128 112 158 98

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([102,  92, 101,  99, 116, 130, 121,  99, 123, 103, 103,  99, 106,
           122, 101, 107,  82,  93, 132, 135,  99, 117, 138,  99, 149,  93,
            87,  77,  92, 123, 103,  95, 105,  94, 117,  90, 123,  98,  65,
           136,  83, 119, 123,  88,  88, 123,  78, 110, 129, 101, 124, 105,
            86, 143, 110, 102, 103,  86, 126,  83, 144, 106, 111,  61, 107,
           110, 121, 103, 115, 124, 109, 122, 101,  93, 104, 115,  88,  90,
           113, 138, 125,  90, 132, 117,  94,  62, 120,  77,  65, 150, 117,
            99, 112,  79,  93, 112, 124,  97,  82, 103, 109,  75, 111, 108,
           105,  71, 110, 109, 125,  86, 133, 103,  63,  96, 109,  91, 109,
           133,  57, 127,  92,  92,  76, 114,  96, 140,  90,  82, 111, 125,
            79,  96, 144, 109,  94,  80, 114, 116, 100,  84,  70,  91, 111,
           125, 136, 102, 136, 103, 108,  94, 101, 118, 122,  89, 134, 103,
            62, 136, 102, 109, 106, 104, 126,  93, 112, 129,  99,  52, 108,
           105,  96, 119, 107, 133, 104, 124, 109, 105,  96, 128, 125, 113,
           113,  87,  81, 126, 107, 121, 143, 134, 119, 123,  92,  79, 127,
           100,  72,  92, 114,  96,  95, 108,  96, 115, 113, 130, 138, 121,
           116, 119,  87,  79, 109, 122, 133, 118, 126, 120, 105, 126, 123,
            94, 117, 130, 105, 129, 104, 120, 107, 102,  90,  90,  84, 135,
            97, 113, 116, 130,  80,  94,  62, 158,  94,  91, 108, 106, 114,
           104,  76, 114,  93, 135, 105,  70, 102, 104, 125,  93, 128,  90,
    ...
            79, 155,  94, 129, 134, 118,  92, 107, 103, 108, 141,  76, 129,
           105, 130, 100, 100,  89,  92, 105, 114, 105, 116,  91,  52, 123,
           106, 113,  97, 118,  74, 121, 130, 117,  86, 113, 129,  95, 128,
           115,  92, 143, 134, 126, 111, 113, 119, 135, 119, 113,  99,  70,
            92, 119,  79, 120, 102, 115, 128, 116, 120,  97,  92,  94, 105,
           100, 105, 111, 109,  91,  70,  50, 120,  82,  84, 121, 123,  87,
            98, 115, 116, 114, 109, 102, 122,  98, 120, 119, 126,  83, 141,
           105,  78,  92, 114, 114, 109, 115, 122, 134, 122, 107,  84, 108,
            78,  82, 113,  87, 120, 135, 126, 140,  79, 102,  74, 116,  99,
           129,  92, 117,  92,  79,  98, 114, 101,  93,  83, 127, 123,  85,
           117, 101, 101, 109, 138, 105,  89, 119, 134, 124, 139, 115,  91,
           110,  99,  86,  79, 109,  48, 134,  42,  76, 150, 137,  92, 123,
           111,  69, 106, 101,  78,  88,  95,  75, 128,  98,  98,  83, 130,
           116, 112, 104, 107,  63,  77, 104, 103, 126, 112, 106,  94,  59,
           117,  98, 109, 114, 148, 134, 114, 107, 106, 120,  61,  93,  96,
            98, 110, 105, 107,  89,  75, 120,  89,  84,  96, 119,  87,  98,
           102,  92, 127,  98, 114, 112,  75, 113,  80, 102,  92,  86,  63,
            94,  94, 129, 114,  90,  70, 100,  89,  94,  80,  81,  96, 150,
           120, 114, 114, 114, 121, 120, 148,  88, 109, 145, 114, 121, 128,
           153, 132, 128, 112, 158,  98])

a

(index)

int64

115 140 148 135 ... 159 132 155 126

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([115, 140, 148, 135, 117,  97, 128, 134, 124, 145,  97, 132, 108,
           115, 138, 109, 125, 126, 124, 119, 131,  98, 106, 137, 127, 122,
           124, 122, 132,  95, 138, 121,  80, 118,  93, 123, 106, 119, 119,
            69, 127, 134, 121, 101, 132, 129, 107,  90, 141, 138, 134,  99,
            98,  92, 103,  97, 143, 118, 122, 133, 116, 119, 126, 112, 116,
           127, 145, 100, 133, 110, 133, 123, 100, 113, 112, 101, 124, 129,
           110, 146, 113, 125, 117, 129, 149, 124, 142, 136, 131, 136, 114,
           111, 120, 126, 122, 125, 129, 122, 138, 147, 118,  74, 106, 115,
           114,  85, 142, 129, 134, 120, 132, 148, 141, 111, 112, 141, 130,
           111, 115,  97, 127, 126, 117, 153,  96, 105, 118, 123, 108, 107,
           126,  95, 149,  84, 122, 132,  93, 139, 144, 111, 109,  97, 130,
           119, 162, 122, 125, 122, 121, 143, 143, 134, 128, 136, 125,  94,
           130, 128, 157, 103, 136, 125, 117, 137, 147, 110, 107, 140, 125,
            93, 132, 144, 136, 145, 100,  93, 100, 139,  85, 131, 123, 133,
           129, 127, 121, 133, 120, 121, 107, 124, 117,  99, 124, 111, 109,
           131, 127, 131,  99, 115, 130, 138, 130, 121, 119, 127, 133, 121,
           137,  89, 101, 106, 124, 130, 105, 140, 149, 122, 128, 144, 108,
           146, 151, 134, 119, 112, 127,  92, 118, 124, 115,  87, 143, 119,
           125, 143, 112, 112, 140, 126, 101, 110, 147, 155, 147, 143, 106,
            96, 144, 115, 140, 106, 103, 139, 123, 134, 134, 123, 125, 128,
    ...
           130, 124, 116, 122, 121, 147, 127, 119,  86, 129, 152, 119, 127,
           153, 133, 123, 143, 133, 137, 129, 129, 145, 131, 171, 139, 124,
           143, 145, 137, 113, 135, 133, 134, 150, 147, 125, 139, 122, 135,
           128,  90, 140, 130, 121, 124, 132, 135, 131, 137, 121, 136, 113,
           139, 118, 121, 132, 147, 151, 136, 108, 160,  90, 143, 122, 153,
           106, 115, 132, 124, 120, 128, 143,  96, 122, 147, 145, 123,  95,
           132, 138, 107, 131, 135,  96, 129, 125, 115, 128, 145, 140, 130,
           127,  92, 126, 119, 130, 132, 126, 128, 138, 117, 117,  81, 127,
           155, 134, 112, 142, 130, 148, 141, 135, 155, 114, 130, 134, 115,
           169, 127, 129, 118,  99, 130, 127, 126, 118, 105, 133, 133, 130,
           122, 111, 155, 117, 109, 121, 116, 147, 128, 154, 119, 112, 127,
           130, 140, 125, 106,  77, 126, 154, 131, 148, 118, 149, 148, 125,
           110,  63, 147, 124, 103, 138, 138, 134, 142,  96, 101, 113, 131,
           112, 138, 106, 141, 117, 138, 113, 134, 119, 135, 123, 113, 147,
           139, 144, 130, 128, 133, 137, 133, 123, 126, 116, 157, 115, 131,
           146,  89, 133, 148, 104, 130, 137, 114, 133, 128, 147, 128, 142,
           135, 112, 144, 130, 140, 132, 141, 141, 131, 137, 137, 122, 138,
            98, 128, 155, 129, 135, 107, 131, 136, 136, 138, 120, 127, 139,
           115, 147, 103, 124, 140, 139, 108, 133, 125, 105, 141, 137, 126,
           124, 149, 159, 132, 155, 126])

n

(index)

int64

117 69 69 87 50 ... 69 133 33 121

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([117,  69,  69,  87,  50,  62,  69,  82,  65,  80, 122,  75, 111,
            93,  44, 126,  85, 123,  59,  50,  73,  59,  59,  70, 112,  71,
            70,  53,  82,  55,  70,  90,  84,  73,  64,  69,  66,  83, 103,
            97,  63,  70,  82,  93,  96,  58,  80,  83,  54, 105,  49,  85,
            76, 142, 103,  68,  91,  51,  52, 109,  51,  74,  69, 124,  94,
            75,  64,  54, 100,  78,  66,  76,  73,  71, 107,  80,  93,  77,
            78, 104,  70,  68, 102,  72,  72, 114,  57,  53, 146,  82,  67,
           100,  98,  85,  62,  54,  61,  59,  90,  71,  56,  56,  91, 132,
            84, 103,  90,  67,  34,  84,  61,  63,  50,  62,  74,  64,  50,
            72,  69,  92,  83,  79,  70, 108,  61,  39,  96,  73, 107,  88,
            47,  98,  26,  90,  77,  91,  67, 163,  49, 149,  69,  94,  84,
            66,  61,  68,  49,  75,  65,  61,  34,  57,  67, 119,  84, 100,
            87,  59,  45, 114,  80,  65,  63,  50,  66,  94,  67, 141,  61,
            62,  98,  82,  77,  75,  84,  77,  66,  76,  70, 142,  71,  80,
            84,  51,  91,  44,  68,  90,  82,  57,  55,  45,  71,  95,  66,
            81, 116, 110, 126,  74,  84, 105,  62,  83,  95,  69,  60,  75,
            57,  85,  64, 117,  79,  62,  75,  80,  64,  78,  72,  34,  82,
            69,  23,  63,  95,  87,  75,  65,  73, 116,  39,  91, 107,  80,
            78, 108,  86,  84,  67,  81, 148,  41,  31,  79,  93,  65,  89,
            57,  60,  62, 138,  82,  67, 105,  61,  83,  66,  68,  62,  57,
    ...
           103,  59, 129,  78,  76,  27,  61,  66, 142, 127,  58,  94,  74,
            84,  66,  92,  63, 111,  85, 103,  45,  91,  63, 118, 100,  82,
            73, 105,  66, 106,  73,  38,  70,  75,  71,  72,  73,  90,  74,
            78, 103,  46, 128,  80,  70,  73,  89, 102,  77, 124,  85,  83,
           101,  56,  27,  74,  45,  90,  66, 115,  55, 121,  87, 115, 102,
            67,  64,  75,  75,  71,  89,  75,  89,  67, 102,  24,  82,  82,
            57,  80,  34,  54,  96, 112,  40,  84,  54,  73,  96,  89, 117,
            83, 130,  62,  81,  94,  49,  60,  84,  71, 115,  90,  70,  59,
            36,  75,  66,  92,  74,  70,  96,  77,  89,  71,  74,  68,  95,
            61, 140,  84, 107,  87,  74,  58,  68,  66,  62,  67,  68,  76,
            84, 103,  73,  90, 116,  74, 124,  45, 103,  64,  65,  68,  83,
            56,  81, 111,  56, 141, 112,  44, 125,  93,  84,  45,  75, 103,
            98,  63,  58, 108, 110, 101,  41,  71,  52,  81,  77, 123,  71,
            70,  68, 105,  82,  93,  78,  78, 101,  71,  68,  68, 134, 115,
            90,  75,  71,  75,  68,  73,  92,  43,  64, 101,  87, 108, 114,
            58,  88,  79,  72,  96,  67,  68, 105,  86,  44, 101,  60,  74,
           108,  90,  67,  55,  49,  75,  37,  67,  90,  70, 103,  81,  91,
            96,  88,  55,  63,  76, 110, 117,  58,  94,  87, 132, 104,  80,
            98,  92, 106,  88,  56,  90, 105, 109,  98,  53,  62,  89,  67,
           100,  93,  69, 133,  33, 121])

``` python
az.plot_pair(
    data[["o", "c", "e", "a", "n"]].to_xarray(),
    sample_dims="index",
    marginal_kind="hist",
    figure_kwargs={"layout": "constrained", "figsize": (7, 5)},
);
```

![](ESCS_multiple_regression_files/figure-html/cell-6-output-1.png)

We can easily see all the predictors are more or less symmetrically distributed without outliers and the pairwise correlations between them are not strong.

## Specify model and examine priors

We're going to fit a pretty straightforward additive multiple regression model predicting drug index from all 5 personality dimension scores. It's simple to specify the model using a familiar formula interface. Here we also tell Bambi to run two parallel Markov Chain Monte Carlo (MCMC) chains, each one with 2000 draws. The first 1000 draws are tuning steps that we discard and the last 1000 draws are considered to be taken from the joint posterior distribution of all the parameters (to be confirmed when we analyze the convergence of the chains).

``` python
model = bmb.Model("drugs ~ o + c + e + a + n", data)
fitted = model.fit(random_seed=seed)
```

    NUTS[nutpie]: [sigma, o, c, e, a, n, Intercept_centered]

*\[Rich HTML output -- view on the documentation site\]*

```
```

Great! But this is a Bayesian model, right? What about the priors? If no priors are given explicitly by the user, then Bambi chooses smart default priors for all parameters of the model based on the implied partial correlations between the outcome and the predictors. Here's what the default priors look like in this case - the plots below show 1000 draws from each prior distribution:

``` python
model.plot_priors(
    var_names=["Intercept", "sigma", "o", "c", "e", "a", "n"],
    figure_kwargs={"figsize": (7, 4)},
);
```

![](ESCS_multiple_regression_files/figure-html/cell-8-output-1.png)

``` python
# Normal priors on the coefficients
{x.name: x.prior.args for x in model.parameters["mu"].terms.values()}
```

    {'Intercept': {'mu': array(2.21014664), 'sigma': array(21.19375074)},
     'o': {'mu': array(0.), 'sigma': array(0.0768135)},
     'c': {'mu': array(0.), 'sigma': array(0.08679683)},
     'e': {'mu': array(0.), 'sigma': array(0.0815892)},
     'a': {'mu': array(0.), 'sigma': array(0.09727366)},
     'n': {'mu': array(0.), 'sigma': array(0.06987412)}}

``` python
# HalfStudentT prior on the residual standard deviation
for name, parameter in model.marginal_parameters.items():
    print(f"{name}: {parameter.prior}")
```

    sigma: HalfStudentT(nu: 4.0, sigma: 0.6482)

You could also just print the `model` and see it also contains the same information about the priors

``` python
model
```

           Formula: drugs ~ o + c + e + a + n
            Family: gaussian
              Link: mu = identity
      Observations: 604
            Priors: 
        target = mu
            Common-level effects
                Intercept ~ Normal(mu: 2.2101, sigma: 21.1938)
                o ~ Normal(mu: 0.0, sigma: 0.0768)
                c ~ Normal(mu: 0.0, sigma: 0.0868)
                e ~ Normal(mu: 0.0, sigma: 0.0816)
                a ~ Normal(mu: 0.0, sigma: 0.0973)
                n ~ Normal(mu: 0.0, sigma: 0.0699)
            
            Auxiliary parameters
                sigma ~ HalfStudentT(nu: 4.0, sigma: 0.6482)
    ------
    * To see a plot of the priors call the .plot_priors() method.
    * To see a summary or plot of the posterior pass the object returned by .fit() to az.summary() or az.plot_trace()

Some more info about the default prior distributions can be found in [this technical paper](https://arxiv.org/abs/1702.01201).

Notice the apparently small SDs of the slope priors. This is due to the relative scales of the outcome and the predictors: remember from the plots above that the outcome, `drugs`, ranges from 1 to about 4, while the predictors all range from about 20 to 180 or so. A one-unit change in any of the predictors - which is a trivial increase on the scale of the predictors - is likely to lead to a very small absolute change in the outcome. Believe it or not, these priors are actually quite wide on the partial correlation scale!

## Examine the model results

Let's start with a pretty picture of the parameter estimates!

``` python
pc = az.plot_rank_dist(fitted, figure_kwargs={"figsize": (7, 12)});
```

![](ESCS_multiple_regression_files/figure-html/cell-12-output-1.png)

The left panels show the marginal posterior distributions for all of the model's parameters, which summarize the most plausible values of the regression coefficients, given the data we have now observed. These posterior density plots show two overlaid distributions because we ran two MCMC chains. The panels on the right are "trace plots" showing the sampling paths of the two MCMC chains as they wander through the parameter space. If any of these paths exhibited a pattern other than white noise we would be concerned about the convergence of the chains.

A much more succinct (non-graphical) summary of the parameter estimates can be found like so:

``` python
az.summary(fitted)
```

|  | mean | sd | eti89_lb | eti89_ub | ess_bulk | ess_tail | r_hat | mcse_mean | mcse_sd |
|----|----|----|----|----|----|----|----|----|----|
| o | 0.0061 | 0.00125 | 0.0041 | 0.0081 | 3892 | 3341 | 1.00 | 2e-05 | 1.4e-05 |
| c | -0.00378 | 0.00149 | -0.0062 | -0.0014 | 3687 | 3187 | 1.00 | 2.4e-05 | 1.7e-05 |
| e | 0.00334 | 0.00137 | 0.0012 | 0.0056 | 3927 | 3255 | 1.00 | 2.2e-05 | 1.6e-05 |
| a | -0.01242 | 0.00148 | -0.015 | -0.01 | 4947 | 3291 | 1.00 | 2.1e-05 | 1.5e-05 |
| n | -0.0015 | 0.00121 | -0.0034 | 0.00044 | 3596 | 3179 | 1.00 | 2e-05 | 1.4e-05 |
| Intercept_centered | 2.2103 | 0.0244 | 2.2 | 2.2 | 5507 | 3014 | 1.00 | 0.00033 | 0.00023 |
| sigma | 0.5919 | 0.0171 | 0.57 | 0.62 | 5114 | 3378 | 1.00 | 0.00024 | 0.00017 |
| Intercept | 3.3 | 0.357 | 2.7 | 3.9 | 3884 | 3331 | 1.00 | 0.0057 | 0.0041 |

When there are multiple MCMC chains, the default summary output includes some basic convergence diagnostic info (the effective MCMC sample sizes and the [R-hat diagnostics](https://en.wikipedia.org/wiki/Gelman-Rubin_statistic)), although in this case it's pretty clear from the trace plots above that the chains have converged just fine.

## Summarize effects on partial correlation scale

``` python
samples = fitted.posterior
```

It turns out that we can convert each regression coefficient into a partial correlation by multiplying it by a constant that depends on (1) the SD of the predictor, (2) the SD of the outcome, and (3) the degree of multicollinearity with the set of other predictors. Two of these statistics are actually already computed and stored in the fitted model object, in a dictionary called `dm_statistics` (for design matrix statistics), because they are used internally. We will compute the others manually.

Some information about the relationship between linear regression parameters and partial correlation can be found [here](https://stats.stackexchange.com/questions/76815/multiple-regression-or-partial-correlation-coefficient-and-relations-between-th).

``` python
# the names of the predictors
varnames = ["o", "c", "e", "a", "n"]

# compute the needed statistics like R-squared when each predictor is response and all the
# other predictors are the predictor

# x_matrix = common effects design matrix (excluding intercept/constant term)
terms = [
    t for t in model.parameters["mu"].common_terms.values() if t.name != "Intercept"
]
x_matrix = [pd.DataFrame(x.data, columns=x.levels) for x in terms]
x_matrix = pd.concat(x_matrix, axis=1)
x_matrix.columns = varnames

dm_statistics = {
    "r2_x": pd.Series(
        {
            x: sm.OLS(
                endog=x_matrix[x],
                exog=(
                    sm.add_constant(x_matrix.drop(x, axis=1))
                    if "Intercept" in model.parameters["mu"].terms
                    else x_matrix.drop(x, axis=1)
                ),
            )
            .fit()
            .rsquared
            for x in list(x_matrix.columns)
        }
    ),
    "sigma_x": x_matrix.std(),
    "mean_x": x_matrix.mean(axis=0),
}

r2_x = dm_statistics["r2_x"]
sd_x = dm_statistics["sigma_x"]
r2_y = pd.Series(
    [
        sm.OLS(
            endog=data["drugs"],
            exog=sm.add_constant(data[[p for p in varnames if p != x]]),
        )
        .fit()
        .rsquared
        for x in varnames
    ],
    index=varnames,
)
sd_y = data["drugs"].std()

# compute the products to multiply each slope with to produce the partial correlations
slope_constant = (sd_x[varnames] / sd_y) * ((1 - r2_x[varnames]) / (1 - r2_y)) ** 0.5
slope_constant
```

    o    32.392557
    c    27.674284
    e    30.305117
    a    26.113299
    n    34.130431
    dtype: float64

Now we just multiply each sampled regression coefficient by its corresponding `slope_constant` to transform it into a sample partial correlation coefficient.

``` python
pcorr_samples = samples.ds[varnames] * slope_constant
```

And voilà! We now have a joint posterior distribution for the partial correlation coefficients. Let's plot the marginal posterior distributions:

``` python
pc = az.plot_dist(
    pcorr_samples,
    cols=None,
    aes={"color": ["__variable__"]},
    visuals={
        "point_estimate": False,
        "point_estimate_text": False,
        "credible_interval": False,
        "title": False,
    },
    figure_kwargs={"figsize": (7, 3)},
)
az.add_lines(pc, 0)
pc.viz.plot.item().set(xlabel="Partial correlation coefficient")
pc.add_legend("__variable__");
```

![](ESCS_multiple_regression_files/figure-html/cell-17-output-1.png)

The means of these distributions serve as good point estimates of the partial correlations:

``` python
pcorr_samples.mean()
```

![](data:image/svg+xml;base64,PHN2ZyBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB3aWR0aDogMDsgaGVpZ2h0OiAwOyBvdmVyZmxvdzogaGlkZGVuIj4KPGRlZnM+CjxzeW1ib2wgaWQ9Imljb24tZGF0YWJhc2UiIHZpZXdib3g9IjAgMCAzMiAzMiI+CjxwYXRoIGQ9Ik0xNiAwYy04LjgzNyAwLTE2IDIuMjM5LTE2IDV2NGMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di00YzAtMi43NjEtNy4xNjMtNS0xNi01eiIgLz4KPHBhdGggZD0iTTE2IDE3Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPHBhdGggZD0iTTE2IDI2Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9Imljb24tZmlsZS10ZXh0MiIgdmlld2JveD0iMCAwIDMyIDMyIj4KPHBhdGggZD0iTTI4LjY4MSA3LjE1OWMtMC42OTQtMC45NDctMS42NjItMi4wNTMtMi43MjQtMy4xMTZzLTIuMTY5LTIuMDMwLTMuMTE2LTIuNzI0Yy0xLjYxMi0xLjE4Mi0yLjM5My0xLjMxOS0yLjg0MS0xLjMxOWgtMTUuNWMtMS4zNzggMC0yLjUgMS4xMjEtMi41IDIuNXYyN2MwIDEuMzc4IDEuMTIyIDIuNSAyLjUgMi41aDIzYzEuMzc4IDAgMi41LTEuMTIyIDIuNS0yLjV2LTE5LjVjMC0wLjQ0OC0wLjEzNy0xLjIzLTEuMzE5LTIuODQxek0yNC41NDMgNS40NTdjMC45NTkgMC45NTkgMS43MTIgMS44MjUgMi4yNjggMi41NDNoLTQuODExdi00LjgxMWMwLjcxOCAwLjU1NiAxLjU4NCAxLjMwOSAyLjU0MyAyLjI2OHpNMjggMjkuNWMwIDAuMjcxLTAuMjI5IDAuNS0wLjUgMC41aC0yM2MtMC4yNzEgMC0wLjUtMC4yMjktMC41LTAuNXYtMjdjMC0wLjI3MSAwLjIyOS0wLjUgMC41LTAuNSAwIDAgMTUuNDk5LTAgMTUuNSAwdjdjMCAwLjU1MiAwLjQ0OCAxIDEgMWg3djE5LjV6IiAvPgo8cGF0aCBkPSJNMjMgMjZoLTE0Yy0wLjU1MiAwLTEtMC40NDgtMS0xczAuNDQ4LTEgMS0xaDE0YzAuNTUyIDAgMSAwLjQ0OCAxIDFzLTAuNDQ4IDEtMSAxeiIgLz4KPHBhdGggZD0iTTIzIDIyaC0xNGMtMC41NTIgMC0xLTAuNDQ4LTEtMXMwLjQ0OC0xIDEtMWgxNGMwLjU1MiAwIDEgMC40NDggMSAxcy0wLjQ0OCAxLTEgMXoiIC8+CjxwYXRoIGQ9Ik0yMyAxOGgtMTRjLTAuNTUyIDAtMS0wLjQ0OC0xLTFzMC40NDgtMSAxLTFoMTRjMC41NTIgMCAxIDAuNDQ4IDEgMXMtMC40NDggMS0xIDF6IiAvPgo8L3N5bWJvbD4KPC9kZWZzPgo8L3N2Zz4=)

``` xr-text-repr-fallback
<xarray.Dataset> Size: 40B
Dimensions:  ()
Data variables:
    o        float64 8B 0.1976
    c        float64 8B -0.1046
    e        float64 8B 0.1012
    a        float64 8B -0.3242
    n        float64 8B -0.0512
Attributes:
    created_at:                  2026-08-29T15:04:49.440356+00:00
    creation_library:            ArviZ
    creation_library_version:    1.3.0
    creation_library_language:   Python
    sample_dims:                 ['chain', 'draw']
    inference_library:           nutpie
    inference_library_version:   0.16.11
    sampling_time:               0.2375178337097168
    tuning_steps:                1000
    modeling_interface:          bambi
    modeling_interface_version:  0.20.1.dev78+g69d4473ea.d20260829
```

xarray.Dataset

Dimensions:

Data variables: (5)

o

()

float64

0.1976

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array(0.19764841)

c

()

float64

-0.1046

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array(-0.10457661)

e

()

float64

0.1012

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array(0.10122277)

a

()

float64

-0.3242

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array(-0.32422919)

n

()

float64

-0.0512

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array(-0.05120353)

Attributes: (11)

created_at :  
2026-08-29T15:04:49.440356+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

sample_dims :  
\['chain', 'draw'\]

inference_library :  
nutpie

inference_library_version :  
0.16.11

sampling_time :  
0.2375178337097168

tuning_steps :  
1000

modeling_interface :  
bambi

modeling_interface_version :  
0.20.1.dev78+g69d4473ea.d20260829

## Relative importance: Which predictors have the strongest effects (defined in terms of squared partial correlation)?

We just take the square of the partial correlation coefficients, so it's easy to get posteriors on that scale too:

``` python
pc = az.plot_dist(
    pcorr_samples**2,
    cols=None,
    aes={"color": ["__variable__"]},
    visuals={
        "point_estimate": False,
        "point_estimate_text": False,
        "credible_interval": False,
        "title": False,
    },
    figure_kwargs={"figsize": (7, 3)},
)
pc.viz.plot.item().set(xlabel="Partial coefficient of determination")
pc.add_legend("__variable__");
```

![](ESCS_multiple_regression_files/figure-html/cell-19-output-1.png)

With these posteriors we can ask: What is the probability that the squared partial correlation for Openness (blue) is greater than the squared partial correlation for Conscientiousness (orange)?

``` python
(pcorr_samples["o"] ** 2 > pcorr_samples["c"] ** 2).mean().item()
```

    0.9235

If we contrast this result with the plot we've just shown, we may think the probability is too high when looking at the overlap between the blue and orange curves. However, the previous plot is only showing marginal posteriors, which don't account for correlations between the coefficients. In our Bayesian world, our model parameters' are random variables (and consequently, any combination of them are too). As such, squared partial correlation have a joint distribution. When computing probabilities involving at least two of these parameters, one has to use the joint distribution. Otherwise, if we choose to work only with marginals, we are implicitly assuming independence.

Let's check the joint distribution of the squared partial correlation for Openness and Conscientiousness. We highlight with a blue color the draws where the coefficient for Openness is greater than the coefficient for Conscientiousness.

``` python
sq_partial_c = pcorr_samples["c"] ** 2
sq_partial_o = pcorr_samples["o"] ** 2
```

``` python
colors = np.where(sq_partial_c > sq_partial_o, "C1", "C0").flatten().tolist()

fig, ax = plt.subplots()
ax.scatter(sq_partial_o, sq_partial_c, c=colors)
ax.set(xlabel="Opennness to experience", ylabel="Conscientiousness");
```

![](ESCS_multiple_regression_files/figure-html/cell-22-output-1.png)

We can see that in the great majority of the draws (92.8%) the squared partial correlation for Openness is greater than the one for Conscientiousness. In fact, we can check the correlation between them is

``` python
xr.corr(sq_partial_c, sq_partial_o).item()
```

    -0.21474136432869928

which explains why only looking at the marginal posteriors (i.e. assuming independence) is not the best approach here.

For each predictor, what is the probability that it has the largest squared partial correlation?

``` python
pc_df = pcorr_samples.to_dataframe()
(pc_df**2).idxmax(axis=1).value_counts() / len(pc_df.index)
```

    a    0.99025
    o    0.00975
    Name: count, dtype: float64

Agreeableness is clearly the strongest predictor of drug use among the Big Five personality traits in terms of partial correlation, but it's still not a particularly strong predictor in an absolute sense. Walter Mischel famously claimed that it is rare to see correlations between personality measure and relevant behavioral outcomes exceed 0.3. In this case, the probability that the agreeableness partial correlation exceeds 0.3 is:

``` python
(np.abs(pcorr_samples["a"]) > 0.3).mean().item()
```

    0.73375

## Posterior Predictive

Once we have computed the posterior distribution, we can use it to compute the posterior predictive distribution. As the name implies, these are predictions assuming the model's parameter are distributed as the posterior. Thus, the posterior predictive includes the uncertainty about the parameters.

With Bambi we can use the model's [predict()](../reference/Model.predict.md) method with the fitted object to generate posterior predictive samples, which are then automatically added to the fitted object

``` python
model.predict(fitted, kind="response")
fitted
```

![](data:image/svg+xml;base64,PHN2ZyBzdHlsZT0icG9zaXRpb246IGFic29sdXRlOyB3aWR0aDogMDsgaGVpZ2h0OiAwOyBvdmVyZmxvdzogaGlkZGVuIj4KPGRlZnM+CjxzeW1ib2wgaWQ9Imljb24tZGF0YWJhc2UiIHZpZXdib3g9IjAgMCAzMiAzMiI+CjxwYXRoIGQ9Ik0xNiAwYy04LjgzNyAwLTE2IDIuMjM5LTE2IDV2NGMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di00YzAtMi43NjEtNy4xNjMtNS0xNi01eiIgLz4KPHBhdGggZD0iTTE2IDE3Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPHBhdGggZD0iTTE2IDI2Yy04LjgzNyAwLTE2LTIuMjM5LTE2LTV2NmMwIDIuNzYxIDcuMTYzIDUgMTYgNXMxNi0yLjIzOSAxNi01di02YzAgMi43NjEtNy4xNjMgNS0xNiA1eiIgLz4KPC9zeW1ib2w+CjxzeW1ib2wgaWQ9Imljb24tZmlsZS10ZXh0MiIgdmlld2JveD0iMCAwIDMyIDMyIj4KPHBhdGggZD0iTTI4LjY4MSA3LjE1OWMtMC42OTQtMC45NDctMS42NjItMi4wNTMtMi43MjQtMy4xMTZzLTIuMTY5LTIuMDMwLTMuMTE2LTIuNzI0Yy0xLjYxMi0xLjE4Mi0yLjM5My0xLjMxOS0yLjg0MS0xLjMxOWgtMTUuNWMtMS4zNzggMC0yLjUgMS4xMjEtMi41IDIuNXYyN2MwIDEuMzc4IDEuMTIyIDIuNSAyLjUgMi41aDIzYzEuMzc4IDAgMi41LTEuMTIyIDIuNS0yLjV2LTE5LjVjMC0wLjQ0OC0wLjEzNy0xLjIzLTEuMzE5LTIuODQxek0yNC41NDMgNS40NTdjMC45NTkgMC45NTkgMS43MTIgMS44MjUgMi4yNjggMi41NDNoLTQuODExdi00LjgxMWMwLjcxOCAwLjU1NiAxLjU4NCAxLjMwOSAyLjU0MyAyLjI2OHpNMjggMjkuNWMwIDAuMjcxLTAuMjI5IDAuNS0wLjUgMC41aC0yM2MtMC4yNzEgMC0wLjUtMC4yMjktMC41LTAuNXYtMjdjMC0wLjI3MSAwLjIyOS0wLjUgMC41LTAuNSAwIDAgMTUuNDk5LTAgMTUuNSAwdjdjMCAwLjU1MiAwLjQ0OCAxIDEgMWg3djE5LjV6IiAvPgo8cGF0aCBkPSJNMjMgMjZoLTE0Yy0wLjU1MiAwLTEtMC40NDgtMS0xczAuNDQ4LTEgMS0xaDE0YzAuNTUyIDAgMSAwLjQ0OCAxIDFzLTAuNDQ4IDEtMSAxeiIgLz4KPHBhdGggZD0iTTIzIDIyaC0xNGMtMC41NTIgMC0xLTAuNDQ4LTEtMXMwLjQ0OC0xIDEtMWgxNGMwLjU1MiAwIDEgMC40NDggMSAxcy0wLjQ0OCAxLTEgMXoiIC8+CjxwYXRoIGQ9Ik0yMyAxOGgtMTRjLTAuNTUyIDAtMS0wLjQ0OC0xLTFzMC40NDgtMSAxLTFoMTRjMC41NTIgMCAxIDAuNDQ4IDEgMXMtMC40NDggMS0xIDF6IiAvPgo8L3N5bWJvbD4KPC9kZWZzPgo8L3N2Zz4=)

``` xr-text-repr-fallback
<xarray.DataTree>
Group: /
├── Group: /posterior
│       Dimensions:             (chain: 4, draw: 1000, __obs__: 604)
│       Coordinates:
│         * chain               (chain) int64 32B 0 1 2 3
│         * draw                (draw) int64 8kB 0 1 2 3 4 5 ... 994 995 996 997 998 999
│         * __obs__             (__obs__) int64 5kB 0 1 2 3 4 5 ... 599 600 601 602 603
│       Data variables:
│           o                   (chain, draw) float64 32kB 0.004094 ... 0.007181
│           c                   (chain, draw) float64 32kB -0.003047 ... -0.001432
│           e                   (chain, draw) float64 32kB 0.004971 ... 0.005585
│           a                   (chain, draw) float64 32kB -0.01259 -0.0117 ... -0.01205
│           n                   (chain, draw) float64 32kB -0.0005244 ... -0.0004892
│           Intercept_centered  (chain, draw) float64 32kB 2.213 2.183 ... 2.184 2.225
│           sigma               (chain, draw) float64 32kB 0.5784 0.5813 ... 0.609
│           Intercept           (chain, draw) float64 32kB 3.208 3.301 ... 3.597 2.531
│           mu                  (chain, draw, __obs__) float64 19MB 2.434 ... 2.109
│       Attributes:
│           created_at:                  2026-08-29T15:04:49.440356+00:00
│           creation_library:            ArviZ
│           creation_library_version:    1.3.0
│           creation_library_language:   Python
│           sample_dims:                 ['chain', 'draw']
│           inference_library:           nutpie
│           inference_library_version:   0.16.11
│           sampling_time:               0.2375178337097168
│           tuning_steps:                1000
│           modeling_interface:          bambi
│           modeling_interface_version:  0.20.1.dev78+g69d4473ea.d20260829
├── Group: /sample_stats
│       Dimensions:                   (chain: 4, draw: 1000)
│       Coordinates:
│         * chain                     (chain) int64 32B 0 1 2 3
│         * draw                      (draw) int64 8kB 0 1 2 3 4 ... 995 996 997 998 999
│       Data variables: (12/20)
│           depth                     (chain, draw) uint64 32kB 2 3 2 2 2 ... 3 2 2 3 2
│           maxdepth_reached          (chain, draw) bool 4kB False False ... False False
│           step_size                 (chain, draw) float64 32kB 0.9186 ... 0.8087
│           transformation_update_id  (chain, draw) int64 32kB 0 0 0 0 0 0 ... 0 0 0 0 0
│           step_size_bar             (chain, draw) float64 32kB 0.8464 ... 0.8696
│           mean_tree_accept          (chain, draw) float64 32kB 0.8114 0.8231 ... 0.638
│           ...                        ...
│           fisher_distance           (chain, draw) float64 32kB 0.5822 0.335 ... 2.099
│           transformation_index      (chain, draw) int64 32kB 847 847 847 ... 849 849
│           diverging                 (chain, draw) bool 4kB False False ... False False
│           divergence_draw           (chain, draw) uint64 32kB 0 0 0 0 0 ... 0 0 0 0 0
│           divergence_message        (chain, draw) object 32kB None None ... None None
│           divergence_energy_error   (chain, draw) float64 32kB nan nan nan ... nan nan
│       Attributes:
│           created_at:                  2026-08-29T15:04:49.429828+00:00
│           creation_library:            ArviZ
│           creation_library_version:    1.3.0
│           creation_library_language:   Python
│           sample_dims:                 ['chain', 'draw']
│           inference_library:           nutpie
│           inference_library_version:   0.16.11
│           inference_library_settings:  {"sampler": "nuts", "adaptation": "diag", "s...
│           modeling_interface:          bambi
│           modeling_interface_version:  0.20.1.dev78+g69d4473ea.d20260829
├── Group: /constant_data
│       Dimensions:  (__obs__: 604)
│       Coordinates:
│         * __obs__  (__obs__) int64 5kB 0 1 2 3 4 5 6 7 ... 597 598 599 600 601 602 603
│       Data variables:
│           o_data   (__obs__) float64 5kB 122.0 142.0 117.0 130.0 ... 97.0 174.0 105.0
│           c_data   (__obs__) float64 5kB 89.0 132.0 173.0 134.0 ... 110.0 124.0 102.0
│           e_data   (__obs__) float64 5kB 102.0 92.0 101.0 99.0 ... 112.0 158.0 98.0
│           a_data   (__obs__) float64 5kB 115.0 140.0 148.0 135.0 ... 132.0 155.0 126.0
│           n_data   (__obs__) float64 5kB 117.0 69.0 69.0 87.0 ... 133.0 33.0 121.0
│       Attributes:
│           created_at:                  2026-08-29T15:04:49.437646+00:00
│           creation_library:            ArviZ
│           creation_library_version:    1.3.0
│           creation_library_language:   Python
│           inference_library:           pymc
│           inference_library_version:   6.3.1
│           sample_dims:                 []
│           modeling_interface:          bambi
│           modeling_interface_version:  0.20.1.dev78+g69d4473ea.d20260829
├── Group: /observed_data
│       Dimensions:  (__obs__: 604)
│       Coordinates:
│         * __obs__  (__obs__) int64 5kB 0 1 2 3 4 5 6 7 ... 597 598 599 600 601 602 603
│       Data variables:
│           drugs    (__obs__) float64 5kB 1.857 3.071 1.571 2.214 ... 1.5 2.5 3.357
│       Attributes:
│           created_at:                  2026-08-29T15:04:49.439530+00:00
│           creation_library:            ArviZ
│           creation_library_version:    1.3.0
│           creation_library_language:   Python
│           inference_library:           pymc
│           inference_library_version:   6.3.1
│           sample_dims:                 []
│           modeling_interface:          bambi
│           modeling_interface_version:  0.20.1.dev78+g69d4473ea.d20260829
└── Group: /posterior_predictive
        Dimensions:  (chain: 4, draw: 1000, __obs__: 604)
        Coordinates:
          * chain    (chain) int64 32B 0 1 2 3
          * draw     (draw) int64 8kB 0 1 2 3 4 5 6 7 ... 993 994 995 996 997 998 999
          * __obs__  (__obs__) int64 5kB 0 1 2 3 4 5 6 7 ... 597 598 599 600 601 602 603
        Data variables:
            drugs    (chain, draw, __obs__) float64 19MB 2.016 1.377 ... 2.037 1.507
        Attributes:
            created_at:                 2026-08-29T15:04:54.191000+00:00
            creation_library:           ArviZ
            creation_library_version:   1.3.0
            creation_library_language:  Python
            inference_library:          pymc
            inference_library_version:  6.3.1
            sample_dims:                ['chain', 'draw']
```

xarray.DataTree

/posterior(23)

Dimensions:

- chain: 4
- draw: 1000
- \_\_obs\_\_: 604

Coordinates: (3)

chain

(chain)

int64

0 1 2 3

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([0, 1, 2, 3])

draw

(draw)

int64

0 1 2 3 4 5 ... 995 996 997 998 999

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 997, 998, 999], shape=(1000,))

\_\_obs\_\_

(\_\_obs\_\_)

int64

0 1 2 3 4 5 ... 599 600 601 602 603

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 601, 602, 603], shape=(604,))

Data variables: (9)

o

(chain, draw)

float64

0.004094 0.007163 ... 0.007181

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.00409366, 0.00716269, 0.00747135, ..., 0.00416038, 0.00570315,0.00596643],[0.00659044, 0.00646178, 0.0038811 , ..., 0.0056748 , 0.00642066,0.00742996],[0.00528087, 0.00773469, 0.00690238, ..., 0.00836261, 0.00824174,0.00374109],[0.00312977, 0.00456329, 0.00561286, ..., 0.00657428, 0.0050766 ,0.00718134]], shape=(4, 1000))

c

(chain, draw)

float64

-0.003047 -0.004247 ... -0.001432

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-0.00304701, -0.00424723, -0.0032941 , ..., -0.00636144,-0.00637286, -0.00269178],[-0.00296369, -0.00308832, -0.00609952, ..., -0.00299175,-0.00590204, -0.00337778],[-0.00247787, -0.0029877 , -0.00305179, ..., -0.00287181,-0.00297544, -0.00472232],[-0.00626422, -0.00515348, -0.00561275, ...,  0.00019372,-0.00379723, -0.00143158]], shape=(4, 1000))

e

(chain, draw)

float64

0.004971 0.001803 ... 0.005585

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.00497137, 0.00180344, 0.00225909, ..., 0.00250933, 0.00278474,0.002654  ],[0.00209709, 0.00422185, 0.00373157, ..., 0.00296276, 0.00237531,0.00412956],[0.00518989, 0.00148277, 0.00369931, ..., 0.00091391, 0.00173243,0.00425806],[0.00270825, 0.00616807, 0.00368767, ..., 0.00427634, 0.0036072 ,0.00558548]], shape=(4, 1000))

a

(chain, draw)

float64

-0.01259 -0.0117 ... -0.01205

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-0.01259183, -0.01169997, -0.01259441, ..., -0.01384764,-0.01505526, -0.01238749],[-0.01118485, -0.01221821, -0.01376079, ..., -0.01179252,-0.01424996, -0.01070567],[-0.01478203, -0.01462865, -0.01405173, ..., -0.01352601,-0.01308679, -0.01173297],[-0.01085021, -0.01273133, -0.01113975, ..., -0.01372781,-0.01222318, -0.01205311]], shape=(4, 1000))

n

(chain, draw)

float64

-0.0005244 -0.001753 ... -0.0004892

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-0.00052441, -0.00175291, -0.00112902, ..., -0.00392471,-0.00280065,  0.00107908],[-0.00104405, -0.00080124, -0.00245725, ..., -0.00262268,-0.00094328, -0.00241848],[-0.00202355, -0.00286986, -0.00154722, ..., -0.00222532,-0.00146253, -0.00178355],[-0.00362672, -0.00339135,  0.00034222, ..., -0.00180238,-0.00474386, -0.00048918]], shape=(4, 1000))

Intercept_centered

(chain, draw)

float64

2.213 2.183 2.201 ... 2.184 2.225

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[2.21349433, 2.18263743, 2.20069337, ..., 2.2185023 , 2.23167726,2.17293817],[2.25302302, 2.19470667, 2.20335533, ..., 2.22381855, 2.19785063,2.23982956],[2.20065627, 2.21337814, 2.22265959, ..., 2.22009041, 2.20511329,2.22627961],[2.17385186, 2.20811284, 2.21287389, ..., 2.23637372, 2.18403697,2.22482865]], shape=(4, 1000))

sigma

(chain, draw)

float64

0.5784 0.5813 ... 0.5822 0.609

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.57839703, 0.58129244, 0.59076463, ..., 0.62650112, 0.59986691,0.61222777],[0.58887877, 0.60709033, 0.58401292, ..., 0.57452503, 0.60804243,0.58972901],[0.57921408, 0.59367165, 0.59242315, ..., 0.62737347, 0.63021568,0.56017298],[0.58254447, 0.57312669, 0.60656486, ..., 0.61216049, 0.58215712,0.60895831]], shape=(4, 1000))

Intercept

(chain, draw)

float64

3.208 3.301 3.179 ... 3.597 2.531

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[3.20761136, 3.30102151, 3.17852982, ..., 4.3076879 , 4.17781173,3.0027247 ],[3.12490236, 2.97973525, 4.03333183, ..., 3.31331701, 3.79838466,2.90133754],[3.35856336, 3.59872428, 3.29686499, ..., 3.39112806, 3.19980252,3.53838182],[3.94970159, 3.5298047 , 3.23913997, ..., 2.86334994, 3.59651186,2.5313032 ]], shape=(4, 1000))

mu

(chain, draw, \_\_obs\_\_)

float64

2.434 2.045 1.762 ... 2.601 2.109

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[[2.43351681, 2.04503099, 1.76176992, ..., 2.09445012,2.35851571, 2.16382024],[2.43022887, 2.16445772, 1.73388521, ..., 1.95305809,2.43427354, 2.1103241 ],[2.44683418, 2.17135651, 1.76909126, ..., 1.98129597,2.43762089, 2.12490698],...,[2.45336809, 2.08013537, 1.62710957, ..., 1.94265632,2.36334994, 2.12188262],[2.5314238 , 2.10165607, 1.60241054, ..., 1.98211245,2.39392706, 2.16367358],[2.46345988, 2.0790189 , 1.74428129, ..., 2.0909897 ,2.24198407, 2.18447533]],[[2.47065928, 2.22455175, 1.86767448, ..., 2.05778435,2.46737621, 2.18449587],[2.42500287, 2.1122267 , 1.76431213, ..., 2.02029283,2.46792364, 2.12051184],[2.47459887, 2.02655425, 1.60294401, ..., 2.0135475 ,2.3278784 , 2.15320237],...[2.43313943, 2.23642968, 1.80963702, ..., 1.9073577 ,2.46454691, 2.09229837],[2.44109142, 2.20368959, 1.78655065, ..., 1.94401211,2.46191816, 2.10556662],[2.45086303, 2.07233014, 1.72964645, ..., 2.07275039,2.39906869, 2.17264521]],[[2.37815843, 2.04713719, 1.64963232, ..., 1.95296677,2.34395725, 2.09882516],[2.39611823, 2.04860554, 1.67689274, ..., 1.96479949,2.57406997, 2.07326485],[2.55948398, 2.098596  , 1.67222263, ..., 2.15427102,2.38707955, 2.25518049],...,[2.32926274, 2.16963359, 1.94188356, ..., 1.94952638,2.5196677 , 2.04469752],[2.28514095, 2.109446  , 1.76152374, ..., 1.83086017,2.52778195, 1.98161546],[2.40639397, 2.15476108, 1.87037722, ..., 2.03992235,2.60147254, 2.10881779]]], shape=(4, 1000, 604))

Attributes: (11)

created_at :  
2026-08-29T15:04:49.440356+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

sample_dims :  
\['chain', 'draw'\]

inference_library :  
nutpie

inference_library_version :  
0.16.11

sampling_time :  
0.2375178337097168

tuning_steps :  
1000

modeling_interface :  
bambi

modeling_interface_version :  
0.20.1.dev78+g69d4473ea.d20260829

/sample_stats(32)

Dimensions:

- chain: 4
- draw: 1000

Coordinates: (2)

chain

(chain)

int64

0 1 2 3

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([0, 1, 2, 3])

draw

(draw)

int64

0 1 2 3 4 5 ... 995 996 997 998 999

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 997, 998, 999], shape=(1000,))

Data variables: (20)

depth

(chain, draw)

uint64

2 3 2 2 2 2 3 2 ... 2 2 2 3 2 2 3 2

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[2, 3, 2, ..., 3, 2, 3],[2, 2, 2, ..., 2, 2, 2],[2, 3, 2, ..., 3, 2, 3],[2, 2, 2, ..., 2, 3, 2]], shape=(4, 1000), dtype=uint64)

maxdepth_reached

(chain, draw)

bool

False False False ... False False

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False]], shape=(4, 1000))

step_size

(chain, draw)

float64

0.9186 0.9114 ... 0.9132 0.8087

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.91859484, 0.9114446 , 0.79101488, ..., 0.84221551, 0.78561209,0.90766798],[0.84287088, 0.8166816 , 0.83431498, ..., 0.88344848, 0.84150213,0.8273575 ],[0.8759624 , 0.77023142, 0.880237  , ..., 0.81730709, 0.79667906,0.80806796],[0.9298493 , 0.91656477, 0.91181876, ..., 0.82621014, 0.91320341,0.80873545]], shape=(4, 1000))

transformation_update_id

(chain, draw)

int64

0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0]], shape=(4, 1000))

step_size_bar

(chain, draw)

float64

0.8464 0.8464 ... 0.8696 0.8696

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.8464049 , 0.8464049 , 0.8464049 , ..., 0.8464049 , 0.8464049 ,0.8464049 ],[0.87621164, 0.87621164, 0.87621164, ..., 0.87621164, 0.87621164,0.87621164],[0.84037528, 0.84037528, 0.84037528, ..., 0.84037528, 0.84037528,0.84037528],[0.86956177, 0.86956177, 0.86956177, ..., 0.86956177, 0.86956177,0.86956177]], shape=(4, 1000))

mean_tree_accept

(chain, draw)

float64

0.8114 0.8231 ... 0.9988 0.638

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.8114465 , 0.8230904 , 0.61887807, ..., 0.96454857, 0.93768008,0.93852328],[0.51313129, 0.87046211, 0.87066143, ..., 0.65854946, 0.61820701,1.        ],[1.        , 1.        , 0.87899704, ..., 0.99341902, 1.        ,0.93539849],[0.70711008, 0.94469263, 0.96238072, ..., 0.93434218, 0.99880465,0.63797759]], shape=(4, 1000))

mean_tree_accept_sym

(chain, draw)

float64

0.8522 0.8948 0.693 ... 0.68 0.6689

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.85216274, 0.89480177, 0.69302439, ..., 0.91410779, 0.8814549 ,0.91536145],[0.63364151, 0.88908232, 0.92883938, ..., 0.62860472, 0.72612662,0.81452426],[0.86579143, 0.86860288, 0.91248007, ..., 0.94793198, 0.88915179,0.89169584],[0.81064165, 0.86594244, 0.96082258, ..., 0.70054359, 0.67996241,0.66894115]], shape=(4, 1000))

n_steps

(chain, draw)

uint64

3 7 3 3 3 7 7 3 ... 7 3 3 7 3 3 7 3

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[3, 7, 3, ..., 7, 3, 7],[3, 3, 3, ..., 3, 3, 3],[3, 7, 3, ..., 7, 3, 7],[3, 3, 3, ..., 3, 7, 3]], shape=(4, 1000), dtype=uint64)

max_energy_error

(chain, draw)

float64

-0.794 -0.4808 ... 1.26 -0.8243

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-0.79404962, -0.48084336, -1.2201499 , ...,  0.35344772,0.31438127,  0.47805703],[-1.3498128 , -0.34411668, -0.2607229 , ..., -0.95516491,-0.85085894,  0.66331355],[ 0.31593569,  0.6034943 , -0.2071353 , ...,  0.21154382,0.40154255,  0.50615242],[-0.63003759,  0.53450762,  0.11870832, ...,  1.19062893,1.25958662, -0.82432809]], shape=(4, 1000))

tuning

(chain, draw)

bool

False False False ... False False

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False]], shape=(4, 1000))

index_in_trajectory

(chain, draw)

int64

3 -5 2 0 2 -2 1 ... -2 2 1 -2 5 -3

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[ 3, -5,  2, ..., -5, -1,  5],[-2, -3, -2, ...,  1,  3,  2],[-1,  6, -1, ...,  4,  1,  5],[-2, -1,  2, ..., -2,  5, -3]], shape=(4, 1000))

logp

(chain, draw)

float64

-536.0 -535.6 ... -539.9 -538.4

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-535.96315935, -535.60581952, -534.61342434, ..., -539.79775959,-537.65305825, -538.53080414],[-536.25087049, -534.95233796, -536.73419868, ..., -535.61240072,-538.03562517, -537.38276861],[-537.3537359 , -536.59185329, -534.88775012, ..., -538.65098157,-538.04480335, -537.54306383],[-541.0782596 , -538.50335845, -537.49790173, ..., -540.74085333,-539.86946982, -538.40217424]], shape=(4, 1000))

energy

(chain, draw)

float64

498.6 497.6 497.4 ... 502.8 505.1

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[498.55831522, 497.59943693, 497.39682226, ..., 503.43015551,501.48786538, 502.20702807],[498.39223629, 498.19864236, 497.5537537 , ..., 499.6783207 ,498.74207427, 498.92237903],[500.14699226, 498.87100518, 498.84749827, ..., 500.03097809,499.0953836 , 501.22552698],[503.4532101 , 503.94138739, 500.20320249, ..., 502.02564034,502.79936382, 505.09957705]], shape=(4, 1000))

energy_error

(chain, draw)

float64

-0.1145 -0.006026 ... -0.5051

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[-0.11451914, -0.00602558, -0.19236064, ..., -0.10351315,-0.19381885,  0.11770567],[ 0.08594755, -0.22321528,  0.2607229 , ..., -0.877795  ,0.85085894, -0.25266493],[-0.29365991, -0.42291361, -0.12600367, ...,  0.04716167,-0.00938291, -0.08825538],[ 0.52973927, -0.53450762,  0.07755934, ...,  0.21936752,-0.02810559, -0.50508324]], shape=(4, 1000))

fisher_distance

(chain, draw)

float64

0.5822 0.335 0.4664 ... 4.884 2.099

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0.5822174 , 0.33502242, 0.46641317, ..., 2.4399615 , 1.81586676,1.82692716],[0.23955351, 0.21617534, 1.76354618, ..., 1.01910208, 2.25270941,1.83438563],[0.87790236, 1.01945338, 0.15397433, ..., 1.85724038, 1.24083943,0.74452921],[1.93323093, 3.07153307, 2.04600604, ..., 3.43294505, 4.8835973 ,2.09932975]], shape=(4, 1000))

transformation_index

(chain, draw)

int64

847 847 847 847 ... 849 849 849 849

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[847, 847, 847, ..., 847, 847, 847],[849, 849, 849, ..., 849, 849, 849],[849, 849, 849, ..., 849, 849, 849],[849, 849, 849, ..., 849, 849, 849]], shape=(4, 1000))

diverging

(chain, draw)

bool

False False False ... False False

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False],[False, False, False, ..., False, False, False]], shape=(4, 1000))

divergence_draw

(chain, draw)

uint64

0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0],[0, 0, 0, ..., 0, 0, 0]], shape=(4, 1000), dtype=uint64)

divergence_message

(chain, draw)

object

None None None ... None None None

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[None, None, None, ..., None, None, None],[None, None, None, ..., None, None, None],[None, None, None, ..., None, None, None],[None, None, None, ..., None, None, None]],shape=(4, 1000), dtype=object)

divergence_energy_error

(chain, draw)

float64

nan nan nan nan ... nan nan nan nan

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[nan, nan, nan, ..., nan, nan, nan],[nan, nan, nan, ..., nan, nan, nan],[nan, nan, nan, ..., nan, nan, nan],[nan, nan, nan, ..., nan, nan, nan]], shape=(4, 1000))

Attributes: (10)

created_at :  
2026-08-29T15:04:49.429828+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

sample_dims :  
\['chain', 'draw'\]

inference_library :  
nutpie

inference_library_version :  
0.16.11

inference_library_settings :  
{"sampler": "nuts", "adaptation": "diag", "settings": {"num_tune": 1000, "num_draws": 1000, "maxdepth": 10, "mindepth": 0, "store_gradient": false, "store_unconstrained": false, "store_transformed": false, "max_energy_error": 1000.0, "store_divergences": false, "adapt_options": {"step_size_settings": {"target_accept": 0.8, "initial_step": 0.1, "jitter": 0.1, "adapt_options": {"method": "DualAverage", "dual_average": {"k": 0.75, "t0": 10.0, "gamma": 0.05, "max_step_size": 3.141592653589793}, "adam": {"beta1": 0.9, "beta2": 0.999, "epsilon": 1e-08, "learning_rate": 0.05}}}, "mass_matrix_options": {"store_mass_matrix": false, "use_grad_based_estimate": true}, "early_window": 0.3, "step_size_window": 0.15, "mass_matrix_switch_freq": 80, "early_mass_matrix_switch_freq": 10, "mass_matrix_update_freq": 1, "mass_matrix_window_growth": 1.5}, "check_turning": true, "target_integration_time": null, "trajectory_kind": "Euclidean", "num_chains": 4, "seed": 188316333, "extra_doublings": 0}}

modeling_interface :  
bambi

modeling_interface_version :  
0.20.1.dev78+g69d4473ea.d20260829

/constant_data(15)

Dimensions:

- \_\_obs\_\_: 604

Coordinates: (1)

\_\_obs\_\_

(\_\_obs\_\_)

int64

0 1 2 3 4 5 ... 599 600 601 602 603

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 601, 602, 603], shape=(604,))

Data variables: (5)

o_data

(\_\_obs\_\_)

float64

122.0 142.0 117.0 ... 174.0 105.0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([122., 142., 117., 130., 100., 150., 105.,  92., 129.,  85., 111.,92., 111., 152.,  82., 120.,  73., 115., 114., 116.,  98., 107.,102., 115., 101., 107., 127., 108.,  90., 123., 106.,  92., 131.,96.,  83., 122., 128., 114., 114., 140.,  65., 109., 138.,  84.,142., 100., 127., 124., 121., 131., 103.,  89.,  82., 174., 110.,131., 111., 111., 115., 129., 146., 124., 117.,  86., 112., 110.,129., 107., 142., 124.,  99., 122., 141., 107., 140., 144., 108.,126., 122., 127., 116., 121., 137., 125., 106., 137., 100.,  84.,110., 138., 114., 107., 124.,  92.,  78., 124., 103., 123.,  78.,90., 103., 122.,  92., 127., 137.,  97., 109., 108., 103.,  89.,144., 136., 161., 111., 109., 119.,  80., 102., 115., 119., 119.,131.,  74., 112.,  78., 104., 115.,  82., 166., 138., 106., 106.,118., 111., 113.,  88., 117., 157., 130., 108., 114., 104., 110.,123., 120., 102., 105., 107., 106., 137., 124., 131., 103.,  77.,139., 122.,  87., 111., 111.,  95., 105., 114., 137., 131., 146.,142., 130.,  90., 108., 114., 109., 105., 109., 139., 136.,  92.,140., 101., 145.,  98., 132., 114., 136.,  76., 118., 114., 120.,122., 112., 157., 113., 132.,  96.,  95., 130., 120., 103., 105.,84., 101., 107., 106., 102.,  96., 117., 108., 138., 101.,  54.,104.,  92., 132., 159.,  97.,  99., 141., 116., 110., 101., 119.,...99., 135., 135., 146.,  94., 157., 123.,  95., 159., 129., 108.,129., 131., 121., 116., 126., 107., 135., 135., 120., 117., 109.,135., 111., 116., 127., 137., 124., 127., 117.,  72., 139., 112.,117., 131.,  99., 138.,  80., 132., 103.,  98., 129.,  93.,  73.,165., 135., 105., 122., 120., 133., 110., 107., 132., 124., 138.,91., 156., 113., 111., 134., 108., 104.,  74., 126., 116., 125.,116.,  91.,  99.,  94.,  84.,  70., 109.,  93.,  90., 146., 131.,132., 139., 104., 120., 124., 108., 126., 108., 151.,  75., 102.,110., 115., 131.,  59., 106., 141., 110., 118., 107., 123., 154.,98.,  93., 107., 135., 118., 131., 131., 122., 137., 128.,  77.,126.,  78.,  95., 100., 106., 138., 131., 109., 122., 150., 111.,162., 154.,  93.,  97., 122., 111.,  73., 133., 112., 119., 119.,124.,  92., 156., 126., 106., 145., 133., 104.,  88., 101.,  91.,134., 117., 161., 123., 102., 122.,  99., 126., 109., 132., 114.,87., 106., 132., 151., 104.,  89.,  94., 110., 137., 114., 104.,105., 108., 146., 106., 113., 147., 104., 142., 152., 111., 119.,108., 105., 133., 100.,  94., 113., 102., 112., 104., 101.,  94.,96., 129., 129., 130., 142.,  84., 140.,  93., 134.,  81.,  91.,100., 152., 143., 127., 112., 122., 128., 135., 123.,  86., 104.,161., 125., 129., 163., 151.,  95., 134.,  97., 174., 105.])

c_data

(\_\_obs\_\_)

float64

89.0 132.0 173.0 ... 124.0 102.0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([ 89., 132., 173., 134., 130., 145., 129., 125., 137., 108.,  84.,112., 125.,  97., 154., 101., 127., 117., 114., 111., 128., 139.,154., 129., 120., 111.,  91., 112., 137., 152., 133., 108., 122.,130., 141., 137., 121., 109., 116., 131., 146., 145., 112., 123.,106., 155., 103., 123., 149.,  96., 151., 126., 126., 133., 131.,114., 122., 129., 144., 101., 141., 127., 144., 120., 123., 124.,145., 151., 130., 129., 143., 145., 128., 108., 114., 129., 110.,105., 135.,  91., 136., 113., 128., 125., 124.,  91., 125., 143.,123., 163., 124., 121., 124., 112., 119., 122., 134., 115., 155.,140., 130., 155., 149., 122., 114., 119., 127., 145., 158., 111.,127., 160., 136., 118., 129., 127., 154., 115., 109., 116., 141.,128., 123., 126., 135., 157., 126., 128., 118.,  97., 136., 104.,130., 137., 141., 131., 121.,  97., 133.,  67., 112.,  91., 128.,140., 135.,  93., 119., 130., 139., 112., 157., 138., 125., 103.,138., 125., 135., 136., 111., 111., 146., 119., 130., 111., 143.,123., 141.,  91., 160., 153.,  97., 130., 126., 117.,  99., 116.,125., 130., 118., 139., 113., 102., 132., 133., 102., 140., 107.,120., 139., 158., 127., 130., 121., 104., 125., 130.,  89., 132.,97., 110., 124.,  97., 140., 106., 122., 140., 132.,  97., 121.,109., 158., 109.,  98., 127., 151., 104., 120., 117., 126., 161.,...136., 113., 120.,  95., 144., 115., 123., 158., 126., 133., 119.,121., 129.,  44., 133., 128., 113.,  93.,  81., 121., 156., 116.,132., 111., 159., 127., 145., 119., 142., 141., 131., 136., 134.,118.,  94.,  99., 114., 147.,  76., 130., 149., 153., 126., 141.,137., 115., 168., 133., 115., 103., 131., 122., 132., 119., 108.,117., 124., 112., 122., 136., 129.,  85., 156., 142., 118., 123.,131., 114., 122., 141., 130., 125., 122., 107., 131., 107., 120.,129., 121., 128., 105., 119., 107., 100., 127., 132., 127., 112.,150., 132., 146., 154., 139., 120., 130., 102., 105., 144., 111.,132., 146., 136., 109., 148., 103., 121., 118., 128.,  95., 148.,134., 120., 118., 106., 119., 136.,  75., 124., 100., 131.,  86.,122., 113., 115., 129., 114., 115., 151., 140., 143., 136., 152.,102., 116., 112., 133., 131., 107.,  86.,  93., 129.,  73., 115.,148., 152., 114.,  81.,  83., 134., 137., 130., 136., 137., 148.,129., 155., 118.,  97., 134., 104., 125., 132., 109., 126., 134.,120., 123., 130., 125., 117., 136., 142., 136.,  73., 129., 119.,106., 141., 135., 131., 145., 120., 119., 121., 108., 107., 100.,98., 149., 172., 136., 101., 109.,  51., 144., 113., 129.,  92.,90., 123., 116., 150., 125., 113., 122., 110., 124.,  92.,  70.,136., 131., 103., 145., 132., 130., 136., 110., 124., 102.])

e_data

(\_\_obs\_\_)

float64

102.0 92.0 101.0 ... 158.0 98.0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([102.,  92., 101.,  99., 116., 130., 121.,  99., 123., 103., 103.,99., 106., 122., 101., 107.,  82.,  93., 132., 135.,  99., 117.,138.,  99., 149.,  93.,  87.,  77.,  92., 123., 103.,  95., 105.,94., 117.,  90., 123.,  98.,  65., 136.,  83., 119., 123.,  88.,88., 123.,  78., 110., 129., 101., 124., 105.,  86., 143., 110.,102., 103.,  86., 126.,  83., 144., 106., 111.,  61., 107., 110.,121., 103., 115., 124., 109., 122., 101.,  93., 104., 115.,  88.,90., 113., 138., 125.,  90., 132., 117.,  94.,  62., 120.,  77.,65., 150., 117.,  99., 112.,  79.,  93., 112., 124.,  97.,  82.,103., 109.,  75., 111., 108., 105.,  71., 110., 109., 125.,  86.,133., 103.,  63.,  96., 109.,  91., 109., 133.,  57., 127.,  92.,92.,  76., 114.,  96., 140.,  90.,  82., 111., 125.,  79.,  96.,144., 109.,  94.,  80., 114., 116., 100.,  84.,  70.,  91., 111.,125., 136., 102., 136., 103., 108.,  94., 101., 118., 122.,  89.,134., 103.,  62., 136., 102., 109., 106., 104., 126.,  93., 112.,129.,  99.,  52., 108., 105.,  96., 119., 107., 133., 104., 124.,109., 105.,  96., 128., 125., 113., 113.,  87.,  81., 126., 107.,121., 143., 134., 119., 123.,  92.,  79., 127., 100.,  72.,  92.,114.,  96.,  95., 108.,  96., 115., 113., 130., 138., 121., 116.,119.,  87.,  79., 109., 122., 133., 118., 126., 120., 105., 126.,...86., 113., 129.,  95., 128., 115.,  92., 143., 134., 126., 111.,113., 119., 135., 119., 113.,  99.,  70.,  92., 119.,  79., 120.,102., 115., 128., 116., 120.,  97.,  92.,  94., 105., 100., 105.,111., 109.,  91.,  70.,  50., 120.,  82.,  84., 121., 123.,  87.,98., 115., 116., 114., 109., 102., 122.,  98., 120., 119., 126.,83., 141., 105.,  78.,  92., 114., 114., 109., 115., 122., 134.,122., 107.,  84., 108.,  78.,  82., 113.,  87., 120., 135., 126.,140.,  79., 102.,  74., 116.,  99., 129.,  92., 117.,  92.,  79.,98., 114., 101.,  93.,  83., 127., 123.,  85., 117., 101., 101.,109., 138., 105.,  89., 119., 134., 124., 139., 115.,  91., 110.,99.,  86.,  79., 109.,  48., 134.,  42.,  76., 150., 137.,  92.,123., 111.,  69., 106., 101.,  78.,  88.,  95.,  75., 128.,  98.,98.,  83., 130., 116., 112., 104., 107.,  63.,  77., 104., 103.,126., 112., 106.,  94.,  59., 117.,  98., 109., 114., 148., 134.,114., 107., 106., 120.,  61.,  93.,  96.,  98., 110., 105., 107.,89.,  75., 120.,  89.,  84.,  96., 119.,  87.,  98., 102.,  92.,127.,  98., 114., 112.,  75., 113.,  80., 102.,  92.,  86.,  63.,94.,  94., 129., 114.,  90.,  70., 100.,  89.,  94.,  80.,  81.,96., 150., 120., 114., 114., 114., 121., 120., 148.,  88., 109.,145., 114., 121., 128., 153., 132., 128., 112., 158.,  98.])

a_data

(\_\_obs\_\_)

float64

115.0 140.0 148.0 ... 155.0 126.0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([115., 140., 148., 135., 117.,  97., 128., 134., 124., 145.,  97.,132., 108., 115., 138., 109., 125., 126., 124., 119., 131.,  98.,106., 137., 127., 122., 124., 122., 132.,  95., 138., 121.,  80.,118.,  93., 123., 106., 119., 119.,  69., 127., 134., 121., 101.,132., 129., 107.,  90., 141., 138., 134.,  99.,  98.,  92., 103.,97., 143., 118., 122., 133., 116., 119., 126., 112., 116., 127.,145., 100., 133., 110., 133., 123., 100., 113., 112., 101., 124.,129., 110., 146., 113., 125., 117., 129., 149., 124., 142., 136.,131., 136., 114., 111., 120., 126., 122., 125., 129., 122., 138.,147., 118.,  74., 106., 115., 114.,  85., 142., 129., 134., 120.,132., 148., 141., 111., 112., 141., 130., 111., 115.,  97., 127.,126., 117., 153.,  96., 105., 118., 123., 108., 107., 126.,  95.,149.,  84., 122., 132.,  93., 139., 144., 111., 109.,  97., 130.,119., 162., 122., 125., 122., 121., 143., 143., 134., 128., 136.,125.,  94., 130., 128., 157., 103., 136., 125., 117., 137., 147.,110., 107., 140., 125.,  93., 132., 144., 136., 145., 100.,  93.,100., 139.,  85., 131., 123., 133., 129., 127., 121., 133., 120.,121., 107., 124., 117.,  99., 124., 111., 109., 131., 127., 131.,99., 115., 130., 138., 130., 121., 119., 127., 133., 121., 137.,89., 101., 106., 124., 130., 105., 140., 149., 122., 128., 144.,...147., 125., 139., 122., 135., 128.,  90., 140., 130., 121., 124.,132., 135., 131., 137., 121., 136., 113., 139., 118., 121., 132.,147., 151., 136., 108., 160.,  90., 143., 122., 153., 106., 115.,132., 124., 120., 128., 143.,  96., 122., 147., 145., 123.,  95.,132., 138., 107., 131., 135.,  96., 129., 125., 115., 128., 145.,140., 130., 127.,  92., 126., 119., 130., 132., 126., 128., 138.,117., 117.,  81., 127., 155., 134., 112., 142., 130., 148., 141.,135., 155., 114., 130., 134., 115., 169., 127., 129., 118.,  99.,130., 127., 126., 118., 105., 133., 133., 130., 122., 111., 155.,117., 109., 121., 116., 147., 128., 154., 119., 112., 127., 130.,140., 125., 106.,  77., 126., 154., 131., 148., 118., 149., 148.,125., 110.,  63., 147., 124., 103., 138., 138., 134., 142.,  96.,101., 113., 131., 112., 138., 106., 141., 117., 138., 113., 134.,119., 135., 123., 113., 147., 139., 144., 130., 128., 133., 137.,133., 123., 126., 116., 157., 115., 131., 146.,  89., 133., 148.,104., 130., 137., 114., 133., 128., 147., 128., 142., 135., 112.,144., 130., 140., 132., 141., 141., 131., 137., 137., 122., 138.,98., 128., 155., 129., 135., 107., 131., 136., 136., 138., 120.,127., 139., 115., 147., 103., 124., 140., 139., 108., 133., 125.,105., 141., 137., 126., 124., 149., 159., 132., 155., 126.])

n_data

(\_\_obs\_\_)

float64

117.0 69.0 69.0 ... 33.0 121.0

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([117.,  69.,  69.,  87.,  50.,  62.,  69.,  82.,  65.,  80., 122.,75., 111.,  93.,  44., 126.,  85., 123.,  59.,  50.,  73.,  59.,59.,  70., 112.,  71.,  70.,  53.,  82.,  55.,  70.,  90.,  84.,73.,  64.,  69.,  66.,  83., 103.,  97.,  63.,  70.,  82.,  93.,96.,  58.,  80.,  83.,  54., 105.,  49.,  85.,  76., 142., 103.,68.,  91.,  51.,  52., 109.,  51.,  74.,  69., 124.,  94.,  75.,64.,  54., 100.,  78.,  66.,  76.,  73.,  71., 107.,  80.,  93.,77.,  78., 104.,  70.,  68., 102.,  72.,  72., 114.,  57.,  53.,146.,  82.,  67., 100.,  98.,  85.,  62.,  54.,  61.,  59.,  90.,71.,  56.,  56.,  91., 132.,  84., 103.,  90.,  67.,  34.,  84.,61.,  63.,  50.,  62.,  74.,  64.,  50.,  72.,  69.,  92.,  83.,79.,  70., 108.,  61.,  39.,  96.,  73., 107.,  88.,  47.,  98.,26.,  90.,  77.,  91.,  67., 163.,  49., 149.,  69.,  94.,  84.,66.,  61.,  68.,  49.,  75.,  65.,  61.,  34.,  57.,  67., 119.,84., 100.,  87.,  59.,  45., 114.,  80.,  65.,  63.,  50.,  66.,94.,  67., 141.,  61.,  62.,  98.,  82.,  77.,  75.,  84.,  77.,66.,  76.,  70., 142.,  71.,  80.,  84.,  51.,  91.,  44.,  68.,90.,  82.,  57.,  55.,  45.,  71.,  95.,  66.,  81., 116., 110.,126.,  74.,  84., 105.,  62.,  83.,  95.,  69.,  60.,  75.,  57.,85.,  64., 117.,  79.,  62.,  75.,  80.,  64.,  78.,  72.,  34.,...71.,  72.,  73.,  90.,  74.,  78., 103.,  46., 128.,  80.,  70.,73.,  89., 102.,  77., 124.,  85.,  83., 101.,  56.,  27.,  74.,45.,  90.,  66., 115.,  55., 121.,  87., 115., 102.,  67.,  64.,75.,  75.,  71.,  89.,  75.,  89.,  67., 102.,  24.,  82.,  82.,57.,  80.,  34.,  54.,  96., 112.,  40.,  84.,  54.,  73.,  96.,89., 117.,  83., 130.,  62.,  81.,  94.,  49.,  60.,  84.,  71.,115.,  90.,  70.,  59.,  36.,  75.,  66.,  92.,  74.,  70.,  96.,77.,  89.,  71.,  74.,  68.,  95.,  61., 140.,  84., 107.,  87.,74.,  58.,  68.,  66.,  62.,  67.,  68.,  76.,  84., 103.,  73.,90., 116.,  74., 124.,  45., 103.,  64.,  65.,  68.,  83.,  56.,81., 111.,  56., 141., 112.,  44., 125.,  93.,  84.,  45.,  75.,103.,  98.,  63.,  58., 108., 110., 101.,  41.,  71.,  52.,  81.,77., 123.,  71.,  70.,  68., 105.,  82.,  93.,  78.,  78., 101.,71.,  68.,  68., 134., 115.,  90.,  75.,  71.,  75.,  68.,  73.,92.,  43.,  64., 101.,  87., 108., 114.,  58.,  88.,  79.,  72.,96.,  67.,  68., 105.,  86.,  44., 101.,  60.,  74., 108.,  90.,67.,  55.,  49.,  75.,  37.,  67.,  90.,  70., 103.,  81.,  91.,96.,  88.,  55.,  63.,  76., 110., 117.,  58.,  94.,  87., 132.,104.,  80.,  98.,  92., 106.,  88.,  56.,  90., 105., 109.,  98.,53.,  62.,  89.,  67., 100.,  93.,  69., 133.,  33., 121.])

Attributes: (9)

created_at :  
2026-08-29T15:04:49.437646+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

inference_library :  
pymc

inference_library_version :  
6.3.1

sample_dims :  
\[\]

modeling_interface :  
bambi

modeling_interface_version :  
0.20.1.dev78+g69d4473ea.d20260829

/observed_data(11)

Dimensions:

- \_\_obs\_\_: 604

Coordinates: (1)

\_\_obs\_\_

(\_\_obs\_\_)

int64

0 1 2 3 4 5 ... 599 600 601 602 603

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 601, 602, 603], shape=(604,))

Data variables: (1)

drugs

(\_\_obs\_\_)

float64

1.857 3.071 1.571 ... 1.5 2.5 3.357

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([1.85714286, 3.07142857, 1.57142857, 2.21428571, 1.07142857,1.42857143, 1.14285714, 2.14285714, 2.14285714, 1.07142857,1.85714286, 2.5       , 1.85714286, 2.71428571, 1.42857143,1.71428571, 1.71428571, 3.14285714, 2.71428571, 1.92857143,2.71428571, 2.28571429, 2.35714286, 1.71428571, 2.        ,2.92857143, 2.5       , 2.92857143, 2.64285714, 2.21428571,2.78571429, 2.71428571, 3.07142857, 2.        , 3.        ,1.92857143, 3.07142857, 2.57142857, 2.71428571, 3.07142857,1.78571429, 1.78571429, 3.57142857, 2.28571429, 2.78571429,2.14285714, 2.71428571, 2.71428571, 2.35714286, 2.28571429,1.85714286, 2.57142857, 2.14285714, 3.07142857, 2.07142857,3.5       , 1.71428571, 2.5       , 2.14285714, 1.14285714,3.5       , 1.85714286, 3.28571429, 2.64285714, 2.        ,1.85714286, 2.35714286, 2.21428571, 3.14285714, 2.64285714,1.28571429, 1.64285714, 2.64285714, 2.07142857, 2.21428571,3.07142857, 2.42857143, 3.21428571, 2.71428571, 2.07142857,2.42857143, 2.07142857, 2.92857143, 3.42857143, 1.92857143,2.57142857, 1.        , 2.42857143, 2.14285714, 1.71428571,1.78571429, 3.35714286, 1.71428571, 1.85714286, 2.07142857,2.71428571, 1.5       , 1.57142857, 1.14285714, 1.        ,...1.35714286, 3.07142857, 1.42857143, 2.64285714, 1.35714286,2.07142857, 3.        , 1.35714286, 1.85714286, 1.42857143,1.78571429, 2.        , 2.42857143, 1.42857143, 2.        ,3.07142857, 1.5       , 2.        , 2.42857143, 2.        ,2.64285714, 3.92857143, 2.42857143, 2.        , 1.71428571,1.42857143, 2.        , 1.78571429, 1.85714286, 2.78571429,1.14285714, 1.42857143, 2.21428571, 2.07142857, 1.42857143,1.85714286, 2.64285714, 3.5       , 2.        , 2.        ,2.92857143, 1.71428571, 2.57142857, 2.28571429, 1.21428571,2.64285714, 1.21428571, 1.92857143, 1.85714286, 1.5       ,1.5       , 1.        , 1.85714286, 2.28571429, 2.28571429,2.        , 2.85714286, 1.21428571, 2.14285714, 1.71428571,1.42857143, 2.64285714, 1.64285714, 1.57142857, 1.64285714,1.57142857, 1.07142857, 2.07142857, 1.42857143, 2.35714286,2.42857143, 2.42857143, 2.28571429, 1.85714286, 1.42857143,1.78571429, 1.64285714, 1.64285714, 1.07142857, 3.71428571,3.07142857, 2.21428571, 2.14285714, 1.78571429, 2.        ,2.14285714, 3.85714286, 1.64285714, 3.        , 2.64285714,1.71428571, 2.78571429, 1.85714286, 3.14285714, 2.42857143,1.57142857, 1.5       , 2.5       , 3.35714286])

Attributes: (9)

created_at :  
2026-08-29T15:04:49.439530+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

inference_library :  
pymc

inference_library_version :  
6.3.1

sample_dims :  
\[\]

modeling_interface :  
bambi

modeling_interface_version :  
0.20.1.dev78+g69d4473ea.d20260829

/posterior_predictive(11)

Dimensions:

- chain: 4
- draw: 1000
- \_\_obs\_\_: 604

Coordinates: (3)

chain

(chain)

int64

0 1 2 3

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([0, 1, 2, 3])

draw

(draw)

int64

0 1 2 3 4 5 ... 995 996 997 998 999

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 997, 998, 999], shape=(1000,))

\_\_obs\_\_

(\_\_obs\_\_)

int64

0 1 2 3 4 5 ... 599 600 601 602 603

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([  0,   1,   2, ..., 601, 602, 603], shape=(604,))

Data variables: (1)

drugs

(chain, draw, \_\_obs\_\_)

float64

2.016 1.377 0.8983 ... 2.037 1.507

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWZpbGUtdGV4dDIiPjx1c2UgeGxpbms6aHJlZj0iI2ljb24tZmlsZS10ZXh0MiIgLz48L3N2Zz4=)

![](data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiB4ci1pY29uLWRhdGFiYXNlIj48dXNlIHhsaW5rOmhyZWY9IiNpY29uLWRhdGFiYXNlIiAvPjwvc3ZnPg==)

&nbsp;

    array([[[2.01592471, 1.37741519, 0.89834043, ..., 2.39865377,2.10729845, 2.32525296],[2.94741997, 2.10977256, 1.62416021, ..., 2.22623649,2.4355669 , 1.55707702],[2.11427381, 2.69334872, 2.03103999, ..., 1.99907957,2.55897028, 2.28584974],...,[2.2806812 , 2.70611483, 2.08614886, ..., 1.08057064,2.10676998, 1.73899553],[2.75368503, 2.38690162, 1.3907502 , ..., 2.33439701,2.02793886, 1.96384754],[3.30196572, 2.31592958, 1.74665506, ..., 2.41494263,2.21277229, 2.86368504]],[[2.00860936, 2.69069463, 1.5239905 , ..., 1.57402611,1.36923252, 2.28570243],[2.26418539, 2.13334852, 1.91318259, ..., 1.29530658,1.94601778, 1.90151665],[1.59615665, 2.65677369, 1.57149734, ..., 3.23910882,2.65378756, 0.90565241],...[3.15185699, 3.14013337, 1.40550023, ..., 1.08107909,2.24634114, 2.56096772],[2.50136646, 1.64716393, 2.17861749, ..., 2.01630728,2.7451714 , 1.98761549],[3.21946042, 2.19823549, 1.42099828, ..., 1.7412475 ,1.1871131 , 2.53549478]],[[2.24357362, 2.7630804 , 1.4646433 , ..., 2.0953472 ,2.70193163, 2.61350195],[3.01386166, 3.11945351, 1.30792101, ..., 1.82093662,2.59520058, 2.52946884],[2.5438854 , 1.5438917 , 1.48446047, ..., 2.45289442,3.5127992 , 1.8559544 ],...,[1.8691073 , 1.63674322, 3.04274002, ..., 1.67764213,2.896967  , 1.45500531],[2.9817421 , 2.88013838, 1.58483916, ..., 1.60157255,2.43231482, 2.46560419],[2.33075131, 2.80649599, 1.77791664, ..., 1.74768508,2.03716386, 1.50720799]]], shape=(4, 1000, 604))

Attributes: (7)

created_at :  
2026-08-29T15:04:54.191000+00:00

creation_library :  
ArviZ

creation_library_version :  
1.3.0

creation_library_language :  
Python

inference_library :  
pymc

inference_library_version :  
6.3.1

sample_dims :  
\['chain', 'draw'\]

One use of the posterior predictive is as a diagnostic tool, shown below using `az.plot_ppc()`.The blue lines represent the posterior predictive distribution estimates, and the black line represents the observed data. Our posterior predictions seems perform an adequately good job representing the observed data in all regions except near the value of 1, where the observed data and posterior estimates diverge.

``` python
az.plot_ppc_dist(fitted);
```

![](ESCS_multiple_regression_files/figure-html/cell-27-output-1.png)

``` python
%load_ext watermark
%watermark -n -u -v -iv -w
```

    Last updated: Sat, 29 Aug 2026

    Python implementation: CPython
    Python version       : 3.14.7
    IPython version      : 9.16.1

    arviz      : 1.3.0
    bambi      : 0.20.1.dev78+g69d4473ea.d20260829
    matplotlib : 3.11.1
    numpy      : 2.4.6
    pandas     : 2.3.3
    statsmodels: 0.14.6
    xarray     : 2026.7.0

    Watermark: 2.6.0
