A model fit's metadata paired with a per-term posterior summary table.
Arguments
- object
A
kb_fitobject.- ...
These dots are for future extensions and must be empty.
- conf_level
A number greater than 0 and less than 1 giving the compatibility-interval level.
- estimate
A function that reduces a numeric vector of posterior draws to a single estimate, such as
medianormean.- sig_fig
A whole number of significant figures for summary output.
- include_random_effects
A flag specifying whether to include the group-level random-effect terms in the output.
- rhat
A number of at least 1 giving the maximum acceptable Rhat.
- ess
A number giving the minimum acceptable bulk and tail effective sample size per chain.
- max_perc_divergent
A number giving the maximum acceptable percentage of saved draws that ended in a divergent transition.
Value
A summary_kb_fit object: a list of fit metadata and a
coefficients tibble with columns term, estimate, lower, upper,
rhat, ess_bulk, ess_tail, and converged.
Details
The printed summary adds the sampler diagnostics (divergent transitions,
maximum treedepth, and E-BFMI). A term's converged uses the Rhat and
effective sample size thresholds of kb_converged(); the fit's verdict also
covers the group-level deviations and divergent transitions
(max_perc_divergent), so it can be FALSE when every term shown has
converged.
Examples
summary(fit_weight_sim_nereo)
#> <summary_kb_fit>
#> Model: Weight (Nereocystis luetkeana)
#> Predictor: diameter_mm, reference 24.9 (geometric mean)
#> Data: 660 observations; groups: site (6), year (6), site:year (33)
#> Draws: 3 chains, 500 post-warmup draws each (thin = 4), 1500 total
#> Converged: TRUE
#>
#> # A tibble: 7 × 8
#> term estimate lower upper rhat ess_bulk ess_tail converged
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 intercept -0.666 -0.918 -0.421 1 1399 1217 TRUE
#> 2 diameter_power 2.92 2.71 3.13 1.00 1399 1345 TRUE
#> 3 weight_floor 0.118 0.098 0.14 1.00 1395 1318 TRUE
#> 4 sd_site 0.2 0.0406 0.521 1.00 733 589 TRUE
#> 5 sd_year 0.0544 0.00298 0.254 1.00 1117 1457 TRUE
#> 6 sd_site_year 0.261 0.179 0.372 1 1082 1460 TRUE
#> 7 sd_residual 0.463 0.438 0.488 1 1348 1425 TRUE
#>
#> estimate: posterior point estimate; lower, upper: 95% compatibility limits.
#> rhat: potential scale reduction factor (1 at convergence).
#> ess_bulk, ess_tail: bulk and tail effective sample sizes.
#> converged: rhat below 1.01 and ess_bulk, ess_tail at least 100 per chain.
#> 0% divergent transitions; 0% max-treedepth; min E-BFMI 1.6.
# Looser thresholds, for a quick exploratory fit:
summary(fit_weight_sim_nereo, rhat = 1.05, ess = 50)
#> <summary_kb_fit>
#> Model: Weight (Nereocystis luetkeana)
#> Predictor: diameter_mm, reference 24.9 (geometric mean)
#> Data: 660 observations; groups: site (6), year (6), site:year (33)
#> Draws: 3 chains, 500 post-warmup draws each (thin = 4), 1500 total
#> Converged: TRUE
#>
#> # A tibble: 7 × 8
#> term estimate lower upper rhat ess_bulk ess_tail converged
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 intercept -0.666 -0.918 -0.421 1 1399 1217 TRUE
#> 2 diameter_power 2.92 2.71 3.13 1.00 1399 1345 TRUE
#> 3 weight_floor 0.118 0.098 0.14 1.00 1395 1318 TRUE
#> 4 sd_site 0.2 0.0406 0.521 1.00 733 589 TRUE
#> 5 sd_year 0.0544 0.00298 0.254 1.00 1117 1457 TRUE
#> 6 sd_site_year 0.261 0.179 0.372 1 1082 1460 TRUE
#> 7 sd_residual 0.463 0.438 0.488 1 1348 1425 TRUE
#>
#> estimate: posterior point estimate; lower, upper: 95% compatibility limits.
#> rhat: potential scale reduction factor (1 at convergence).
#> ess_bulk, ess_tail: bulk and tail effective sample sizes.
#> converged: rhat below 1.05 and ess_bulk, ess_tail at least 50 per chain.
#> 0% divergent transitions; 0% max-treedepth; min E-BFMI 1.6.