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.

comparing WTP estimates from MNL and MMNL model

Ask questions about the results reported after estimation. If the output includes errors, please include your model code if possible.
Post Reply
pbaji
Posts: 6
Joined: 18 Oct 2024, 10:30

comparing WTP estimates from MNL and MMNL model

Post by pbaji »

Hi Stephan,

I am doing a DCE exploring willingness to pay for robots used in informal care. My attributes are 1) type (robot, human, animal); 2) size (small, medium, large); 3) function (func1, func2, func3, func4); 4) surv (0,1) 5) help(0,1); 6) cost (0,50,100,150)
I cannot figure out why my WTP estimates are so different in the MNL and the MMNL model where cost is the random coefficient with negative lognormal distribution.
WTP estimates from the MNL model looks reasonable, but too high in the MMNL. I am not sure if this is because of my code, my data or the fact we used a 0 cost attribute level.
My output is copied below for the two models.

Many thanks for your advice. Highly appreciated.

Best regards,
Petra

-------MNL-----------------------------------------------------------------
# ################################################################# #
> #### LOAD LIBRARY AND DEFINE CORE SETTINGS ####
> # ################################################################# #
>
> ### Clear memory
> rm(list = ls())
>
> setwd("C:/Users/cf21091/OneDrive - University of Bristol/TKP/data/analysis")
>
> ### Load Apollo library
> library(apollo)
>
> ### Initialise code
> apollo_initialise()
Apollo ignition sequence completed
>
> ### Set core controls
> apollo_control = list(
+ modelName = "mnl_robot_hu_asc",
+ modelDescr = "MNL on robot informal care - Hungary",
+ indivID = "id",
+ outputDirectory = "output"
+ )
> # ################################################################# #
> #### LOAD DATA AND APPLY ANY TRANSFORMATIONS ####
> # ################################################################# #
>
> ### Loading data from package
> ### if data is to be loaded from a file (e.g. called data.csv),
> ### the code would be: database =
> database=read.csv("robot_choices_data_hu.csv",header=TRUE)
>
>
>
> # ################################################################# #
> #### DEFINE MODEL PARAMETERS ####
> # ################################################################# #
>
> ### Vector of parameters, including any that are kept fixed in estimation
> apollo_beta = c(asc1=0,
+ asc2=0,
+ coeff_robot = 0,
+ coeff_human = 0,
+ coeff_animal = 0,
+ coeff_small = 0,
+ coeff_medium = 0,
+ coeff_large = 0,
+ coeff_func1 = 0,
+ coeff_func2 = 0,
+ coeff_func3 = 0,
+ coeff_func4 = 0,
+ coeff_surv = 0,
+ coeff_help = 0,
+ coeff_cost = 0
+ )
>
> ### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
> apollo_fixed = c("coeff_medium", "coeff_robot", "coeff_func1", "asc2")
>
> # ################################################################# #
> #### GROUP AND VALIDATE INPUTS ####
> # ################################################################# #
>
> apollo_inputs = apollo_validateInputs()
Several observations per individual detected based on the value of id. Setting panelData in apollo_control set to TRUE.
All checks on apollo_control completed.
WARNING: Your database contains some entries that are NA. This may well be intentional, but be advised that if these entries are used
in your model, the behaviour may be unexpected.
All checks on database completed.
>
> # ################################################################# #
> #### DEFINE MODEL AND LIKELIHOOD FUNCTION ####
> # ################################################################# #
>
> apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
+
+ ### Attach inputs and detach after function exit
+ apollo_attach(apollo_beta, apollo_inputs)
+ on.exit(apollo_detach(apollo_beta, apollo_inputs))
+
+ ### Create list of probabilities P
+ P = list()
+
+ ### Likelihood of choices
+ ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
+ V = list()
+ V[["alt1"]] = asc1+(coeff_robot*(a_type==0) + coeff_human*(a_type==1)+ coeff_animal*(a_type==2)
+ + coeff_small*(a_size==0) + coeff_medium*(a_size==1) + coeff_large*(a_size==2)
+ + coeff_func1*(a_function==0) + coeff_func2*(a_function==1) + coeff_func3*(a_function==2) + coeff_func4*(a_function==3)
+ + coeff_help*a_help
+ + coeff_surv*a_surv
+ + coeff_cost*a_cost)
+
+ V[["alt2"]] = asc2+ ( coeff_robot*(b_type==0) + coeff_human*(b_type==1)+ coeff_animal*(b_type==2)
+ + coeff_small*(b_size==0) + coeff_medium*(b_size==1) + coeff_large*(b_size==2)
+ + coeff_func1*(b_function==0) + coeff_func2*(b_function==1) + coeff_func3*(b_function==2) + coeff_func4*(b_function==3)
+ + coeff_help*b_help
+ + coeff_surv*b_surv
+ + coeff_cost*b_cost )
+
+ ### Define settings for MNL model component
+ mnl_settings = list(
+ alternatives = c(alt1=1, alt2=2),
+ choiceVar = choice_,
+ utilities = V,
+ componentName = "choice"
+ )
+
+ ### Compute probabilities for MNL model component
+ P[["model"]] = apollo_mnl(mnl_settings, functionality)
+
+ ### Take product across observation for same individual
+ P = apollo_panelProd(P, apollo_inputs, functionality)
+
+ ### Prepare and return outputs of function
+ P = apollo_prepareProb(P, apollo_inputs, functionality)
+ return(P)
+ }
>
> # ################################################################# #
> #### MODEL ESTIMATION ####
> # ################################################################# #
>
> ### Estimate model
> model = apollo_estimate(apollo_beta, apollo_fixed, apollo_probabilities, apollo_inputs)
Preparing user-defined functions.

Testing likelihood function...
Setting "avail" is missing, so full availability is assumed.

Overview of choices for MNL model component choice:
alt1 alt2
Times available 4000.00 4000.00
Times chosen 2117.00 1883.00
Percentage chosen overall 52.92 47.08
Percentage chosen when available 52.92 47.08


Pre-processing likelihood function...

Testing influence of parameters
Starting main estimation

BGW using analytic model derivatives supplied by caller...


Iterates will be written to:
output/mnl_robot_hu_asc_iterations.csv
it nf F RELDF PRELDF RELDX MODEL stppar
0 1 2.772588722e+03
1 3 2.749526747e+03 8.318e-03 8.318e-03 1.00e+00 G 9.57e+00
2 5 2.628225305e+03 4.412e-02 4.431e-02 8.20e-01 G 3.56e-01
3 6 2.611311991e+03 6.435e-03 6.713e-03 2.16e-01 G 0.00e+00
4 7 2.611283212e+03 1.102e-05 1.106e-05 7.85e-03 S 0.00e+00
5 8 2.611283173e+03 1.491e-08 1.486e-08 2.76e-04 S 0.00e+00
6 9 2.611283173e+03 3.424e-11 3.383e-11 1.36e-05 S 0.00e+00

***** Relative function convergence *****

Estimated parameters with approximate standard errors from BHHH matrix:
Estimate BHHH se BHH t-ratio (0)
asc1 0.135263 0.03303 4.0947
asc2 0.000000 NA NA
coeff_robot 0.000000 NA NA
coeff_human -0.160443 0.04555 -3.5220
coeff_animal -0.463064 0.04707 -9.8377
coeff_small -0.127603 0.04586 -2.7827
coeff_medium 0.000000 NA NA
coeff_large -0.148183 0.04840 -3.0616
coeff_func1 0.000000 NA NA
coeff_func2 0.433066 0.05674 7.6327
coeff_func3 0.239602 0.05570 4.3020
coeff_func4 0.044368 0.05838 0.7600
coeff_surv 0.138042 0.03299 4.1838
coeff_help 0.144731 0.03303 4.3822
coeff_cost -0.002957 2.9503e-04 -10.0230

Final LL: -2611.2832

Calculating log-likelihood at equal shares (LL(0)) for applicable models...
Calculating log-likelihood at observed shares from estimation data (LL(c)) for applicable models...
Calculating LL of each model component...
Calculating other model fit measures
Computing covariance matrix using numerical jacobian of analytical gradient.
0%....25%....50%....75%..100%
Negative definite Hessian with maximum eigenvalue: -153.509396
Computing score matrix...

Your model was estimated using the BGW algorithm. Please acknowledge this by citing Bunch et al. (1993) - DOI
10.1145/151271.151279
>
> # ################################################################# #
> #### MODEL OUTPUTS ####
> # ################################################################# #
>
> # ----------------------------------------------------------------- #
> #---- FORMATTED OUTPUT (TO SCREEN) ----
> # ----------------------------------------------------------------- #
>
>
> modelOutput_settings=list(printPVal=TRUE)
> apollo_modelOutput(model, modelOutput_settings)
Model run by cf21091 using Apollo 0.3.4 on R 4.3.0 for Windows.
Please acknowledge the use of Apollo by citing Hess & Palma (2019)
DOI 10.1016/j.jocm.2019.100170
www.ApolloChoiceModelling.com

Model name : mnl_robot_hu_asc
Model description : MNL on robot informal care - Hungary
Model run at : 2024-10-18 10:01:44.933675
Estimation method : bgw
Model diagnosis : Relative function convergence
Optimisation diagnosis : Maximum found
hessian properties : Negative definite
maximum eigenvalue : -153.509396
reciprocal of condition number : 1.33772e-05
Number of individuals : 400
Number of rows in database : 4000
Number of modelled outcomes : 4000

Number of cores used : 1
Model without mixing

LL(start) : -2772.59
LL at equal shares, LL(0) : -2772.59
LL at observed shares, LL(C) : -2765.74
LL(final) : -2611.28
Rho-squared vs equal shares : 0.0582
Adj.Rho-squared vs equal shares : 0.0542
Rho-squared vs observed shares : 0.0558
Adj.Rho-squared vs observed shares : 0.0522
AIC : 5244.57
BIC : 5313.8

Estimated parameters : 11
Time taken (hh:mm:ss) : 00:00:1.22
pre-estimation : 00:00:0.42
estimation : 00:00:0.19
post-estimation : 00:00:0.61
Iterations : 6

Unconstrained optimisation.

Estimates:
Estimate s.e. t.rat.(0) p(1-sided) Rob.s.e. Rob.t.rat.(0) p(1-sided)
asc1 0.135263 0.03303 4.0947 2.114e-05 0.03678 3.6778 1.1764e-04
asc2 0.000000 NA NA NA NA NA NA
coeff_robot 0.000000 NA NA NA NA NA NA
coeff_human -0.160443 0.04577 -3.5052 2.2813e-04 0.04804 -3.3398 4.1919e-04
coeff_animal -0.463064 0.04665 -9.9271 0.000000 0.05568 -8.3160 0.000000
coeff_small -0.127603 0.04624 -2.7593 0.002896 0.04462 -2.8595 0.002122
coeff_medium 0.000000 NA NA NA NA NA NA
coeff_large -0.148183 0.04848 -3.0564 0.001120 0.04556 -3.2524 5.7213e-04
coeff_func1 0.000000 NA NA NA NA NA NA
coeff_func2 0.433066 0.05727 7.5618 1.987e-14 0.06515 6.6468 1.498e-11
coeff_func3 0.239602 0.05622 4.2618 1.014e-05 0.05519 4.3417 7.069e-06
coeff_func4 0.044368 0.05804 0.7644 0.222310 0.05878 0.7548 0.225191
coeff_surv 0.138042 0.03299 4.1840 1.432e-05 0.03605 3.8289 6.437e-05
coeff_help 0.144731 0.03300 4.3852 5.795e-06 0.03405 4.2511 1.064e-05
coeff_cost -0.002957 2.9733e-04 -9.9454 0.000000 3.9817e-04 -7.4266 5.573e-14

>
> # ----------------------------------------------------------------- #
> #---- FORMATTED OUTPUT (TO FILE, using model name) ----
> # ----------------------------------------------------------------- #
>
> apollo_saveOutput(model, modelOutput_settings)

Old result file "output/mnl_robot_hu_asc_output.txt"
renamed to: "output/mnl_robot_hu_asc_OLD1_output.txt"
Old result file "output/mnl_robot_hu_asc_estimates.csv"
renamed to: "output/mnl_robot_hu_asc_OLD1_estimates.csv"
Old result file "output/mnl_robot_hu_asc_model.rds"
renamed to: "output/mnl_robot_hu_asc_OLD1_model.rds"
Model output saved to output/mnl_robot_hu_asc_output.txt
Estimates saved to output/mnl_robot_hu_asc_estimates.csv
Model object saved to output/mnl_robot_hu_asc.rds
>
> #------------------WTP-----------------------------------------------------
>
> deltaMethod_settings=list(expression=c(wtp_human_vs_robot="coeff_human/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_human_vs_robot 54.2577 17.0716 3.18
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_animal_vs_robot="coeff_animal/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_animal_vs_robot 156.5959 24.979 6.27
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_small_vs_medium="coeff_small/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_small_vs_medium 43.1518 15.9691 2.7
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_large_vs_medium="coeff_large/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_large_vs_medium 50.1114 15.5464 3.22
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_func2_vs_func1="coeff_func2/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_func2_vs_func1 -146.4514 27.1215 -5.4
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_func3_vs_func1="coeff_func3/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_func3_vs_func1 -81.027 20.3672 -3.98
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_func4_vs_func1="coeff_func4/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_func4_vs_func1 -15.0041 19.8736 -0.75
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_surv="coeff_surv/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_surv -46.6821 12.0378 -3.88
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).
>
> deltaMethod_settings=list(expression=c(wtp_help="coeff_help/coeff_cost"))
> apollo_deltaMethod(model, deltaMethod_settings)
Running Delta method computation for user-defined function using robust standard errors

Expression Value s.e. t-ratio (0)
wtp_help -48.9443 11.5418 -4.24
INFORMATION: The results of the Delta method calculations are returned invisibly as an output from this function. Calling the function via
result=apollo_deltaMethod(...) will save this output in an object called result (or otherwise named object).



-MMNL--------------------------------------------------------------------------------------------------------------------------------------------------------


> setwd("C:/Users/cf21091/OneDrive - University of Bristol/TKP/data/analysis")
>
> ### Clear memory
> rm(list = ls())
>
> ### Load Apollo library
> library(apollo)
>
> ### Initialise code
> apollo_initialise()
Apollo ignition sequence completed
>
> ### Set core controls
> apollo_control = list(
+ modelName = "MMNL_robot_hu_MMNL",
+ modelDescr = "MMNL model on robot data - HU",
+ indivID = "id",
+ nCores = 3,
+ outputDirectory = "output"
+ )
>
> # ################################################################# #
> #### LOAD DATA AND APPLY ANY TRANSFORMATIONS ####
> # ################################################################# #
>
> ### Loading data from package
> ### if data is to be loaded from a file (e.g. called data.csv),
> ### the code would be: database = read.csv("data.csv",header=TRUE)
> database=read.csv("robot_choices_data_hu.csv",header=TRUE)
>
> ### for data dictionary, use ?apollo_swissRouteChoiceData
>
> # ################################################################# #
> #### DEFINE MODEL PARAMETERS ####
> # ################################################################# #
>
> ### Vector of parameters, including any that are kept fixed in estimation
> apollo_beta = c( asc1=0,
+ asc2=0,
+ coeff_robot = 0,
+ coeff_human = -0.086,
+ coeff_animal = -0.477,
+ coeff_small = -0.168,
+ coeff_medium = 0,
+ coeff_large = -0.138,
+ coeff_func1 = 0,
+ coeff_func2 = 0.45,
+ coeff_func3 = 0.208,
+ coeff_func4 = 0.099,
+ coeff_surv = 0.106,
+ coeff_help = 0.076,
+ coeff_cost_mu = -5.86 ,
+ coeff_cost_sigma = -0 #log(abs (coeff_mnl))
+ )
>
> ### Vector with names (in quotes) of parameters to be kept fixed at their starting value in apollo_beta, use apollo_beta_fixed = c() if none
> apollo_fixed = c( "coeff_robot", "coeff_medium", "coeff_func1", "asc2")
>
> # ################################################################# #
> #### DEFINE RANDOM COMPONENTS ####
> # ################################################################# #
>
> ### Set parameters for generating draws
> apollo_draws = list(
+ interDrawsType = "halton",
+ interNDraws = 100,
+ interNormDraws = c("draws_cost")
+ )
>
> ### Create random parameters
> apollo_randCoeff = function(apollo_beta, apollo_inputs){
+ randcoeff = list()
+
+ randcoeff[["cost_coeff"]] = -exp(coeff_cost_mu + coeff_cost_sigma * draws_cost)
+
+
+ return(randcoeff)
+ }
>
> # ################################################################# #
> #### GROUP AND VALIDATE INPUTS ####
> # ################################################################# #
>
> apollo_inputs = apollo_validateInputs()
apollo_draws and apollo_randCoeff were found, so apollo_control$mixing was set to TRUE
Several observations per individual detected based on the value of id. Setting panelData in apollo_control set to TRUE.
All checks on apollo_control completed.
WARNING: Your database contains some entries that are NA. This may well be intentional, but be advised that if these entries are used
in your model, the behaviour may be unexpected.
All checks on database completed.
Generating inter-individual draws . Done
>
> # ################################################################# #
> #### DEFINE MODEL AND LIKELIHOOD FUNCTION ####
> # ################################################################# #
>
> apollo_probabilities=function(apollo_beta, apollo_inputs, functionality="estimate"){
+
+ ### Function initialisation: do not change the following three commands
+ ### Attach inputs and detach after function exit
+ apollo_attach(apollo_beta, apollo_inputs)
+ on.exit(apollo_detach(apollo_beta, apollo_inputs))
+
+ ### Create list of probabilities P
+ P = list()
+
+ ### List of utilities: these must use the same names as in mnl_settings, order is irrelevant
+ V = list()
+ V[["alt1"]] = (asc1+coeff_robot*(a_type==0) + coeff_human*(a_type==1)+ coeff_animal*(a_type==2)
+ + coeff_small*(a_size==0) + coeff_medium*(a_size==1) + coeff_large*(a_size==2)
+ + coeff_func1*(a_function==0) + coeff_func2*(a_function==1) + coeff_func3*(a_function==2) + coeff_func4*(a_function==3)
+ + coeff_help*a_help
+ + coeff_surv*a_surv
+ + cost_coeff*a_cost)
+
+ V[["alt2"]] = (asc2+coeff_robot*(b_type==0) + coeff_human*(b_type==1)+ coeff_animal*(b_type==2)
+ + coeff_small*(b_size==0) + coeff_medium*(b_size==1) + coeff_large*(b_size==2)
+ + coeff_func1*(b_function==0) + coeff_func2*(b_function==1) + coeff_func3*(b_function==2) + coeff_func4*(b_function==3)
+ + coeff_help*b_help
+ + coeff_surv*b_surv
+ + cost_coeff*b_cost)
+
+ ### Define settings for MNL model component
+ mnl_settings = list(
+ alternatives = c(alt1=1, alt2=2),
+ avail = list(alt1=1, alt2=1),
+ choiceVar = choice_,
+ utilities = V
+ )
+
+ ### Compute probabilities using MNL model
+ P[["model"]] = apollo_mnl(mnl_settings, functionality)
+
+ ### Take product across observation for same individual
+ P = apollo_panelProd(P, apollo_inputs, functionality)
+
+ ### Average across inter-individual draws
+ P = apollo_avgInterDraws(P, apollo_inputs, functionality)
+
+ ### Prepare and return outputs of function
+ P = apollo_prepareProb(P, apollo_inputs, functionality)
+ return(P)
+ }
>
> # ################################################################# #
> #### MODEL ESTIMATION ####
> # ################################################################# #
>
> model = apollo_estimate(apollo_beta, apollo_fixed,
+ apollo_probabilities, apollo_inputs)
Preparing user-defined functions.

Testing likelihood function...

Overview of choices for MNL model component :
alt1 alt2
Times available 4000.00 4000.00
Times chosen 2117.00 1883.00
Percentage chosen overall 52.92 47.08
Percentage chosen when available 52.92 47.08


Pre-processing likelihood function...
Creating cluster...
Preparing workers for multithreading...

Testing influence of parameters
Starting main estimation

BGW using analytic model derivatives supplied by caller...


Iterates will be written to:
output/MMNL_robot_hu_MMNL_iterations.csv
it nf F RELDF PRELDF RELDX MODEL stppar
0 1 2.626113606e+03
1 2 2.611038220e+03 5.741e-03 1.663e-03 4.21e-03 G 4.67e+00
2 3 2.575185718e+03 1.373e-02 1.164e-02 6.41e-02 G 0.00e+00
3 4 2.572834027e+03 9.132e-04 9.654e-04 4.78e-03 G 0.00e+00
4 5 2.572611496e+03 8.649e-05 1.051e-04 8.51e-03 G 0.00e+00
5 6 2.572570834e+03 1.581e-05 2.036e-05 1.39e-03 G 0.00e+00
6 7 2.572561739e+03 3.535e-06 4.785e-06 2.00e-03 G 0.00e+00
7 8 2.572559557e+03 8.482e-07 1.178e-06 7.32e-04 G 0.00e+00
8 9 2.572559014e+03 2.111e-07 3.013e-07 5.22e-04 G 0.00e+00
9 10 2.572558878e+03 5.315e-08 7.775e-08 1.88e-04 G 0.00e+00
10 11 2.572558843e+03 1.354e-08 2.032e-08 1.39e-04 G 0.00e+00
11 12 2.572558834e+03 3.469e-09 5.336e-09 4.80e-05 G 0.00e+00
12 13 2.572558831e+03 1.100e-09 9.292e-10 2.51e-05 S 0.00e+00
13 14 2.572558831e+03 9.733e-11 8.110e-11 7.15e-06 S 0.00e+00

***** Relative function convergence *****

Estimated parameters with approximate standard errors from BHHH matrix:
Estimate BHHH se BHH t-ratio (0)
asc1 0.11377 0.03178 3.5794
asc2 0.00000 NA NA
coeff_robot 0.00000 NA NA
coeff_human -0.11279 0.04836 -2.3320
coeff_animal -0.43053 0.04273 -10.0756
coeff_small -0.18733 0.05113 -3.6639
coeff_medium 0.00000 NA NA
coeff_large -0.13203 0.05633 -2.3439
coeff_func1 0.00000 NA NA
coeff_func2 0.43678 0.05303 8.2361
coeff_func3 0.26401 0.05997 4.4025
coeff_func4 0.02662 0.06103 0.4362
coeff_surv 0.11202 0.03300 3.3950
coeff_help 0.14976 0.03533 4.2392
coeff_cost_mu -6.58697 0.26313 -25.0331
coeff_cost_sigma 1.73083 0.23329 7.4192

Final LL: -2572.5588

Calculating log-likelihood at equal shares (LL(0)) for applicable models...
Calculating log-likelihood at observed shares from estimation data (LL(c)) for applicable models...
Calculating LL of each model component...
Calculating other model fit measures
Computing covariance matrix using numerical jacobian of analytical gradient.
0%....25%....50%....75%....100%
Negative definite Hessian with maximum eigenvalue: -9.466567
Computing score matrix...

Your model was estimated using the BGW algorithm. Please acknowledge this by citing Bunch et al. (1993) - DOI
10.1145/151271.151279
>
> # ################################################################# #
> #### MODEL OUTPUTS ####
> # ################################################################# #
>
> # ----------------------------------------------------------------- #
> #---- FORMATTED OUTPUT (TO SCREEN) ----
> # ----------------------------------------------------------------- #
>
> apollo_modelOutput(model)
Model run by cf21091 using Apollo 0.3.4 on R 4.3.0 for Windows.
Please acknowledge the use of Apollo by citing Hess & Palma (2019)
DOI 10.1016/j.jocm.2019.100170
www.ApolloChoiceModelling.com

Model name : MMNL_robot_hu_MMNL
Model description : MMNL model on robot data - HU
Model run at : 2024-10-18 10:04:46.535351
Estimation method : bgw
Model diagnosis : Relative function convergence
Optimisation diagnosis : Maximum found
hessian properties : Negative definite
maximum eigenvalue : -9.466567
reciprocal of condition number : 0.0106596
Number of individuals : 400
Number of rows in database : 4000
Number of modelled outcomes : 4000

Number of cores used : 3
Number of inter-individual draws : 100 (halton)

LL(start) : -2626.11
LL at equal shares, LL(0) : -2772.59
LL at observed shares, LL(C) : -2765.74
LL(final) : -2572.56
Rho-squared vs equal shares : 0.0721
Adj.Rho-squared vs equal shares : 0.0678
Rho-squared vs observed shares : 0.0698
Adj.Rho-squared vs observed shares : 0.0659
AIC : 5169.12
BIC : 5244.65

Estimated parameters : 12
Time taken (hh:mm:ss) : 00:00:37.34
pre-estimation : 00:00:11.38
estimation : 00:00:5.42
post-estimation : 00:00:20.53
Iterations : 13

Unconstrained optimisation.

Estimates:
Estimate s.e. t.rat.(0) Rob.s.e. Rob.t.rat.(0)
asc1 0.11377 0.03455 3.2928 0.03923 2.8999
asc2 0.00000 NA NA NA NA
coeff_robot 0.00000 NA NA NA NA
coeff_human -0.11279 0.04797 -2.3510 0.05076 -2.2221
coeff_animal -0.43053 0.04846 -8.8840 0.05775 -7.4552
coeff_small -0.18733 0.04943 -3.7896 0.04938 -3.7935
coeff_medium 0.00000 NA NA NA NA
coeff_large -0.13203 0.05180 -2.5488 0.04996 -2.6427
coeff_func1 0.00000 NA NA NA NA
coeff_func2 0.43678 0.05929 7.3667 0.06869 6.3591
coeff_func3 0.26401 0.05850 4.5133 0.05950 4.4368
coeff_func4 0.02662 0.06064 0.4391 0.06320 0.4213
coeff_surv 0.11202 0.03467 3.2307 0.03856 2.9053
coeff_help 0.14976 0.03508 4.2689 0.03731 4.0141
coeff_cost_mu -6.58697 0.25893 -25.4387 0.27753 -23.7340
coeff_cost_sigma 1.73083 0.22154 7.8125 0.22289 7.7653

>
> # ----------------------------------------------------------------- #
> #---- FORMATTED OUTPUT (TO FILE, using model name) ----
> # ----------------------------------------------------------------- #
>
> apollo_saveOutput(model)

Old result file "output/MMNL_robot_hu_MMNL_output.txt"
renamed to: "output/MMNL_robot_hu_MMNL_OLD4_output.txt"
Old result file "output/MMNL_robot_hu_MMNL_estimates.csv"
renamed to: "output/MMNL_robot_hu_MMNL_OLD4_estimates.csv"
Old result file "output/MMNL_robot_hu_MMNL_model.rds"
renamed to: "output/MMNL_robot_hu_MMNL_OLD4_model.rds"
Model output saved to output/MMNL_robot_hu_MMNL_output.txt
Estimates saved to output/MMNL_robot_hu_MMNL_estimates.csv
Model object saved to output/MMNL_robot_hu_MMNL.rds
>
> # ################################################################# #
> ##### POST-PROCESSING ####
> # ################################################################# #
>
> ### Print outputs of additional diagnostics to new output file (remember to close file writing when complete)
> apollo_sink()
Writing output to file output/MMNL_robot_hu_MMNL_additional_output.txt. Please run "apollo_sink()" again after finishing
writing results.
>
>
>
>
> beta_cost = -exp(rnorm(10^6,model$estimate["coeff_cost_mu"],abs(model$estimate["coeff_cost_sigma"])))
> mean(beta_cost)
[1] -0.006152587
>
> wtp_human = model$estimate["coeff_human"] / beta_cost
> mean(wtp_human)
[1] 365.3774
> sd(wtp_human)
[1] 1464.519
>
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_human"]/unconditionals$cost_coeff)
[1] -365.8995
> sd(-model$estimate["coeff_human"]/unconditionals$cost_coeff)
[1] 1466.469
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_animal"]/unconditionals$cost_coeff)
[1] -1396.712
> sd(-model$estimate["coeff_animal"]/unconditionals$cost_coeff)
[1] 5597.806
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_large"]/unconditionals$cost_coeff)
[1] -428.3184
> sd(-model$estimate["coeff_large"]/unconditionals$cost_coeff)
[1] 1716.635
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_small"]/unconditionals$cost_coeff)
[1] -607.7336
> sd(-model$estimate["coeff_small"]/unconditionals$cost_coeff)
[1] 2435.703
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_func2"]/unconditionals$cost_coeff)
[1] 1417.005
> sd(-model$estimate["coeff_func2"]/unconditionals$cost_coeff)
[1] 5679.139
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_func3"]/unconditionals$cost_coeff)
[1] 856.4948
> sd(-model$estimate["coeff_func3"]/unconditionals$cost_coeff)
[1] 3432.7
>
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_func4"]/unconditionals$cost_coeff)
[1] 86.37589
> sd(-model$estimate["coeff_func4"]/unconditionals$cost_coeff)
[1] 346.1813
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_surv"]/unconditionals$cost_coeff)
[1] 363.4151
> sd(-model$estimate["coeff_surv"]/unconditionals$cost_coeff)
[1] 1456.512
>
> unconditionals=apollo_unconditionals(model,apollo_probabilities,apollo_inputs)
Unconditional distributions computed
> mean(-model$estimate["coeff_help"]/unconditionals$cost_coeff)
[1] 485.8525
> sd(-model$estimate["coeff_help"]/unconditionals$cost_coeff)
[1] 1947.222
>
>
> apollo_sink()
Output is no longer being written to file.
dpalma
Posts: 226
Joined: 24 Apr 2020, 17:54

Re: comparing WTP estimates from MNL and MMNL model

Post by dpalma »

Hi Petra,

Log-normal distributions tend to have a very long tail, or they can concentrate very close to zero, making WTP estimates unstable. As a general recommendation, you may want to avoid making only the cost coefficient random. When you only make one coefficient random, all heterogeneity goes into that coefficient (even that from other correlated explanatory variables), which can muddle interpretation, or make your coefficient take unexpected values. So I would recommend making other coefficients random as well, or trying other ways to include heterogeneity, such as interacting the cost coefficient with income, or other observable characteristics of the respondent.

Hope this helps.

Best wishes
David
pbaji
Posts: 6
Joined: 18 Oct 2024, 10:30

Re: comparing WTP estimates from MNL and MMNL model

Post by pbaji »

Thanks very much for the suggestions, David. This is very helpful. I have already included some interactions to the MNL model, which seems to work well. I will try to include more random coeff in the MMNL as well to see what happens.
Many thanks,
Petra
Post Reply