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 http://www.ApolloChoiceModelling.com/manual.html. This contains detailed descriptions of the various Apollo functions, and numerous examples are available at http://www.ApolloChoiceModelling.com/examples.html. In addition, help files are available for all functions, using e.g. ?apollo_mnl
  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 http://www.apollochoicemodelling.com/faq.html
    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.

Why is the estimation of the standard deviation of the error component negative?

Ask questions about how to estimate models and how to change your settings for estimation.
Post Reply
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Why is the estimation of the standard deviation of the error component negative?

Post by dpalma »

Hi,

There is nothing wrong with your model. This is a consequence of how Apollo works.

In Apollo, you usually define random components as follows:

Code: Select all

randCoeff[["beta"]] = mu + sigma*draws
From a mathematical perspective, if we consider "draws" as a random variable following a symmetrical distribution centred around zero (e.g. a standard normal distribution), the only thing that matter is the magnitude (the absolute value) of "sigma". If you take "sigma" or "-sigma" you would get the exact same distribution for "beta".

Now, if after estimating you model, you try calculating the likelihood (LL) of your model with your estimated parameters, but changing the sign of sigma (e.g. from negative to positive) you should get a very similar LL that the optimal LL. It will not be exactly the same because "draws" is not an ideal probability distribution, but instead a set of draws from the desired distribution. These draws are almost never perfectly symmetrical around zero, which explains the difference.

But in summary, negative s.d. are nothing to worry about. You can read a bit more about it in the F.A.Q.

Best wishes
David
sisizhao
Posts: 3
Joined: 28 Aug 2023, 23:56

Re: Why is the estimation of the standard deviation of the error component negative?

Post by sisizhao »

Dear professor,

Thank you very much for your reply.
I added restrictions on estimating the standard deviation of the error components. Make the estimate must be greater than 0.
This gives me a positive standard deviation. The difference from the previous negative standard deviation is not very large.
I think I can move on to the following research.
Please forgive me for deleting my code as the article is not yet published and there are privacy issues involved.
For your help, I feel very grateful.
Thank you again.

Kind regards
Last edited by sisizhao on 31 Aug 2023, 07:34, edited 1 time in total.
dpalma
Posts: 190
Joined: 24 Apr 2020, 17:54

Re: Why is the estimation of the standard deviation of the error component negative?

Post by dpalma »

Happy to hear applying constraints worked out, and the new value positive value is close in magnitude to the original negative one.

Best wishes
David
sisizhao
Posts: 3
Joined: 28 Aug 2023, 23:56

Re: Why is the estimation of the standard deviation of the error component negative?

Post by sisizhao »

Dear David,

I found the restriction to be infeasible in subsequent calculations. Because of the restriction on the estimated standard deviation of the error component, some small negative estimates before would report 'NA'. And I found that some of the previously negative estimates would still have some variation after restricting to positive. So I guess this is not feasible.
May I ask if I can take absolute values for the estimates of the standard deviation of these error components? How is this implemented in R by code?
Another question is, or can I just take the negative estimates of the standard deviation of the error components and remove the minus sign to become positive and quote them directly in my paper? After all, I really don't know how to explain the negative values.
I would appreciate it if you could continue to respond to me.

Kind regards,
Zhao
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Why is the estimation of the standard deviation of the error component negative?

Post by stephanehess »

Zhao

there is really no reason for imposing the sign constraint, as David says, or to try to work with absolute values. It's exactly the same whether the parameter is negative or positive.

If it really bothers you, you could apply an exponential transform, but as described in the FAQ, this will hinder estimation performance

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
sisizhao
Posts: 3
Joined: 28 Aug 2023, 23:56

Re: Why is the estimation of the standard deviation of the error component negative?

Post by sisizhao »

Thank you professor.
I ended up trying a lot of different distributions, trying different appropriate initial values for mu and sigma for the random parameter and the error components, and finally got all the standard deviations of the error components to be positive. I think I gained a lot of experience from this constant trial and error process. Thank you very much for your help.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Why is the estimation of the standard deviation of the error component negative?

Post by stephanehess »

Hi

but do you see the point that the sign doesn't matter unless you look at capturing correlations?

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply