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.

Post-estimation on an old model

Ask questions about post-estimation functions (e.g. prediction, conditionals, etc) or other processing of results.
Post Reply
NimaDadashzadeh
Posts: 4
Joined: 23 Jun 2022, 12:11

Post-estimation on an old model

Post by NimaDadashzadeh »

Hi Stephane

My computer restarted while the code was running (if I am not wrong, it was in the mid of post-estimation).
I have a .rds file of my MMNL model. I successfully load it and I would like to continue with that.
There is no clear instruction (step-by-step) in the Manual on how post-estimation can be done using an old model. I was wondering if you could advise on this case.

Below are the old model details:

Successfully loaded C:/..../output/MMNL_CS_uniform_STUDENT_model.rds

Model name : MMNL_CS_uniform_STUDENT
Model description : MMNL model with Uniform distributions for all parameters, cross-sectional spec
Model run at : 2023-07-25 23:12:08
Estimation method : bfgs
Model diagnosis : successful convergence
Number of individuals : 1251
Number of rows in database : 14837
Number of modelled outcomes : 14837

Number of cores used : 7
Number of inter-individual draws : 500 (mlhs)

LL(start) : -45629.6
LL (whole model) at equal shares, LL(0) : -20544.88
LL (whole model) at observed shares, LL(C) : Not applicable
LL(final, whole model) : -16284.3
Rho-squared vs equal shares : 0.2074
Adj.Rho-squared vs equal shares : 0.2048
Rho-squared vs observed shares : Not applicable
Adj.Rho-squared vs observed shares : Not applicable
AIC : 32672.6
BIC : 33032.12

Estimated parameters : 52 # (I just put the results of some parameters below)
Time taken (hh:mm:ss) : 06:27:47.68
pre-estimation : 01:31:34.16
estimation : 04:53:13.13
initial estimation : 04:46:33.95
estimation after rescaling : 00:06:39.17
post-estimation : NA:NA:NA
Iterations : 62
initial estimation : 61
estimation after rescaling : 1

Unconstrained optimisation.

Estimates:
Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0)
asc_None 0.00000 NA NA NA NA
asc_Walk 3.49646 NA NA NA NA
asc_Bike 5.13577 NA NA NA NA
asc_Car 2.29420 NA NA NA NA
asc_Car_shift_STUDENT -0.74212 NA NA NA NA
b_tt_Walk_a -4.40409 NA NA NA NA
b_tt_Bike_a -0.14448 NA NA NA NA
b_tt_Car_a -5.46801 NA NA NA NA
b_tt_Car_STUDENT_a -10.29536 NA NA NA NA
b_tt_CarHire_a -4.30205 NA NA NA NA
b_tt_Bus_a -9.53519 NA NA NA NA
b_tt_Train_a -7.17690 NA NA NA NA
b_tt_Walk_b -6.94532 NA NA NA NA
b_tt_Bike_b -2.92049 NA NA NA NA
b_tt_Car_b -1.31371 NA NA NA NA
b_tt_Car_STUDENT_b -3.89690 NA NA NA NA
b_tt_CarHire_b -0.55396 NA NA NA NA
b_tt_Bus_b -4.48581 NA NA NA NA
b_tt_Train_b -1.91113 NA NA NA NA
b_cost_a -1.93089 NA NA NA NA
b_cost_b -3.35786 NA NA NA NA
mu_shortDis 1.00000 NA NA NA NA # to capture the heteroskedasticity of short and long journeys
mu_longDis 0.18508 NA NA NA NA # to capture the heteroskedasticity of short and long journeys
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Post-estimation on an old model

Post by stephanehess »

Hi

after you use apollo_loadModel, the steps are exactly the same as if you had just estimated the model. So I'm not sure about your question, can you explain where the issue is and I can help

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
NimaDadashzadeh
Posts: 4
Joined: 23 Jun 2022, 12:11

Re: Post-estimation on an old model

Post by NimaDadashzadeh »

Dear Stephane,

Thank you for your reply. So, my computer was restarted when the code was in the stage of "post estimation 10%....20%....".
The question is shall I recall the old model using apollo_loadModel and then run the sentence below only ?

"model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs, estimate_settings)"
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Post-estimation on an old model

Post by stephanehess »

Hi

what you can do is to use apollo_loadModel just before the call to apollo_estimate, and then use:

Code: Select all

model = apollo_estimate(model$estimate, apollo_fixed, apollo_probabilities, apollo_inputs, estimate_settings)
instead of

Code: Select all

model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs, estimate_settings)
that way, the results will be used as starting values

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