0

I am learning about the MCMC diagnostics. I use rstanarm to fit a simple model and I want do some diagnostic plots with bayesplot. Nevertheless, the mcmc_paracord() wont put the np values on the plot. Other plots using np values are not working as well. I am using R version 4.1.3 on Windows 10.

Here is the code for replication.

library(rstanarm)
library(bayesplot)
library(ggplot2)
set.seed(2137)
fit <- stan_glm(mpg ~ wt + disp, data = mtcars)
draws <- as.array(fit)
np <- nuts_params(fit)
color_scheme_set("viridis")
mcmc_parcoord(draws,   
  transform = function(x) {(x - mean(x)) / sd(x)},
  np = np)

I tried to change the np style but with no success.

library(rstanarm)
library(bayesplot)
library(ggplot2)
set.seed(2137)
fit <- stan_glm(mpg ~ wt + disp, data = mtcars)
draws <- as.array(fit)
np <- nuts_params(fit)
color_scheme_set("viridis")
div_style <- parcoord_style_np(div_color = "red", div_size = 0.5, div_alpha = 0.1)
mcmc_parcoord(draws,   
  transform = function(x) {(x - mean(x)) / sd(x)},
  np = np,
  np_style = div_style)

0 Answers0