How to estimate 1 - (y|trials(n)) in brms?

Hi,

I am fitting the following binomial model using brms:

df <- data.frame(y = c(1, 1, 3, 5, 5, 10, 7))
mod <- brm(y | trials(10) ~ 1, data = df, family = "binomial")
summary(mod)

y corresponds to the ‘number of days’ an individual survives, with the model estimating the probability an individual survives to 10 days. Instead of modelling the probability of survival, is there, instead, a way to fit the model to get estimates for the probability of not surviving? I tried:

mod <- brm(1 - (y | trials(10)) ~ 1, data = df, family = "binomial")

But I get the error:

Error: Incorrect use of '|' on the left-hand side of 1 - (y | trials(10)) ~ 1

I’m not super familiar with survival analysis, but I think the thing you’re interested in is the “hazard function”, and it’s a transform of the output of a standard survival analysis. See this chapter (and also probably the preceding one for context) from @Solomon. Here are some other resources you might check out too:

2 Likes