About brms with a trials warning

Short summary of the problem

When I use my results to plot a binomial interaction model, The following warning is indicated, then show me a strange figure.

The warning is: Setting all ‘trials’ variables to 1 by default if not specified otherwise.

Plotting code:
graph_recruiment<-conditional_effects(fit_recruiment,effect=“year:canopy”)
plot(graph_recruiment,points=T)

code_to_run_your_model(if_applicable)

fit_recruiment<-brm(new|trials(size)~canopy*year+(1|plot),
family = binomial(),
data=data_dynamic,
seed=1,
prior=c(set_prior("",class=“Intercept”)),
chains=4,
iter=20000,
warmup=10000,
thin=1,
control = list(adapt_delta=0.97,max_treedepth = 15))

Please also provide the following information in addition to your question:

  • Operating System: win10
  • brms Version:> packageVersion(“brms”) [1] ‘2.13.5’

and my data like this:

I am not good at English and programming.

thank you everyone!

1 Like

Hi @wucco12345, the fitted proportions in the figure are correct, but there is no good way of showing the figure such that they would vary with the size variable in your data. So setting plot(conditional_effects(...), points = TRUE) will necessarily lead to slightly confusing figures, when size varies between observations. You can show, without points, the fitted values for different sizes with e.g.

plot(conditional_effects(fit, conditions = data.frame(size = 10)), points = T)

Or you could grab the more complicated data for viz from the conditional effects object

conditional_effects(fit, conditions = data.frame(size = unique(data_dynamic$size)))[[1]]
3 Likes

Thank you very much for your reply,dear matti.

I tried to set the year2 as a numeric data, and fitted the curve again, with both of the above methods.

data like this, ps: just change the name what size to totalnumber

and the code1 was:
fit<-conditional_effects(fit_recruiment2,
conditions = data.frame(size = 10),
effect=“year2:canopy”)

then the warning was:
Setting all ‘trials’ variables to 1 by default if not specified otherwise.
Warning message:
The following variables in ‘conditions’ are not part of the model:
’size’

I still fitted the curve, plot(fit,points=T), and got this figure:

the coda 2 was:
fit<-conditional_effects(fit_recruiment2,
conditions = data.frame(size = unique(data_dynamic$totalnumber)),
effect=“year2:canopy”)

got this warning:
Setting all ‘trials’ variables to 1 by default if not specified otherwise.
Warning message:
The following variables in ‘conditions’ are not part of the model:
’size’
plot(fit,points=T), got this figure:

Actually, I need a figure to represent the interaction between year2 and canopy.
I tried this coda: fit<-conditional_effects(fit_recruiment2,
effect=“year2:canopy”)
plot(fit)
can plotting a figure that was I needed,


but there is still a warning: Setting all ‘trials’ variables to 1 by default if not specified otherwise.
So I do not know does this figure represent the results correctly, and there were no points in the figure, even it is not important, I think I should know how can I set the points to figure on this case.

when I use plot(fit,points=T), the figure changed to

Looking forward to your reply, thany you very much.