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. We check the forum at least twice a week. It may thus take a couple of days for your post to appear and before we reply. There is no need to submit the post multiple times.

how to make probability plot in E MDCEV MODEL

Ask questions about post-estimation functions (e.g. prediction, conditionals, etc) or other processing of results.
Post Reply
NiluCapgi
Posts: 7
Joined: 04 Apr 2024, 13:20

how to make probability plot in E MDCEV MODEL

Post by NiluCapgi »

SIR I WAS TRYING EMDCEV MODLES FOR DIFFERENT VEHICLE TYPE AND DISTANCE TRAVELLED. CAR-1 , CAR 2 AND CAR 3 , HOW TO PLOT THEIR PROBABILITIES PLOT WITH DISTANCE TRAVELLED. OR WITH ANY OTHER VARIBLES???

the figure shows five different type of vehicle choice probabilities and their variation with distance
IMG20240423201802 (1) (1) (1)-min.jpg
stephanehess
Site Admin
Posts: 1295
Joined: 24 Apr 2020, 16:29

Re: how to make probability plot in E MDCEV MODEL

Post by stephanehess »

Hi

you can make predictions from a model in Apollo. This will produce a prediction for each row in the data, and then you can of course use standard R functions to product plots

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
NiluCapgi
Posts: 7
Joined: 04 Apr 2024, 13:20

Re: how to make probability plot in E MDCEV MODEL

Post by NiluCapgi »

Thank you, sir, for your response.

After running the prediction model with the code

apollo_prediction(
model,
apollo_probabilities,
apollo_inputs,
prediction_settings = list(),

)
Last edited by NiluCapgi on 31 May 2024, 08:30, edited 1 time in total.
NiluCapgi
Posts: 7
Joined: 04 Apr 2024, 13:20

Re: how to make probability plot in E MDCEV MODEL

Post by NiluCapgi »

sir if i want to plot or calculate the prob change for trip length for Choice L1,M1,H1 how to do?.
Last edited by NiluCapgi on 31 May 2024, 08:37, edited 1 time in total.
stephanehess
Site Admin
Posts: 1295
Joined: 24 Apr 2020, 16:29

Re: how to make probability plot in E MDCEV MODEL

Post by stephanehess »

So when running apollo_prediction with mdcev, you will have a predicted outcome for each observation, and you could plot that against the observed distances. Or you could make different predictions at different (equal) distances for each person, and then produce the plot. That latter approach would remove any impact of correlation between distance and other covariates in your data
--------------------------------
Stephane Hess
www.stephanehess.me.uk
NiluCapgi
Posts: 7
Joined: 04 Apr 2024, 13:20

Re: how to make probability plot in E MDCEV MODEL

Post by NiluCapgi »

Thank you, sir. I still have some doubts. I have attached my predicted values. in this pic we can see the outcomes for car choices are l1,m1,h1, and if I and taking trip distance as an independent variable. How do we make probability plots for trip lengths 0 to 500km for different vehicle types l1,m1,h1? do I need to consider the mean l1,m1,h1 column I:e for example the first trip length is 116 km and l1= .12, m1= .52, and H1 = .48 . so do I need to plot these three with trip length or are these the predicted values I need to calculate probability?
Attachments
mdcevqn2.png
mdcevqn2.png (79.33 KiB) Viewed 78230 times
mdcevqn.png
mdcevqn.png (59.68 KiB) Viewed 78230 times
dpalma
Posts: 217
Joined: 24 Apr 2020, 17:54

Re: how to make probability plot in E MDCEV MODEL

Post by dpalma »

Hi,

Sorry for taking long to answer.

Before answering your question, I want to make sure I understand your modelling approach. Your dependent variable seems to be the distance travelled using three different kinds of cars (L1, M1 and H1). The total length of the trip seems to be exogenously determined (e.g. the first trip is 116 km long). Nonetheless, you seem to be using the version of the eMDC with unobserved budget, because I see that the forecast for the first trip does not add up to 116.

The way you measure the impact of the trip length on the forecast will depend on whether you included the length of the trip as an explanatory variable in your model or not. Given that you are using the eMDC with unobserved budget, the most natural way to include the total length of the trip would be in the utility of the outside good (utilityOutside = b_totalLength*totalLength). If you did not include the total length as an explanatory variable, then your model will not be sensible to a change in it.

If you want more detailed help, please share your code with us, as that will allow us to provide more specific advice.

Best wishes,
David
NiluCapgi
Posts: 7
Joined: 04 Apr 2024, 13:20

Re: how to make probability plot in E MDCEV MODEL

Post by NiluCapgi »

Thank you, sir for your valuable answer; however, I still have some doubts
my dependent variables are time taken by the vehicle (l,m,h). So in joint modeling, I have modeled the time to deliver by different types of vehicle. My dependent variable are trip length and other variables. My only concern is how can find change in distance will make a change in the time for different 3 vehicle type.

Although the prediction is giving some columns but adding their probability is greater than one or I am not sure how to interpret the predicted probability results.
My question is what these prediction plots are indicating:

for example L1_EDisc = .12 , M1_EDisc= .52, H1_EDisc=.48 so these are not adding to one. Are these giving joint probability? I am not able to interpret properly.
Attachments
Capture_emdcev.JPG
Capture_emdcev.JPG (133.72 KiB) Viewed 72979 times
dpalma
Posts: 217
Joined: 24 Apr 2020, 17:54

Re: how to make probability plot in E MDCEV MODEL

Post by dpalma »

Hi,

The eMDC model is used to predict joint consumption of multiple alternatives. So for example, when you go to a supermarket, there are many different products, and you can buy any combination of them, each in any amount. For example, you could buy $3 of apples, $4 of bread, and $5 of cheese. The "EDisc" predicted by the model is the probability of you buying each of these products, so the probability of buying apples, bread and cheese, respectively. There is no reason to expect these probabilities to add up to 1, as you may have high (or low) probability of buying each product separately.

I believe what you are modelling is different. It looks like what you want to do is a two-stage model, where first the person chooses what vehicle to use (L1, M1, H1), and then how long it will take them to travel in that vehicle. You might want to look at a different kind of model for that. Maybe a joint estimation of an MNL and a linear regression.

I hope this helps.

Best wishes,
David
Post Reply