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.

Models with reaction time

Ask questions about existing examples and put in requests to software developers and users for other example implementations of models.
Post Reply
silvia

Models with reaction time

Post by silvia »

Dear Stephane,

I would like to implement a driver behaviour model including the estimation of the reaction time component as in Paschalidis, Choudhury, and Hess (2019).
https://doi.org/10.1016/j.amar.2019.02.001
Can Apollo directly account for the impact of explanatory variables including a stochastic reaction time?

Thank you in advance.

Kind regards,
Silvia
stephanehess
Site Admin
Posts: 974
Joined: 24 Apr 2020, 16:29

Re: Models with reaction time

Post by stephanehess »

Hi Silvia

this is a very specific application of a model. You could definitely code the model in Apollo but this would involve some manual coding of the model components and then using Apollo for the estimation

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
silvia

Re: Models with reaction time

Post by silvia »

Dear Stephane,

Thank you very much.
Yes, I understand how to combine different model components (e.g., choice model and reaction time distribution) in the likelihood function.
It is not clear to me how to include explanatory variables that vary based on a stochastic reaction time in the choice model.
Is there a way to directly code it in Apollo or do I need the pre-process the data?

Kind regards,
Silvia
stephanehess
Site Admin
Posts: 974
Joined: 24 Apr 2020, 16:29

Re: Models with reaction time

Post by stephanehess »

Hi Silvia

if an attribute is stochastic, whether as a function of reaction time or some other phenomenon, then you can code it in apollo_randCoeff - it makes no difference whether the components included in that list are random coefficients or random variables

Best wishes

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
vagg_pi
Posts: 1
Joined: 06 Jun 2020, 16:08

Re: Models with reaction time

Post by vagg_pi »

Hi Silvia,

I estimated this model using numerical integration and a previous version of the Choice Modelling Centre code. I haven’t tried this in Apollo yet but with some tweaking it should be feasible to use Gauss-Legendre also here.

- So as a first step, in the “apollo_draws” I created in advance every random element I would need later. This included nodes, weights, lagged relative speed and every other lagged component I would need. I created these as uniform. It doesn’t really matter as I just used this only to have the format of the matrices and I later pasted the values I actually needed (see last step later)

- I created the nodes and weights for integration using the ‘pracma’ package

- In the previous process I also edited the nodes to have the range I needed, I assume 0-3 or 0-4 in your case, or something similar

- After creating the draws (and before running the function of the model – apollo_probabilities) I called the matrix of reaction time values and did some processing to calculate lagged values of speed, headway etc.

- The approach to do the step above is up to you. I used interpolation and kinematics, but you can really use any approach you think is the best. The matrices that include these values are outside the list of draws currently

- Now that you have the matrices of the lagged variables, you need to use them to replace the initial draws you had from first step, and incorporate them in the list of your draws

That’s it pretty much. Please keep in mind that when mixed effects are included, Apollo is using the apollo_avgInterDraws function to calculate the average probability. You need to multiply this by number_of_draws*(b-a)/2 as the formula of Gauss-Legendre is a weighted sum and not an average.

Also, the approach above only works for a unidimensional integral. For instance, if you also want to have random space headway for free flow, some further processing will be needed. Unfortunately, I have not tried this yet.

I hope this made things a bit clearer, I’m happy to help if you have further questions.

Best,
Evangelos
Post Reply