I am fitting a bayesian linear mixed model in R with 6 variables and 2 random effects. Inclusion of all 6 variables is motivated by a well-founded hypothesis. Does it make sense to do variable selection or can I report whether or not each fixed effect has an effect on the dependent variable (CI does not overlap 0)? And then, perhaps, compare the final model to an intercept only model using LOOIC to evaluate model fit? Or run the full model, select only the significant variables, and compare?
If I should do stepwise variable selection is there a way to automate it as with dredge() in MuMIn?
I am trying to figure out the most correct way to test if each covariate has an effect on y without running ~100 models (which I would have to do to examine model fit for all combinations of covariates).
eg,
library(brms)
library(loo)
model.full <- brm(data = data,
family = gaussian,
formula = y1 ~ x1 + x2 + x3 + x4 + x5 + x6 +
(1|r1) + (1|r2),
prior = c(prior(normal(0, 10), class = Intercept),
prior(cauchy(0, 1), class = sd),
prior(cauchy(0, 1), class = sigma)),
iter = 2000, warmup = 1000, chains = 4, cores = 2,
control = list(adapt_delta = .975, max_treedepth = 20),
seed = 12261996)
model.intercept <- brm(data = data,
family = gaussian,
formula = y1 ~ 1 +
(1|r1) + (1|r2),
prior = c(prior(normal(0, 10), class = Intercept),
prior(cauchy(0, 1), class = sd),
prior(cauchy(0, 1), class = sigma)),
iter = 2000, warmup = 1000, chains = 4, cores = 2,
control = list(adapt_delta = .975, max_treedepth = 20),
seed = 12261996)
loo(model.full, model.intercept)