I will take a look to the quoted posts.
Regarding priors, let me see if I understood. As I said, I know that in my field IDIOM forms are usually read slowly than COMP and LEX forms. Also, COMP are read faster than LEX. As this is the “normality” in my field, I should consider a normal prior, let’s say (-1, 1) Question: why you choose -0.5, 0.5 and not -1, 1? Also, TOVIDIOM is generally read slower, thus it is better to put a negative prior like (-1,0)?
On the other side, there are contrastant information about how much fast is the experimental group in comparison to control group, then we cannot be sure about the interaction of TOVGroup. Thus, it is better to not specify a prior for Group and TOVGroup.
###Here the basic model with no priors###
summary(model)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Total_duration_of_whole_fixations ~ Group * TOV + (1 | Participant) + (1 | Media) + (1 | CHR)
Data: PHMATPRTLEXGSGC22 (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) 28.19 24.38 1.00 90.24 1.01 407 1023
~Media (Number of levels: 123)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 129.88 9.84 111.84 150.31 1.00 1031 1628
~Participant (Number of levels: 44)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 230.74 26.08 183.82 286.16 1.01 428 851
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 580.93 56.66 469.03 690.55 1.01 274 605
GroupGSPE 4.70 66.24 -120.79 137.98 1.01 250 537
TOVIDIOM 58.97 33.70 -4.13 123.25 1.00 724 1315
TOVLEX 34.58 33.43 -31.08 102.78 1.01 765 1070
GroupGSPE:TOVIDIOM -18.90 22.28 -61.68 25.91 1.00 3723 2865
GroupGSPE:TOVLEX -22.89 22.24 -66.14 21.37 1.00 3391 2777
Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sigma 322.42 3.26 316.18 328.86 1.00 4938 2874
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).
Messaggio di avvertimento:
There were 4 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
#Here the model with normal prior###
However, the code should result as follows:
priors <- get_prior(Total_duration_of_whole_fixations~TOV*Group + (1|Participant)+(1|Media)+(1|CHR), data=PHMATPRTLEXGSGC22, family = gaussian())
> priors
prior class coef group resp dpar nlpar lb ub
(flat) b
(flat) b GroupGSPE
(flat) b TOVIDIOM
(flat) b TOVIDIOM:GroupGSPE
(flat) b TOVLEX
(flat) b TOVLEX:GroupGSPE
student_t(3, 513, 317.3) Intercept
student_t(3, 0, 317.3) sd 0
student_t(3, 0, 317.3) sd CHR 0
student_t(3, 0, 317.3) sd Intercept CHR 0
student_t(3, 0, 317.3) sd Media 0
student_t(3, 0, 317.3) sd Intercept Media 0
student_t(3, 0, 317.3) sd Participant 0
student_t(3, 0, 317.3) sd Intercept Participant 0
student_t(3, 0, 317.3) sigma 0
source
default
(vectorized)
(vectorized)
(vectorized)
(vectorized)
(vectorized)
default
default
(vectorized)
(vectorized)
(vectorized)
(vectorized)
(vectorized)
(vectorized)
default
prior1 <- c(set_prior("normal(-1,1)", class = "b", coef = "TOVIDIOM"))
model <- brm(
Total_duration_of_whole_fixations ~ Group*TOV + (1 | Participant) + (1 | Media) + (1 | CHR),
data = PHMATPRTLEXGSGC22,
family = gaussian(),
prior = prior1,
cores = 4,
chains = 4000
)
As you can see, I didn’t insert sigma because I don’t consider the fixed as slopes. For the same reason, I didn’t insert mean and sd of the dependent variable because the intercept isn’t a slope too (I based my reasoning on the following documentation: 20 Metric Predicted Variable with Multiple Nominal Predictors | Doing Bayesian Data Analysis in brms and the tidyverse (bookdown.org); WAMBS BRMS Tutorial: Popularity Data - Rens van de Schoot.
Then I ran the model:
summary(model)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Total_duration_of_whole_fixations ~ Group * TOV + (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.53 24.89 1.06 90.89 1.01 388 1120
~Media (Number of levels: 123)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 131.74 10.00 113.72 152.93 1.00 867 1884
~Participant (Number of levels: 44)
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sd(Intercept) 233.02 26.06 188.43 290.30 1.01 727 1330
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
Intercept 609.93 50.64 513.08 709.79 1.01 455 1057
GroupGSPE 0.07 69.67 -135.25 137.94 1.00 411 710
TOVIDIOM -0.94 0.99 -2.89 1.01 1.00 4992 3108
TOVLEX 4.68 29.59 -51.45 62.75 1.01 764 1154
GroupGSPE:TOVIDIOM -7.02 20.79 -48.92 32.16 1.00 2484 2583
GroupGSPE:TOVLEX -17.41 21.28 -58.89 24.41 1.00 3448 2755
Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
sigma 322.47 3.19 316.28 328.57 1.00 5699 2784
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).
Messaggio di avvertimento:
There were 5 divergent transitions after warmup. Increasing adapt_delta above 0.8 may help. See http://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
I don’t know how to solve the problem of divergence.
> posterior_summary(model)
Estimate Est.Error
b_Intercept 6.099277e+02 50.6354292
b_GroupGSPE 6.684205e-02 69.6677981
b_TOVIDIOM -9.436583e-01 0.9892072
b_TOVLEX 4.677137e+00 29.5857016
b_GroupGSPE:TOVIDIOM -7.015661e+00 20.7870523
b_GroupGSPE:TOVLEX -1.740856e+01 21.2801373
sd_CHR__Intercept 2.752778e+01 24.8887828
sd_Media__Intercept 1.317403e+02 10.0005821
sd_Participant__Intercept 2.330224e+02 26.0596789
sigma 3.224679e+02 3.1892878
After that, I thought that TOVIDIOM presents slower RT in comparison to the other levels, but from previous anaylisis I saw that while the differences with TOVCOMP were little, with TOVLEX were wider. Thus, I opted for a (-1,0) prior:
prior1 <- c(set_prior("normal(-1,0)", class = "b", coef = "TOVIDIOM"))
However, the model doesn’t work with this kind of prior:
summary(model)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Total_duration_of_whole_fixations ~ Group * TOV + (1 | Participant) + (1 | Media) + (1 | CHR)
Data: PHMATPRTLEXGSGC22 (Number of observations: 5236)
The model does not contain posterior draws.
And even if set put chain=1, another error pops out:
Chain 1: Rejecting initial value:
Chain 1: Error evaluating the log probability at the initial value.
Chain 1: Exception: normal_lpdf: Scale parameter is 0, but must be positive! (in 'string', line 57, column 2 to column 37)
Chain 1:
Chain 1: Initialization between (-2, 2) failed after 100 attempts.
Chain 1: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
[1] "Error : Initialization failed."
[1] "error occurred during calling the sampler; sampling not done"
Sorry for the wall of text, I am still trying to understand clearly what I am doing.