Pathfinder results for deterministically determined transformations

Hello all,

I use pathfinder to set the initial values, and I roughly understand the idea beneath it. However, I wonder about the transformations. In my code I define the variable real logphi and then do its transformation:

real phi = exp(logphi); 

When I run the pathfinder, it gives me:

'logphi': array(-1.29877475), 'phi': array(632.36272619)

From one side, I know that I may not need to worry, from the other side, why it would not give me 'phi': array(exp(-1.29877475))? This would a bit more reasonable.

Thank you for clarification in advance

Hi, @aakhmetz. It’s usually easier for us with full Stan programs, but here the cause is probably just that exponentiation doesn’t distribute through expectation. In general, we don’t have \exp(\mathbb{E}[\theta \mid y]) = \mathbb{E}[\exp(\theta) \mid y] because non-linear operators don’t distribute through expectations. For example,

> logphi = c(-3.9, -7.5, 7.5)

> mean(logphi)
[1] -1.3

> mean(exp(logphi))
[1] 602.6877

> exp(mean(logphi))
[1] 0.2725318