Hi all,
I’d like to run a one-sided hypothesis test but specified a Cauchy distribution for the overall effect (see below). Specifically, I’d like to test whether TypeOutcome.2 > 0. Since brms::hypothesis() may pose problems with such a distribution, I wanted to ask if there’s an alternative to do this.
Many thanks,
Sandra
prior2 <- c(
brms::prior(cauchy(0, (1/sqrt(2))), coef = Intercept),
brms::prior(normal(0, 1), class = b),
brms::prior(cauchy(0, 0.1), class = sd)
)
bmod_H1 <- brm(
CohensD | se(SECohensD) ~ 0 + Intercept + TypeOutcome2.c + (1|ArticleID) + (1|StudyID),
data = Data_aggregated_H1,
prior = prior2,
sample_prior = TRUE,
save_all_pars = FALSE,
chains = 4,
warmup = 5000,
iter = 20000,
cores = parallel::detectCores(),
control = list(adapt_delta = .99)
)
- Operating System: Windows >= 8 x64 (build 9200)
- brms Version: 2.12.0
You can use the bayes_factor method for this purpose.
Thanks for your quick reply! Then, I would compare the above model to one without “TypeOutcome2.c”? But isn’t that a two-sided hypothesis test?
Which two hypothesis do you want to compare exactly?
I’d like to test whether TypeOutcome2.c > 0 against TypeOutcome2.c <= 0.
As far as I understood, bayes_factor tests TypeOutcome2.c = 0 against TypeOutcome2.c != 0 if I specify the above model with TypeOutcome2.c against a model without it, but that’s not what I’d like to do.
bayes_factor compares whatever two models you through at it. So you can have one model with prior(normal(0, 1), class = b, lb = 0)
and another model with prior(normal(0, 1), class = b, ub = 0)
.
When you do it that way, please make sure that you use 1 + TypeOutcome2.c
instead of 0 + Intercept + TypeOutcome2.c
to avoid the Intercept getting a sign restriction as well through the above prior.
Great, thank you very much!
I have one final question about the truncation. Do I understand it correctly that the truncation upper = 0 (see screenshot) now only applies to b TypeOutcome2.c? Or do I need to apply the non-linear workaround and specify different nlpar?
Code:
prior2 <- c(
brms::prior(cauchy(0, (1/sqrt(2))), coef = Intercept),
brms::prior(normal(0, 1), class = b, lb = 0),
brms::prior(cauchy(0, 0.1), class = sd)
)
You need to do the non linear workaround or follow the advice from my former post.
Ah yes, now I fully get your previous post. Thanks!