If I understand the code correctly, the plot_cap (Conditional Adjusted Predictions) function does posterior prediction on out of sample data with the goal of visualising how the outcome variable varies as a function of (some) interpolated predictor variables.

the goal of visualising how the outcome variable varies as a function of (some) interpolated predictor variables.

Instead of “outcome variable” I would say “model parameter”. The visualization shows, by default, how the mean varies as a function of a predictor. You can choose to show another parameter instead of the mean when you have a distributional model.

As far as I understand conditional adjusted predictions are different from marginal effects because they’re conditional on specific values for all the predictors. To get the marginal effect you would need “marginalize” over the conditional adjusted predictions. Perhaps this could be added to Bambi in the future.

You won’t find plot_cap in the marginaleffects package because it was renamed a few months ago and it’s called plot_predictions now (perhaps it’s a better name? what do you think?)

Hi, this is a great thread. I’m also really trying to get my head round plot_cap and conditional adjusted predictions vs. marginal effects.

Had a couple of practical questions:

If you are using the default settings with a model, idata and single covariate/predictor, would I be correct in saying the plot shows predictions on the y-axis against values of that predictor, while other covariates are held at their mean values?

The target is a bit unclear to me - I only can see the ‘mean’ as an option as compared to plot_predictions in R which has a few eg. ‘median’, ‘tukey’. I am probably misinterpreting this - could you please explain a bit more what you meant by target and what can be varied?