Page 1 of 1

estimation of median conditional with apollo_conditionals()

Posted: 07 May 2021, 11:12
by valeria toledo
Hi I am using a MXL model with lognormal cost.
I would like to be able to extract the median of the lognormal distribution of the cost parameter.
Is it possible to change the source code or add something into the function "apollo_conditionals()" so that it provides the conditional median (and sd) of the lognormal distribution, rather than the mean?

Kind regards

Re: estimation of median conditional with apollo_conditionals()

Posted: 10 May 2021, 15:26
by dpalma
Hi Valeria,

No, sadly apollo_conditionals does not allow you to get the median of the posterior for each individual. However, you may be able to calculate it from the mean and s.d. reported by Apollo.

The mean of a lognormal is: e^( m + (s^2)/2)
and the s.d. is: sqrt( (e^(s^2) - 1)*e^(2*m + s^2) )

Where m and s are the underlying normal's mean and standard deviation. You know the value of the mean and the s.d. of the lognormal, so you may be able to calculate m and s (I haven't tried). Once you have the values of m and s, you can easily calculate the median as e^m. You would have to repeat this calculation for each individual.

Cheers
David