I was wondering if my semantic was correct when I constructed the orthogonal contrasts.
I have 3 factors: bodysite, Pattern and Strength. I did the following coding
Bodysite Contracts
contrasts(df.cleaned$Bodysite) <- cbind(back_vs_front=c(-1, -1 ,2), chest_vs_abdomen=c(-1, 1, 0))
Pattern Contrasts
contrasts(df.cleaned$Pattern) <- cbind(vertical_vs_horizontal=c(-1, 0 ,1))
Strength Contrasts
contrasts(df.cleaned$Strength) <- cbind(Strong_exhale_vs_Strong_inhale=c(1, -1))
Then I fit the model:
fit.brm.PA.NA = brm(formula = PA - NA. ~ Bodysite + Pattern * Strength + (1 |id),
data = df.cleaned,
file = “PA.NA4.brm”)
then I mutated the four hypothesis:
fit.brm.PA.NA %>%
posterior_samples() %>%
clean_names() %>%
select(starts_with(“b_”)) %>%
mutate(hypothesis_1 = b_intercept + b_bodysiteback_vs_front > b_intercept,
hypothesis_2 = b_intercept + b_bodysitechest_vs_abdomen > b_intercept,
hypothesis_3 = b_intercept + b_patternvertical_vs_horizontal > b_intercept,
hypothesis_4 = b_strength_strong_exhale_vs_strong_inhale + b_intercept > b_intercept,
hypotheses_joint = hypothesis_1 * hypothesis_2 * hypothesis_3 * hypothesis_4
) %>%
summarize(hyp1 = sum(hypothesis_1)/n(),
hyp2 = sum(hypothesis_2)/n(),
hyp3 = sum(hypothesis_3)/n(),
hyp4 = sum(hypothesis_4)/n(),
hyp_joint = sum(hypotheses_joint)/n())
Is this correct?
Please also provide the following information in addition to your question:
- Operating System:
- brms Version: