Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Object position BRMS model
- # Load in results and libraries
- library(brms)
- library(loo)
- mc.cores=2
- # Set dictionary with dataset.txt
- data <- read.table("dataset.txt", header = T)
- # BRMS: Non-linear model - Ellipse
- # Define Priors
- prior1 <- prior(normal(0, 1, lb = 0), nlpar = "a") +
- prior(lognormal(0, 2), nlpar = "b")
- priors <- c(set_prior("normal(0,2)", nlpar = "a", lb = 0),
- set_prior("normal(0,2)", nlpar = "b", lb = 0))
- nlModel <- brm(bf(Distance ~ sqrt(a ^ 2 * sin(Angle)^2 + b^2 * cos(Angle)^2),
- a ~ 1, b ~ 1,
- nl = TRUE), data = data, prior = priors, cores = 2, chains = 2)
- marginal_effects(nlModel)
- pp_check(nlModel)
- plot(nlModel)
- # BRMS: Linear model - One category per angle
- data$anglesF <- as.factor(data$Angle)
- lModel <- mComplex <- brm(Distance ~-1+anglesF +(1|Part), data = data, chains = 2, iter=2000, cores = 2)
- marginal_effects(lModel)
- pp_check(lModel)
- # Compare models with loo
- loo(nlModel,lModel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement