What is the use of the _lccdf suffix function in setting priors?

I’m trying to understand the stan code generated by brms as a learning exercise and to also help set better priors.

One of the methodologies brms uses to set priors that I don’t understand is the use of the _lccdf suffix in priors such as:

target += student_t_lpdf(sd_1 | 3, 0, 10) - 1 * student_t_lccdf(0 | 3, 0, 10);

Where sd_1 appears to be the standard deviation on the group effects for a brms formula such as:

y ~ x1 + (1|Group)

What is the purpose of subtracting the lccdf in this prior? The closest I seem be getting is that it’s effectively truncating the possible values of sd_1 to a lower bound of 0 and an alternative coding might be:

real<lower=0> sd_1;
target += student_t_lpdf(sd_1 | 3, 0, 10);

But I see earlier in the brms coding it has already specified sd_1 to have a lower bound of 0 so my interpretation seems unlikely.

I’m also not sure what the purpose of the 1 * is.

Any help would be much appreciated.

1 Like

If you don’t subtract the log complimentary CDF for a half Student t distribution (or another distribution defined over the entire real line), then the log kernel of the posterior distribution would be off by a constant and some post-estimation methods, such as Bayes Factors, would be incorrectly calculated. Although doing so does not affect the posterior draws, packages such as brms have to be strictly correct because we cannot know what the user is going to do with the results subsequently.

3 Likes

Thanks Ben, I’ll be honest and say I only partly understand what that means but I’ll go away and do some research to try to understand the rest.

2 Likes

If you are not using the functions in the bridgesampling package, then it is probably not worth your time to figure out why packages like brms calculate all the constants.

1 Like