Issue with hypothesis() function

Hi all,

I’m having difficulty using the hypothesis function to compare two different levels of a three-level model. Code is below:

first_model_with_length_as_factor <- brm(EvolvedOrNot~
                       +LengthAsFactor*Vowel
                   +(1+LengthAsFactor*Vowel|Subject)
                   +(1|Item)
                   ,data=cleaned_data
                   ,family = bernoulli(),
                   chains = 4, save_all_pars = T, warmup = 1000, iter = 2000, cores = 4, file = "m1", control = list(adapt_delta =0.9))

h1 <- c(h1 = "LengthAsFactorBMedium:Voweli - Intercept =  LengthAsFactorBMedium:Voweli - LengthAsFactorCLong:Voweli")

h1_answer <- hypothesis(first_model_with_length_as_factor,h1)
h1_answer

The factor LengthAsFactor is a three-level factor with factors AShort, BMedium, CLong, and Vowel is a two-level factor with levels i and a. I’d like to be able to use hypothesis to determine whether the difference between AShort (here the intercept) and BMedium is equal to the difference between BMedium and CLong - ideally this would abstract away from levels of Vowel, since I don’t have an a priori reason to suspect that the two matter to eachother. However, I’d like to do this without refitting the model because the model with the negligible interaction of Vowel and LengthAsFactor fits better.

Any advice? The code runs, but I just get a hypothesis object that looks like this:

Hypothesis Tests for class b:
---
'CI': 90%-CI for one-sided and 95%-CI for two-sided hypotheses.
'*': For one-sided hypotheses, the posterior probability exceeds 95%;
for two-sided hypotheses, the value tested against lies outside the 95%-CI.
Posterior probabilities of point hypotheses assume equal prior probabilities.

Thanks very much!

Are you using this in a rmarkdown document? I have seen this issue myself yesterday. Try executing it in the console not in the rmarkdown chunk.

1 Like

Awesome, that fixed it - thanks!