Page 3 of 3

Re: WTP for mixed logit with random parameters

Posted: 10 Aug 2023, 09:50
by stephanehess
Sorry for the slow reply, I was travelling.

the delta method calculation gives you standard errors for functions of model parameters. These relate to the fact that you have a finite sample. You can use the delta method for any functions, including moments of wtp.

If you have a normally distributed numerator (with mean mu_A2 and standard deivation sd_A2) and a fixed denominator (b_price), then you would get the following moments for wtp

mean: mu_A2/b_price
sd: sd_A2/b_price

with a lognormal, it's more difficult as you would need to apply the formula to get the mean and sd of the lognormal.

The second part in your message relates to the distribution in a population, but you are mixing up two things here in your answer, as you are dividing the distributed parameter by the mean and sd. What you probably want to do is

mean(un$b_A2/un$b_price)
sd(un$b_A2/un$b_price)

but it's getting a bit difficult to follow this - maybe just tell me what your final model actually is and what results you want to compute

Thanks

Re: WTP for mixed logit with random parameters

Posted: 20 Oct 2023, 13:34
by JuliavB
Dear Stephane,

please find below the final model with a normally distributed numerator (with mean mu_HoeheEEE and standard deviation sd_HoeheEEE) and a fixed denominator for price (b_Beitr).

I would like to compute the results for the WTP for the HoeheEEE attribute:

I would do the following:
I would calculate the moments of WTP like this:

mean: mu_HoeheEEE/b_Beitr
sd: sd_HoeheEEE/b_Beitr

and can get the standard errors for this moments via delta method:

deltaMethod_settings=list(expression=c(WTP_Hoehe="(mu_HoeheEEE/b_Beitr)"))
apollo_deltaMethod(model, deltaMethod_settings)

deltaMethod_settings=list(expression=c(sd_Hoehe="(sd_HoeheEEE/b_Beitr)"))
apollo_deltaMethod(model, deltaMethod_settings)

BUT: What is the WTP that needs to be reported? Are there any further calculations necessary OR is it just fine to report both mu_HoeheEEE/b_Beitr and sd_HoeheEEE/b_Beitr separately to show the heterogeneity?!

Your advice is highly appreciated.
Thanks and best,
J.
____________________

# ################################################################# #
#### DEFINE MODEL PARAMETERS ####
# ################################################################# #
### Vector of parameters, including any kept fixed during estimation
apollo_beta = c(b0 = 0,
sigma_panel = 0,
b_Beitr = 0,
mu_HoeheEEE = 0,
sigma_HoeheEEE = 0,
b_HoeheEEEunb = 0, # dummy
mu_ZeitEEE = 0,
sigma_ZeitEEE = 0,
b_ZeitEEEunb = 0) # dummy

### Vector with parameter names (in quotes) to be kept fixed at
# their starting values during estimation.
# Use apollo_beta_fixed = c() if none
apollo_fixed = c()

# ################################################################# #
#### DEFINE RANDOM COMPONENTS // RP ####
# ################################################################# #

### Set parameters for generating draws
apollo_draws = list(
interDrawsType = "mlhs",
interNDraws = 600,
interUnifDraws = c(),
interNormDraws = c("draws_HoeheEEE","draws_ZeitEEE","draws_alt1","draws_alt2","draws_alt3"),
intraDrawsType = "halton",
intraNDraws = 0,
intraUnifDraws = c(),
intraNormDraws = c()
)

### Create random parameters
apollo_randCoeff = function(apollo_beta, apollo_inputs){
randcoeff = list()

#randcoeff[["b_Beitr"]] = mu_Beitr + sigma_Beitr * draws_Beitr
#randcoeff[["b_Beitr"]] = -exp(mu_Beitr + sigma_Beitr * draws_Beitr)
randcoeff[["b_HoeheEEE"]] = mu_HoeheEEE + sigma_HoeheEEE * draws_HoeheEEE
randcoeff[["b_ZeitEEE"]] = mu_ZeitEEE + sigma_ZeitEEE * draws_ZeitEEE

randcoeff[["ec_alt1"]] = sigma_panel * draws_alt1
randcoeff[["ec_alt2"]] = sigma_panel * draws_alt2
randcoeff[["ec_alt3"]] = sigma_panel * draws_alt3

return(randcoeff)
}


# ################################################################# #
#### GROUP AND VALIDATE INPUTS ####
# ################################################################# #

apollo_inputs = apollo_validateInputs()

# ################################################################# #
#### 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[["SQ"]] = b0 + b_Beitr*Beitr_1 + b_HoeheEEE*HoeheEEE_1*(HoeheEEE_1!=4) + b_HoeheEEEunb*(HoeheEEE_1==4) + b_ZeitEEE*ZeitEEE_1*(ZeitEEE_1!=4)+ b_ZeitEEEunb*(ZeitEEE_1==4)+ ec_alt1
V[["RefA"]] = b_Beitr*Beitr_2 + b_HoeheEEE*(HoeheEEE_2==3|HoeheEEE_2==6|HoeheEEE_2==9)*HoeheEEE_2 + b_HoeheEEEunb*(HoeheEEE_2==4) +b_ZeitEEE*ZeitEEE_2*(ZeitEEE_2!=4)+ b_ZeitEEEunb*(ZeitEEE_2==4)+ ec_alt2
V[["RefB"]] = b_Beitr*Beitr_3 + b_HoeheEEE*(HoeheEEE_3==3|HoeheEEE_3==6|HoeheEEE_3==9)*HoeheEEE_3 + b_HoeheEEEunb*(HoeheEEE_3==4) + b_ZeitEEE*ZeitEEE_3*(ZeitEEE_3!=4)+ b_ZeitEEEunb*(ZeitEEE_3==4)+ ec_alt3


### Define settings for MNL model component
mnl_settings = list(
alternatives = c(SQ=1, RefA=2, RefB=3),
choiceVar = Choice,
utilities = V
)
____________________________

Re: WTP for mixed logit with random parameters

Posted: 21 Oct 2023, 06:51
by stephanehess
Yes, that works, if you are indeed happy with a fixed cost coefficient, which is likely an inferior model specification.

also, you can do it all in one

Code: Select all

deltaMethod_settings=list(expression=c(WTP_Hoehe="(mu_HoeheEEE/b_Beitr)",sd_Hoehe="(sd_HoeheEEE/b_Beitr)"))
Stephane

Re: WTP for mixed logit with random parameters

Posted: 03 Apr 2024, 06:54
by Rodrigo_Z
Hi professor Stephane,

I have a follow-up question regarding this quote:
with a lognormal, it's more difficult as you would need to apply the formula to get the mean and sd of the lognormal.
In my case, I'm running MMNL models in the preference space, using normal distributions for the non-cost attributes and a negative log-normal distribution for the price attribute. My approach to estimating the WTP values and their standard errors (S.E.) is to use the Delta method. Therefore, I would appreciate it if you could elaborate more on what you mean by this. Is there any available example of how to use the Delta Method to estimate WTP when using these distributions? Otherwise, what formula should be used and you refer to?

Thank you!!
Rodrigo

Re: WTP for mixed logit with random parameters

Posted: 24 Apr 2024, 15:29
by stephanehess
Hi

the delta method in Apollo is for individual model parameters, not for distributed coefficients. In your case, you would need to use apollo_unconditionals to obtain the draws for the coefficients and calculate WTP moments that way, but you would not be able to use apollo_deltaMethod as you cannot analytically express the moments of the WTP distribution if you're dividing Normal by Lognormal

Stephane