Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Generate data
- halfnorm <- rnorm(5000, mean=0,sd=20)
- halfnorm <- abs(halfnorm)
- unf <- runif(1000, min = 40, max = 180)
- dist <- c(halfnorm,unf)
- # Inspect distributions
- hist(dist)
- hist(log(dist))
- # Make dataframe (with 10 random IDs)
- id <- rep(1:10,(length(dist)/10))
- sim <- data.frame(dist,id)
- # Import libraries for modelling
- library(loo)
- library(brms)
- options(mc.cores = 2)
- # Default method
- m0 <- brm(dist ~ (1|id), data = sim, chains = 2,iter = 3000, warmup = 1000)
- pp_check(m0)
- # Log method
- m0log <- brm(log(dist) ~ (1|id), data = sim, chains = 2,iter = 3000, warmup = 1000)
- pp_check(m0log)
Advertisement
Add Comment
Please, Sign In to add comment