Making predictions from binomial model: why newdata requires part of outcome variable to be defined?

I have a model as follows. It calculates the proportion of successful applications from total.

m = brm(admit|trials(applications) ~ sex, data = data, family = binomial())

When making predictions using “newdata” and tidybayes’es "epred_draws(), why I have to also specify “applications” in newdata? Otherwise “epred_draws()” wouldn’t run. Usually newdata only includes predictors and their levels. And how to choose a value for “applications”?


newdata = expand_grid(applicant.gender = c("female", "male"),
                      dept = "A",
                      applications = 1)

If I’m following your model correctly, we might express it as

\begin{align*} \text{admit}_i & \sim \operatorname{Binomial}(n_i = \text{applications}_i, p_i) \\ \operatorname{logit}(p_i) & = \beta_0 + \beta_1 \text{sex}_i. \end{align*}

In such a case, applications isn’t really part of your outcome variable. Rather, applications is part of the likelihood.

1 Like