It is the log posterior density, up to a normalizing constant.
The posterior density is defined as:
The posterior density, defined up to a constant (i.e., the unnormalized posterior density):
The log unnormalized posterior density:
Stan only needs the unnormalized log posterior, up to any constants.
So when you say:
theta ~ normal(0,1)
x ~ normal(theta, 1)
This is, conceptually, translated to:
target = 0
target += log(normal_pdf(theta | 0, 1))
target += sum(log(normal_pdf(x | theta, 1)))
The “target” variable is the unnormalized, log posterior density.
In reality, using ~
statements in Stan also drops constants in the (log)density functions; like the 1/sqrt(2) in the normal density.
But Brms uses the target +=
syntax, so it maintains those constants.
The lp__
variable tracks the target
variable. Therefore, the lp__
in brms is the unnormalized log posterior density.
In sum: lp__ in brms is equal to the unnormalized log posterior density; in general, it is equal to the ‘target’ variable, which represents the sum of the log density and mass contributions from the likelihoods and priors - Whether it is the unnormalized log posterior density depends on whether the constants are dropped (using ~ syntax) or not (using target += syntax).