Skip to content

Instantly share code, notes, and snippets.

@MJacobs1985
Last active December 11, 2021 12:41
Show Gist options
  • Select an option

  • Save MJacobs1985/d643fd0f9e38dc9273c93192c24e5afa to your computer and use it in GitHub Desktop.

Select an option

Save MJacobs1985/d643fd0f9e38dc9273c93192c24e5afa to your computer and use it in GitHub Desktop.
options(mc.cores=parallel::detectCores())
model4<- stan_glmer(
ADG~ADF +
Challenge +
Included2017 +
BW_start+Country+
n_start+
(ADF|Studycode),
data = d, family = gaussian,
prior_intercept = normal(100,3, autoscale = TRUE),
prior = normal(0, 2.5, autoscale = TRUE),
prior_aux = normal(9, 3, autoscale = TRUE),
prior_covariance = decov(reg = 1, conc = 1, shape = 1, scale = 1),
chains = 4, iter = 5000*2, seed = 84735)
loo_4 <- loo(model4)
print(loo_4)
loo_compare(loo_2, loo_3, loo_4)
mcmc_trace(model4, size = 0.1)
complete_summary <- tidy(model4,
effects = c("fixed", "ran_vals", "aux"),
conf.int = TRUE, conf.level = 0.80)
print(tbl_df(complete_summary), n=41)
mcmc_areas(model4, pars = vars(starts_with("b[(I")), prob = 0.8) +
geom_vline(xintercept = 0) + scale_x_continuous(limits = c(-0.5, 0.5))
mcmc_areas(model4, pars = vars(starts_with("b[A")), prob = 0.8) +
geom_vline(xintercept = 0)
neff_ratio(model4)
rhat(model4)
pp_check(model4) + labs(x = "ADG", title = "model4")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment