Hi all,
I am a PhD student of cognitive science with the main focus on linguistics. In the past years, I learned how to fit some inferencial statistics models such as LM, Anova and lmer in RStudio. In the last days, I decided to start learning some bayesian approaches to model a bayesian regression model to my data. However, even if I read some documentation, the procedure isn’t clear to me.
Firstly, I will share with you an lmer model to explain what I am trying to fit:
model <- lmer(Total_duration_of_whole_fixations~TOV+Group+(1|Media)+(1|Participant)+(1|CHR),na.action="na.omit", data = data1)
TOV is a non-ordered categorical predictor with three levels: IDIOM, COMP, LEX.
Group is a non-ordered categorical predictor with two levels: GSPE and GCONT,
Media, Participant, and CHR are categorical random effects.
What I tried to do is to fit a bayesian regression with mixed effetct in the following way:
pr = prior(normal(0,1), class="b")
bayesian_mixed = brm(Total_duration_of_whole_fixations~TOV*Group + (1|Participant)+(1|Media)+(1|CHR), data=data1,prior = pr, cores=4)
priors <- get_prior(Total_duration_of_whole_fixations~TOV*Group + (1|Participant)+(1|Media)+(1|CHR), data=data1, family = gaussian())
priors
prior class coef group resp dpar nlpar lb ub source
(flat) b default
(flat) b GroupGSPE (vectorized)
(flat) b TOVIDIOM (vectorized)
(flat) b TOVIDIOM:GroupGSPE (vectorized)
(flat) b TOVLEX (vectorized)
(flat) b TOVLEX:GroupGSPE (vectorized)
student_t(3, 513, 317.3) Intercept default
student_t(3, 0, 317.3) sd 0 default
student_t(3, 0, 317.3) sd CHR 0 (vectorized)
student_t(3, 0, 317.3) sd Intercept CHR 0 (vectorized)
student_t(3, 0, 317.3) sd Media 0 (vectorized)
student_t(3, 0, 317.3) sd Intercept Media 0 (vectorized)
student_t(3, 0, 317.3) sd Participant 0 (vectorized)
student_t(3, 0, 317.3) sd Intercept Participant 0 (vectorized)
student_t(3, 0, 317.3) sigma 0 default
However, I still don’t get a lot of points. First of all, I know that the function “get_prior” is important to set the priors in the “brm” function. However, as my predictor are categorical, “get_prior” doesn’t give any value in the output:
So the first question is: in the case of categorical variables, how do I have to chose and set the priors for the model? Do I have to keep them flat? (I set prior(normal(0,1), class=“b” because I read to do it in a paper, but I am not sure about the meaning of this choice). Also, in the case of continuous values, how I have to insert the values in the model? Do I have to transform them with some calculus? And what about inserting student t values and sigma values?
Second question: how do I understand if the predictors of my model are “significant” or not? To which values of the summary I have to look and how? I attache the summary(model) output here:
summary(bayesian_mixed)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Total_duration_of_whole_fixations ~ TOV * Group + (1 | Participant) + (1 | Media) + (1 | CHR)
Data: data1 (Number of observations: 5236)
Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup draws = 4000
Group-Level Effects:
~CHR (Number of levels: 8)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 27.73 25.42 1.04 90.64 1.01 332 570
~Media (Number of levels: 123)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 129.15 9.85 111.45 150.08 1.01 786 1371
~Participant (Number of levels: 44)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 226.87 24.74 185.52 282.56 1.02 322 694
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 607.64 39.34 528.62 679.88 1.02 185 426
TOVIDIOM 0.05 0.99 -1.84 1.99 1.00 3225 1629
TOVLEX 0.02 1.00 -1.89 1.94 1.00 3796 2925
GroupGSPE -0.03 0.99 -1.96 1.89 1.00 3975 2897
TOVIDIOM:GroupGSPE 0.03 0.99 -1.92 1.90 1.00 3745 2831
TOVLEX:GroupGSPE -0.03 1.00 -1.99 1.93 1.00 3601 2674
Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sigma 322.55 3.15 316.43 328.97 1.00 3111 2173
Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
and Tail_ESS are effective sample size measures, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
Thank you for the help, I hope my explaination are clear.