Important: Read this before posting to this forum

  1. This forum is for questions related to the use of Apollo. We will answer some general choice modelling questions too, where appropriate, and time permitting. We cannot answer questions about how to estimate choice models with other software packages.
  2. There is a very detailed manual for Apollo available at This contains detailed descriptions of the various Apollo functions, and numerous examples are available at
  3. Before asking a question on the forum, users are kindly requested to follow these steps:
    1. Check that the same issue has not already been addressed in the forum - there is a search tool.
    2. Ensure that the correct syntax has been used. For any function, detailed instructions are available directly in Apollo, e.g. by using ?apollo_mnl for apollo_mnl
    3. Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see
    4. Make sure that R is using the latest official release of Apollo.
  4. If the above steps do not resolve the issue, then users should follow these steps when posting a question:
    1. provide full details on the issue, including the entire code and output, including any error messages
    2. posts will not immediately appear on the forum, but will be checked by a moderator first. This may take a day or two at busy times. There is no need to submit the post multiple times.

estimation of median conditional with apollo_conditionals()

Ask questions about post-estimation functions (e.g. prediction, conditionals, etc) or other processing of results.
Post Reply
valeria toledo
Posts: 10
Joined: 20 Aug 2020, 15:20

estimation of median conditional with apollo_conditionals()

Post by valeria toledo » 07 May 2021, 11:12

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

Posts: 125
Joined: 24 Apr 2020, 17:54

Re: estimation of median conditional with apollo_conditionals()

Post by dpalma » 10 May 2021, 15:26

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.


Post Reply