Dear,
I have some basics with STAN, and would like to move to the brms package for data analysis.
I would like to correlate a metric to several variable (6 traits) and I also included 2 random effects.
The model looks like
Y ~ trait1 + trait2+ trait3 … + trait6 + (1 | Site2) + (1| Group)
At this time I have some issue with my model. Basically I have tested a model with a gaussian familiy, but it seems that the response variable is not “symetric”, and so I also tested another model with a skewed normal family, because values are both negatives/positives.
I have found some informations about families here :
https://cran.r-project.org/web/packages/brms/vignettes/brms_families.html
The R model looks like this
#linear model 1 with brms
fit1 <- brm(metric ~ trait1 + trait2 + trait3 + trait4 + trait5 + trait6 +
(1 | Group) + (1| Site2), # random effect
data = data,
family = gaussian(),
iter = 3000, warmup = 1500, thin = 5, chains = 3)
#fit with skewed family
fit2 <- brm(metric ~ trait1 + trait2 + trait3 + trait4 + trait5 + trait6 +
(1 | Group) + (1| Site2), # random effect
data = data,
family = skew_normal(),
iter = 3000, warmup = 1500, thin = 5, chains = 3)
I also found in another forum that they used a similar approach with a skewed distribution (even if it seems that in their case the distribution in right-skewed, and left-skewed in my case, see here bayesian - how to specify a distribution for left skewed data? - Cross Validated). And then when I am checking the model with loo, some observations have a pareto_k > 7 (and even few more observations with the model based on skewed distribution).
even if they are few observations is fine to keep for example the gaussian family?
The data that I used, and the code is attached hereafter
testbrms.csv (186.5 KB)
testbrms.R (1.2 KB)
I also found some other useful forum for example Gaussian vs. skew-normal model selection - #16 by julianquandt but it is not the same kind of data.