Hello to all,
The linear predictor in a model already defined in rstan is of the below form:

vector[n_games] mu =team_abil[home_team]-team_abil[away_team];
// priors including all constants
target += normal_lpdf(c |0,10);
target += normal_lpdf(team_abil_raw |0,10);
//likelihood-systematic component
for (g in 1:n_games) {
target += ordered_logistic_lpmf(dif_sets[g] | mu[g], c);
}
}

How can mu= mu =team_abil[home_team]-team_abil[away_team]; be expressed in brms or stan_glm formula without considering two parameters (one for the home team and one for the away team) and simultaneously preserve the - sign between them?

Also, I would like to ask If the brms library supports sum to zero cornstraint as the stan_glm (contrasts=sum())

I don’t think the model as you’ve written it can be easily expressed in brms. You could possible hack around brms to make it do this (as brms let’s you inject custom Stan code in a lot of places), but I don’t think you could do this in any easy manner.

I don’t think this is supported directly, but note that contrasts = sum is not a constraint on the parameters, but rather just a different way to build to model matrix, so you should be able to always express by building part of the model matrix as additional columns in your data.