# Contrast Analysis - Predicted Data VS Parameters

Hi all!

I have just a curiosity. I would like to know the most consistent approach to contrast analysis in a Bayesian setting. I can imagine two ways of doing this, but first let me introduce a toy scenario.

Simple scenario: y ~ x * F + (1 + x|id), where x is a list of integer, say, [0,1,2,3,4,5] which use as a continuous predictor, and F is a two-level factor, say, gender male and female.

Purpose: I want to fit a linear mixed-effects model, and then compare the difference between male and female in y, at a certain level of x=k.

First way - Predicted Data
I fit the model. I use posterior_predict (re_formula = NA) to obtain model-based samples of observations for each level of x and F. I use the distribution of the predicted data at x=k, for males and females in order to obtain two distributions for each level of F. I take the difference between the two distributions. I make conclusions on the distribution of the difference (e.g. I see whether zero is contained in the CI, or maybe I can use a Savage-Dickey method with some prior (I’m not sure it is allowed in this case)).

Second way - Parameters
I fit the model. I use the posterior distributions on the regression parameters (fixed-effects) in the linear predictor in order to obtain posterior means for each level of x and F. At this point, I simply take the posteriors obtained at x=k, for males and females, and compare them. I obtain the posterior of the difference and make an inference on it. I basically use the same approach I would use with the hypothesis function for the intercepts, but I use x=k instead of x=0. I think this reasoning has some flaws btw.

Now, which is the right way of reasoning and why?

Any feedback? :) :)

For a standard linear model with identity link, the difference in the {means of the predictions} will be exactly the {difference in the means} of the predictions. For glms with other links, the question becomes more nuanced.