I estimated a mixed logit in WTP space for four normally distributed ES attributes and a lognormally distributed price attribute. Here's the output of the model:
Code: Select all
Estimation method : bfgs
Model diagnosis : successful convergence
Number of individuals : 1481
Number of rows in database : 13329
Number of modelled outcomes : 13329
Number of cores used : 3
Number of inter-individual draws : 1000 (sobol)
LL(start) : -21189.34
LL(0) : -14643.4
LL(C) : -13293.59
LL(final) : -9075.805
Rho-square (0) : 0.3802
Adj.Rho-square (0) : 0.3794
AIC : 18175.61
BIC : 18265.58
Estimated parameters : 12
Time taken (hh:mm:ss) : 00:41:48.97
pre-estimation : 00:05:46.44
estimation : 00:22:51.68
post-estimation : 00:13:10.85
Iterations : 79
Min abs eigenvalue of Hessian : 37.39719
Estimates:
Estimate s.e. t.rat.(0) p(1-sided) Rob.s.e. Rob.t.rat.(0) p(1-sided)
asc_1 0.00000 NA NA NA NA NA NA
asc_2 0.01991 0.02567 0.7759 0.2189 0.02922 0.6815 0.247775
asc_3 -2.58419 0.09175 -28.1651 0.0000 0.11845 -21.8160 0.000000
mu_b_drought -0.64173 0.09266 -6.9254 2.174e-12 0.12688 -5.0578 2.120e-07
mu_b_flood -0.58441 0.09985 -5.8529 2.416e-09 0.13888 -4.2081 1.288e-05
mu_b_climate -0.74696 0.06022 -12.4045 0.0000 0.06668 -11.2024 0.000000
mu_b_water -2.16371 0.07843 -27.5866 0.0000 0.11316 -19.1216 0.000000
mu_log_b_price -4.02942 0.04899 -82.2573 0.0000 0.05402 -74.5904 0.000000
sigma_b_drought 0.55974 0.14421 3.8815 5.191e-05 0.20398 2.7440 0.003034
sigma_b_flood 0.50849 0.12936 3.9309 4.232e-05 0.15677 3.2436 5.9009e-04
sigma_b_climate 0.93712 0.08362 11.2075 0.0000 0.09213 10.1722 0.000000
sigma_b_water 2.87686 0.11856 24.2659 0.0000 0.16507 17.4284 0.000000
sigma_log_b_price 1.40620 0.06173 22.7806 0.0000 0.06884 20.4284 0.000000
Here's the relevant(?) part of the code:
Code: Select all
apollo_draws = list(
interDrawsType = "sobol",
interNDraws = 1000,
interNormDraws = c("draws_price_inter","draws_ES_inter")
)
apollo_randCoeff = function(apollo_beta,apollo_inputs){
randcoeff = list()
randcoeff[["b_drought"]] = mu_b_drought + sigma_b_drought * draws_ES_inter
randcoeff[["b_flood"]] = mu_b_flood + sigma_b_flood * draws_ES_inter
randcoeff[["b_climate"]] = mu_b_climate + sigma_b_climate * draws_ES_inter
randcoeff[["b_water"]] = mu_b_water + sigma_b_water * draws_ES_inter
randcoeff[["b_price"]] = -exp(mu_log_b_price + sigma_log_b_price * draws_price_inter)
return(randcoeff)
}
apollo_inputs <- apollo_validateInputs()
apollo_probabilities = function(apollo_beta,apollo_inputs,functionality="estimate"){
apollo_attach(apollo_beta,apollo_inputs)
on.exit(apollo_detach(apollo_beta,apollo_inputs))
P = list()
V = list()
V[['alt1']] = asc_1 + b_price * (b_drought * drought.1 + b_flood * flood.1 + b_climate * climate.1 + b_water * water.1 + price.1)
V[['alt2']] = asc_2 + b_price * (b_drought * drought.2 + b_flood * flood.2 + b_climate * climate.2 + b_water * water.2 + price.2)
V[['alt3']] = asc_3 + b_price * (b_drought * drought.3 + b_flood * flood.3 + b_climate * climate.3 + b_water * water.3 + price.3)
mnl_settings = list(
alternatives = c(alt1=1,alt2=2,alt3=3),
choiceVar = choice,
V = V
)
P[["model"]] = apollo_mnl(mnl_settings,functionality)
P = apollo_panelProd(P,apollo_inputs,functionality)
P = apollo_avgInterDraws(P,apollo_inputs,functionality)
P = apollo_prepareProb(P,apollo_inputs,functionality)
return(P)
}
mxl_wtp <- apollo_estimate(apollo_beta,apollo_fixed,apollo_probabilities,apollo_inputs)
apollo_modelOutput(mxl_wtp,
modelOutput_settings=list(printPVal=1))
conditionals <- apollo_conditionals(mxl_wtp,apollo_probabilities,apollo_inputs)
Bartosz