params_to_show <-c("b_Intercept", "b_issue_healthTRUE","phi", "cutzero")m_full_ordbeta |> tidybayes::gather_draws(!!!syms(params_to_show)) |>ggplot(aes(x = .iteration, y = .value, color =factor(.chain))) +geom_line(linewidth =0.1) +scale_color_viridis_d(option ="rocket", end =0.85) +labs(color ="Chain") +facet_wrap(vars(.variable), scales ="free_y")
Trace rank plots (trank plots)
These are histograms of the ranks of the parameter draws across the four chains. If the chains are exploring the same space efficiently, the histograms should be similar and overlapping and no one chain should have a specific rank for a long time (McElreath 2020, 284).
They do.
Code
m_full_ordbeta |> tidybayes::gather_draws(!!!syms(params_to_show)) |>group_by(.variable) |>mutate(draw_rank =rank(.value)) |>ggplot(aes(x = draw_rank, color =factor(.chain))) +stat_bin(geom ="step", binwidth =200, position =position_identity(), boundary =0) +scale_color_viridis_d(option ="rocket", end =0.85) +labs(color ="Chain") +facet_wrap(vars(.variable), scales ="free_y")
Posterior predictions
The model should generate predictions that align with the observed outcomes. It does.