Hi,
I am calculating Bayes factors for a moderation effect of ‘past’ on the relationship between ‘pol’ and ‘endorse’.
Please see Case 1 and Case 2( I used ‘update()’ function as you did) below.
Case 1
full_brms_eds2 <- brms::brm(endorse ~ pol * past, data = df2_pw, prior = priors_full_eds1, save_all_pars = TRUE)
null_brms_eds2 <- brms::brm(endorse ~ pol + past, data = df2_pw, prior = priors_full_eds1, save_all_pars = TRUE)
BF_brms_eds2 <- bayes_factor(full_brms_eds2, null_brms_eds2)
BF_brms_eds2
Case 2
full_brms_eds2 <- brms::brm(endorse ~ pol * past, data = df2_pw, prior = priors_full_eds1, save_all_pars = TRUE)
null_brms_eds2 <- update(full_brms_eds2, formula = ~ .-pol:past)
BF_brms_eds2 <- bayes_factor(full_brms_eds2, null_brms_eds2)
BF_brms_eds2
When priors were set, Bayes factors between case 1 and case 2 were very different.
It seems that update() function used previous priors except for the interaction effect.
when I calculated Bayes factors using the priors except for the interaction effect in priors_full_eds1, the results were similar to that calculated using update() function.
priors_full_eds1 <- c(
set_prior('normal(1.4236, .0713)', class = 'sigma'),
set_prior('normal(6.1075, .2745)', class = 'Intercept'),
set_prior('normal(-.2373, .0795)', class = 'b', coef = 'pol'),
set_prior('normal(-2.0210, .4054)', class = 'b', coef = 'past'),
set_prior('normal(.4224, .1149)', class = 'b', coef = 'pol:past') < -the interaction effect
)
priors_null_eds1 <- c(
set_prior('normal(1.4688, .0761)', class = 'sigma'),
set_prior('normal(5.5057, .2301)', class = 'Intercept'),
set_prior('normal(-.0340, .0596)', class = 'b', coef = 'pol'),
set_prior('normal(-.7256, .2080)', class = 'b', coef = 'past')
)
Priors calculated without the interaction effect (priors_null_eds1) would be different from priors calculated with the the interaction effect.
The difference in priors made different results.
Now, I am not sure which way is more appropriate to test the moderating effect.
May I ask you opinion?
Thanks so much in advance.
Kind regards,
IK KIm
- Operating System: Window, R
- brms Version: 2.12