Closed rbcavanaugh closed 1 year ago
This is due to the new Group
column for Bayesian models, which doesn't work nicely with insight::print_parameters()
. I think we can just remove the special class for Bayesian models and treat it like any other model (regarding formatting/printing). I'm testing this in PR #825 - you can install from that PR and test some models for yourself and report any issues, if you like.
Current state of the PR:
library(parameters)
library(brms)
library(lme4)
data(sleepstudy)
model1 <- lmer(Sepal.Width ~ Petal.Length + (1 | Species), data = iris)
model_parameters(model1, effects = "all")
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t(146) | p
#> ------------------------------------------------------------------
#> (Intercept) | 2.00 | 0.56 | [0.89, 3.11] | 3.56 | < .001
#> Petal Length | 0.28 | 0.06 | [0.16, 0.40] | 4.75 | < .001
#>
#> # Random Effects
#>
#> Parameter | Coefficient | SE | 95% CI
#> -----------------------------------------------------------
#> SD (Intercept: Species) | 0.89 | 0.46 | [0.33, 2.43]
#> SD (Residual) | 0.32 | 0.02 | [0.28, 0.35]
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation. Uncertainty intervals for
#> random effect variances computed using a Wald z-distribution
#> approximation.
model2 <- suppressWarnings(brm(Sepal.Width ~ Petal.Length + (1 | Species), data = iris, refresh = 0))
model_parameters(model2, effects = "all")
#> # Fixed Effects
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------
#> (Intercept) | 1.99 | [0.48, 3.55] | 98.98% | 1.009 | 825.00
#> Petal.Length | 0.28 | [0.16, 0.41] | 100% | 1.002 | 1924.00
#>
#> # Sigma
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------
#> sigma | 0.32 | [0.28, 0.36] | 100% | 1.003 | 2188.00
#>
#> # Random Effects Variances
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ------------------------------------------------------------------------
#> SD (Intercept: Species) | 1.21 | [0.49, 3.48] | 100% | 1.003 | 1113.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
model3 <- lmer(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy)
model_parameters(model3, effects = "all")
#> # Fixed Effects
#>
#> Parameter | Coefficient | SE | 95% CI | t(174) | p
#> ---------------------------------------------------------------------
#> (Intercept) | 251.41 | 6.82 | [237.94, 264.87] | 36.84 | < .001
#> Days | 10.47 | 1.55 | [ 7.42, 13.52] | 6.77 | < .001
#>
#> # Random Effects
#>
#> Parameter | Coefficient | SE | 95% CI
#> -------------------------------------------------------------------
#> SD (Intercept: Subject) | 24.74 | 5.84 | [15.58, 39.28]
#> SD (Days: Subject) | 5.92 | 1.25 | [ 3.92, 8.95]
#> Cor (Intercept~Days: Subject) | 0.07 | 0.32 | [-0.51, 0.60]
#> SD (Residual) | 25.59 | 1.51 | [22.80, 28.72]
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a Wald t-distribution approximation. Uncertainty intervals for
#> random effect variances computed using a Wald z-distribution
#> approximation.
model4 <- suppressWarnings(brm(Reaction ~ Days + (1 + Days | Subject), data = sleepstudy, refresh = 0))
model_parameters(model4, effects = "all")
#> # Fixed Effects
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------------
#> (Intercept) | 251.13 | [237.02, 264.93] | 100% | 1.001 | 2051.00
#> Days | 10.44 | [ 7.17, 13.81] | 100% | 1.002 | 1611.00
#>
#> # Sigma
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ------------------------------------------------------------
#> sigma | 25.80 | [23.09, 29.36] | 100% | 1.002 | 3269.00
#>
#> # Random Effects Variances
#>
#> Parameter | Median | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------------------------------
#> SD (Intercept: Subject) | 25.90 | [15.34, 41.58] | 100% | 1.001 | 1667.00
#> SD (Days: Subject) | 6.32 | [ 4.06, 10.01] | 100% | 1.002 | 1592.00
#> Cor (Intercept~Days: Subject) | 0.10 | [-0.47, 0.70] | 62.75% | 1.001 | 1032.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
Created on 2022-12-21 with reprex v2.0.2
library(easystats)
library(brms)
m <- download_model("brms_1")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------
#> (Intercept) | 39.68 | [36.12, 43.27] | 100% | 1.000 | 5242.00
#> wt | -3.21 | [-4.79, -1.65] | 99.95% | 1.000 | 2071.00
#> cyl | -1.50 | [-2.36, -0.64] | 99.95% | 1.000 | 1951.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------
#> sigma | 2.67 | [2.06, 3.51] | 100% | 1.000 | 2390.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: mpg ~ wt + cyl
#> Data: mtcars (Number of observations: 32)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 39.68 1.81 36.12 43.27 1.00 5283 3255
#> wt -3.21 0.81 -4.79 -1.65 1.00 2120 2003
#> cyl -1.50 0.44 -2.36 -0.64 1.00 2001 2227
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 2.67 0.37 2.06 3.51 1.00 2534 2415
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_mixed_1")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -----------------------------------------------------------
#> (Intercept) | 33.55 | [24.17, 40.87] | 100% | 1.091 | 24.00
#> wt | -4.49 | [-6.95, -1.68] | 100% | 1.192 | 10.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -------------------------------------------------------
#> sigma | 2.56 | [1.95, 3.48] | 100% | 1.015 | 454.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------------
#> SD (Intercept: cyl) | 3.00 | [ 0.39, 9.19] | 100% | 1.080 | 32.00
#> SD (Intercept: gear) | 3.88 | [ 0.21, 10.30] | 100% | 1.010 | 424.00
#> SD (wt: gear) | 1.96 | [ 0.06, 5.06] | 100% | 1.385 | 9.00
#> Cor (Intercept~wt: gear) | -0.25 | [-0.99, 0.83] | 62.48% | 1.106 | 36.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: mpg ~ wt + (1 | cyl) + (1 + wt | gear)
#> Data: mtcars (Number of observations: 32)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~cyl (Number of levels: 3)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 3.00 2.34 0.39 9.19 1.11 28 575
#>
#> ~gear (Number of levels: 3)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 3.88 2.84 0.21 10.30 1.28 415 916
#> sd(wt) 1.96 1.60 0.06 5.06 1.22 14 186
#> cor(Intercept,wt) -0.25 0.57 -0.99 0.83 1.08 43 85
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 33.55 4.23 24.17 40.87 1.09 35 157
#> wt -4.49 1.44 -6.95 -1.68 1.17 18 81
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 2.56 0.38 1.95 3.48 1.29 414 541
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_mixed_2")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------------
#> (Intercept) | 251.32 | [237.00, 265.98] | 100% | 1.001 | 1621.00
#> Days | 10.44 | [ 6.84, 13.91] | 100% | 1.004 | 1161.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -----------------------------------------------------------
#> sigma | 25.94 | [23.05, 29.38] | 100% | 1.000 | 3672.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------------------
#> SD (Intercept: Subject) | 26.63 | [15.46, 42.36] | 100% | 1.002 | 1823.00
#> SD (Days: Subject) | 6.58 | [ 4.12, 10.16] | 100% | 1.000 | 1228.00
#> Cor (Intercept~Days: Subject) | 0.09 | [-0.47, 0.67] | 60.42% | 1.003 | 899.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: Reaction ~ Days + (1 + Days | Subject)
#> Data: sleepstudy (Number of observations: 180)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~Subject (Number of levels: 18)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 26.63 6.77 15.46 42.36 1.00 1858 2683
#> sd(Days) 6.58 1.59 4.12 10.16 1.00 1355 1961
#> cor(Intercept,Days) 0.09 0.30 -0.47 0.67 1.00 912 1625
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 251.32 7.31 237.00 265.98 1.00 1626 2415
#> Days 10.44 1.75 6.84 13.91 1.00 1224 1641
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 25.94 1.59 23.05 29.38 1.00 3686 2781
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_mixed_3")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------------
#> (Intercept) | 250.84 | [228.76, 272.54] | 100% | 1.003 | 786.00
#> Days | 10.37 | [ 8.77, 11.96] | 100% | 0.999 | 6026.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -----------------------------------------------------------
#> sigma | 30.03 | [26.27, 34.03] | 100% | 0.999 | 2102.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ----------------------------------------------------------------------------
#> SD (Intercept: grp) | 8.22 | [ 0.44, 25.69] | 100% | 1.000 | 1604.00
#> SD (Intercept: grp:subgrp) | 7.41 | [ 0.44, 16.87] | 100% | 1.003 | 770.00
#> SD (Intercept: Subject) | 38.51 | [26.89, 55.98] | 100% | 1.003 | 1254.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: Reaction ~ Days + (1 | grp/subgrp) + (1 | Subject)
#> Data: sleepstudy (Number of observations: 180)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~grp (Number of levels: 5)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 8.22 6.92 0.44 25.69 1.00 1455 1788
#>
#> ~grp:subgrp (Number of levels: 70)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 7.41 4.61 0.44 16.87 1.00 793 1480
#>
#> ~Subject (Number of levels: 18)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 38.51 7.48 26.89 55.98 1.00 1243 1893
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 250.84 11.20 228.76 272.54 1.00 803 1607
#> Days 10.37 0.81 8.77 11.96 1.00 6123 2848
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 30.03 1.99 26.27 34.03 1.00 2150 2289
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_mixed_4")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ------------------------------------------------------------
#> (Intercept) | 2.57 | [0.70, 4.84] | 99.42% | 1.012 | 292.00
#> Petal.Width | 1.05 | [0.73, 1.37] | 100% | 1.002 | 2150.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------
#> sigma | 0.38 | [0.34, 0.43] | 100% | 1.001 | 2642.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------
#> SD (Intercept: Species) | 1.68 | [0.64, 3.64] | 100% | 1.003 | 796.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: Petal.Length ~ Petal.Width + (1 | Species)
#> Data: iris (Number of observations: 150)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~Species (Number of levels: 3)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 1.68 0.80 0.64 3.64 1.01 1001 774
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 2.57 0.96 0.70 4.84 1.01 425 197
#> Petal.Width 1.05 0.16 0.73 1.37 1.00 2191 2213
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 0.38 0.02 0.34 0.43 1.00 2653 2011
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_mixed_7")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------------
#> (Intercept) | 33.06 | [24.70, 40.47] | 100% | 1.006 | 744.00
#> wt | -4.39 | [-6.94, -1.76] | 99.72% | 1.025 | 83.00
#>
#> # Sigma
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -------------------------------------------------------
#> sigma | 2.59 | [1.96, 3.48] | 100% | 1.010 | 608.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------------
#> SD (Intercept: cyl) | 3.19 | [ 0.49, 9.00] | 100% | 1.001 | 651.00
#> SD (Intercept: gear) | 3.76 | [ 0.14, 10.13] | 100% | 1.015 | 643.00
#> SD (wt: gear) | 1.47 | [ 0.06, 3.96] | 100% | 1.039 | 94.00
#> Cor (Intercept~wt: gear) | -0.38 | [-0.99, 0.82] | 76.85% | 1.003 | 854.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: gaussian
#> Links: mu = identity; sigma = identity
#> Formula: mpg ~ wt + (1 | cyl) + (1 + wt | gear)
#> Data: mtcars (Number of observations: 32)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Group-Level Effects:
#> ~cyl (Number of levels: 3)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 3.19 2.35 0.49 9.00 1.00 549 350
#>
#> ~gear (Number of levels: 3)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 3.76 2.76 0.14 10.13 1.02 592 1264
#> sd(wt) 1.47 1.20 0.06 3.96 1.03 115 660
#> cor(Intercept,wt) -0.38 0.52 -0.99 0.82 1.02 915 893
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 33.06 3.96 24.70 40.47 1.02 712 666
#> wt -4.39 1.39 -6.94 -1.76 1.02 98 102
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sigma 2.59 0.38 1.96 3.48 1.01 605 902
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_zi_1")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -------------------------------------------------------------
#> (Intercept) | -1.07 | [-1.42, -0.73] | 100% | 1.000 | 3259.00
#> persons | 0.90 | [ 0.81, 0.99] | 100% | 1.000 | 3305.00
#> child | -1.17 | [-1.37, -0.99] | 100% | 1.000 | 3224.00
#> camper | 0.74 | [ 0.56, 0.94] | 100% | 1.000 | 4166.00
#>
#> # Zero-Inflation
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------------
#> (Intercept) | -0.58 | [-1.27, 0.08] | 95.97% | 1.000 | 4494.00
#> child | 1.24 | [ 0.71, 1.82] | 100% | 1.000 | 4195.00
#> camper | -0.62 | [-1.38, 0.11] | 94.73% | 1.000 | 4427.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
#>
#> The model has a log- or logit-link. Consider using `exponentiate =
#> TRUE` to interpret coefficients as ratios.
summary(m)
#> Family: zero_inflated_poisson
#> Links: mu = log; zi = logit
#> Formula: count ~ persons + child + camper
#> zi ~ child + camper
#> Data: zinb (Number of observations: 250)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept -1.07 0.18 -1.42 -0.73 1.00 3304 2806
#> zi_Intercept -0.58 0.34 -1.27 0.08 1.00 4543 2969
#> persons 0.90 0.05 0.81 0.99 1.00 3354 3057
#> child -1.17 0.10 -1.37 -0.99 1.00 3306 2560
#> camper 0.74 0.10 0.56 0.94 1.00 4220 2879
#> zi_child 1.24 0.28 0.71 1.82 1.00 4168 2872
#> zi_camper -0.62 0.38 -1.38 0.11 1.00 4367 3040
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_zi_3")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> # Fixed Effects (Count Model)
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------------
#> (Intercept) | 0.96 | [-0.81, 2.51] | 90.00% | 1.011 | 110.00
#> child | -1.16 | [-1.36, -0.94] | 100% | 0.996 | 278.00
#> camper | 0.72 | [ 0.54, 0.91] | 100% | 0.996 | 271.00
#>
#> # Fixed Effects (Zero-Inflation Component)
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> --------------------------------------------------------------
#> (Intercept) | -0.51 | [-2.03, 0.89] | 78.00% | 0.997 | 138.00
#> child | 1.86 | [ 1.19, 2.54] | 100% | 0.996 | 303.00
#> camper | -0.86 | [-1.61, -0.07] | 98.40% | 0.996 | 292.00
#>
#> # Random Effects Variances
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------
#> SD (Intercept: persons) | 1.58 | [0.71, 3.58] | 100% | 1.010 | 126.00
#>
#> # Random Effects (Zero-Inflation Component)
#>
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> ---------------------------------------------------------------------
#> SD (Intercept: persons) | 1.49 | [0.63, 3.41] | 100% | 0.996 | 129.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
summary(m)
#> Family: zero_inflated_poisson
#> Links: mu = log; zi = logit
#> Formula: count ~ child + camper + (1 | persons)
#> zi ~ child + camper + (1 | persons)
#> Data: zinb (Number of observations: 250)
#> Draws: 1 chains, each with iter = 500; warmup = 250; thin = 1;
#> total post-warmup draws = 250
#>
#> Group-Level Effects:
#> ~persons (Number of levels: 4)
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> sd(Intercept) 1.58 0.74 0.71 3.58 1.01 128 133
#> sd(zi_Intercept) 1.49 0.72 0.63 3.41 1.01 124 161
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept 0.96 0.82 -0.81 2.51 1.01 114 152
#> zi_Intercept -0.51 0.72 -2.03 0.89 1.01 149 161
#> child -1.16 0.10 -1.36 -0.94 1.00 258 190
#> camper 0.72 0.10 0.54 0.91 1.02 294 113
#> zi_child 1.86 0.33 1.19 2.54 1.00 321 241
#> zi_camper -0.86 0.40 -1.61 -0.07 1.00 286 137
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
m <- download_model("brms_ordinal_1")
model_parameters(m, effects = "all", component = "all", centrality = "mean")
#> Parameter | Mean | 95% CI | pd | Rhat | ESS
#> -----------------------------------------------------------------
#> Intercept[1] | -38.42 | [-67.76, -19.66] | 100% | 1.002 | 992.00
#> Intercept[2] | -33.26 | [-59.09, -16.53] | 100% | 1.001 | 1039.00
#> mpg | -1.80 | [ -3.20, -0.90] | 100% | 1.002 | 1021.00
#>
#> Uncertainty intervals (equal-tailed) and p-values (two-tailed) computed
#> using a MCMC distribution approximation.
#>
#> The model has a log- or logit-link. Consider using `exponentiate =
#> TRUE` to interpret coefficients as ratios.
summary(m)
#> Family: cumulative
#> Links: mu = logit; disc = identity
#> Formula: cyl_ord ~ mpg
#> Data: mtcars (Number of observations: 32)
#> Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
#> total post-warmup draws = 4000
#>
#> Population-Level Effects:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> Intercept[1] -38.42 12.46 -67.76 -19.66 1.00 1154 1121
#> Intercept[2] -33.26 11.04 -59.09 -16.53 1.00 1223 1111
#> mpg -1.80 0.59 -3.20 -0.90 1.00 1197 1172
#>
#> Family Specific Parameters:
#> Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
#> disc 1.00 0.00 1.00 1.00 NA NA NA
#>
#> Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
#> and Tail_ESS are effective sample size measures, and Rhat is the potential
#> scale reduction factor on split chains (at convergence, Rhat = 1).
Created on 2022-12-21 with reprex v2.0.2
@easystats/core-team can we add some snapshot tests for the print-methods? Since we download the models, they shouldn't change in their output.
I didn't see an issue for this, but apologies if I've missed it. I noticed this when trying to print a cumulative probit model. I think this is new as I've fairly positive I've used the
model_parameters()
with {brms} models in the past. I do notice that the group-level/random effects are saved to a dataframe if you save the result ofmodel_parameters()
to a variable so perhaps its just something with the printing function.As a very minor note, it might be helpful in the documentation for the effects argument of
model_parameters()
to indicate that you should put effects = "all" instead of "both". Currently, the documentation reads:Thanks for a great package!
Reprex:
Created on 2022-12-17 with reprex v2.0.2