Is it possible to get a subject-level credible interval for the independent variable (for a given fixed value of the dependent variable)?
For example, the code below fits a model for the average reaction time (as the dependent variable) per day of sleep deprivation (as the independent variable) in the sleep deprivation study. Could I now extract for each subject the credible interval for the number of days of sleep deprivation that would lead to a reaction time of 300 ms?
(I am aware that the model could be fitted the other way around [i.e., reaction time as independent variable and days as dependent variable]. But I was wondering, whether there is a ‘direct’ solution.)
get_prior(Reaction ~ Days + (1 + Days|Subject), sleepstudy)
fit <- brm(
Reaction ~ Days + (1 + Days | Subject),
data = sleepstudy,
family = gaussian(),
prior = prior1,
chains = 4
As far as I know this is not possible. The model is only specifying priors/modelling for the dependent variable, so the independent variables are treated as fixed without uncertainty.
While a given value of the predictor can imply a range of values in the outcome, the inverse is not true (in this case), as each value of the predictor implies a different credibility interval for the outcome.
What you could look at instead is the range of predictor values where the resulting credibility interval contains 300ms?
I think this should be possible, by treating the true value of the independent variable for the observation in question as a parameter in the model. In fact, I think
brms supports this directly for normal priors on the independent variable via measurement error models. The idea would be to pass the prior mean as the nominal data, and then to pass an appropriately large standard error for the measurement.