Created
December 10, 2021 20:56
-
-
Save MJacobs1985/ff8f21f74c0a2f3d202852f4c0ff25ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Book<- read_excel("X:/StatisticsPlatform/Website/ELearning/Workshops/Bayesian Analysis/Data/Book1.xlsx") | |
| d<-Book%>%dplyr::select(ADG,ADF,Country,Days,BW_start,n_start,Challenge,Studycode,Included2017) | |
| d<-d[complete.cases(d), ] | |
| d$Studycode<-as.factor(d$Studycode) | |
| d$Challenge<-as.factor(d$Challenge) | |
| d$Country<-as.factor(d$Country) | |
| model3<- stan_glmer( | |
| ADG~ADF + | |
| Challenge + | |
| Included2017 + | |
| BW_start+Country+ | |
| n_start+ | |
| (1|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_2 <- loo(model2) | |
| loo_3 <- loo(model3) | |
| loo_compare(loo_2, loo_3) | |
| complete_summary <- tidy(model3, | |
| effects = c("fixed", "ran_vals", "aux"), | |
| conf.int = TRUE, conf.level = 0.80) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment