I would like to include the absolute difference of two unobservable, parameterized covariates in a model, i.e. abs(x_i - x_j), to capture differences between individuals i and j. Since x_i and x_j are parameters, the warnings pointed out in the manual apply. The only other discussion I found was on absolute value functions in the old Stan forum from a while back, and, in that different context, Michael Betancourt suggested using x * coth(alpha * x) for some large alpha, referencing this paper: http://arxiv.org/pdf/1212.4693.pdf. In my case, x might be zero, and the derivative of coth is undefined at zero, throwing me back to the problem I started out with that abs() is not continuously differentiable. Is there a reasonable alternative to using abs(x_i - x_j) I am missing, e.g. a specific soft absolute value function? Thanks already!

– Christian