Page 1 of 1

delta method to calculate WTP (normal and log-normal parameters)

Posted: 26 Apr 2021, 16:29
by Rea
Dear apollo-team,

I estimated a mixed logit with the non-cost attributes beeing normally distributed and the cost attribute negative log-normal in preference space.

Now I want to calculate the WTPs. I understand the cost attribute needs a "correction" and I can not directly apply the ratio operation within the delta-method between a normal distributed and a negative log-normal distributed parameter.
How do I proceed? I thought of applying the apollo_delta "twice"? First, use apollo_delta to get the mean and s.d. for the cost attribute parameter for the underlying normal by using the operation "lognormal".

But how do I proceed then? How can I now use these results then in a second step to calculate the WTPs for my non-cost-attributes? I assume I must somehow access the values of the mean and s.d. for the cost attribute of the underlying normal that are stored somewhere in apollo? I tried to look at what is stored in apollo_delta, but I could not find it there?

I hope for some support. Sorry, if this is a very trivial question!

Thank you very much in advance.
Rea

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 10 May 2021, 17:48
by dpalma
Hi Rea,

apollo_deltaMethod cannot do what you want (at least for now). What I recommend is simulating the distribution of the WTP.

Let's imagine the attribute you are interested in is called "attr". Its coefficient follows a normal distribution with mean mu_attr and standard deviation sg_attr. On the other hand, your cost coefficient follows a negative lognormal distribution, where the underlying normal has a mean of mu_cost and a standard deviation of sg_cost. Therefore, your apollo_randCoeff function may look as follows:

Code: Select all

apollo_randCoeff = function(apollo_beta, apollo_inputs){
  randcoeff = list()
  randcoeff[["b_attr"]] = mu_attr + sg_attr*draws_attr
  randcoeff[["b_cost"]] = -exp( mu_cost + sg_cost*draws_cost )
  return(randcoeff)
}
Now let's consider you already estimated your model, so the value of all parameters is available inside model$estimate. You can now generate a large number of draws from the distribution of each coefficient, calculate the ratio between them, and calculate the mean and s.e. of the ratio, which will be the mean and s.e. of the WTP, as follows:

Code: Select all

N = 1000
b_attr = rnorm(N, mean=model$estimate["mu_attr"], sd=model$estimate["sg_attr"])
b_cost = -exp(rnorm(N, mean=model$estimate["mu_cost"], sd=model$estimate["sg_cost"]))
wtp_attr = b_attr/b_cost
mean(wtp_attr); sd(wtp_attr)
For more details and other more elegant approaches to calculate the same you can look at
Daly, A.; Hess, S. and Train, K. (2012) Assuring finite moments for willingness to pay in random coefficient models. Transportation 39, 19-31.

Cheers
David

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 07 Mar 2022, 22:09
by malemu588@gmail.com
Dear David,

I have a random parameter logit model with price parameter fixed and other non-price parameters normally distributed. I used the function you provided above to calculate WTP, and things went well. However, it seems to me that I need to also calculate standard errors separately using another function, probably Apollo-bootstrap, right? I am a bit confused with your last statement saying ".....which will be the mean and s.e. of the WTP..."

My code is below. Note that since my price parameter is fixed, I didn't generate draws for it. Hope this is alright?

## calculating WTP after model estimation ##

N = 1000
qgreeR = rnorm(N, mean=model$estimate["qgree"], sd=model$estimate["sigma_qgree"])
cost = model$estimate["cost"]
wtp_attr = qgreeR/cost
wtp_attr
summary(wtp_attr)
mean(wtp_attr); sd(wtp_attr)

Thank you in advance.
/Mohammed

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 13:12
by stephanehess
Mohammed

the new version of Apollo allows you to use the Delta method for any function of estimated model parameters. So if you can write down a closed form version of the mean and sd of your WTP on the basis of estimated parameters, then you can use the Delta method for standard errors thereof. Full details are in the manual.

If your cost coefficient is fixed and the other parameters are normal, then the WTP is normal too, with mean and sd simply given by the mean and sd of the non-cost parameter divided by the fixed cost coefficient.

Stephane

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 14:10
by malemu588@gmail.com
Hi Stephane,

Thanks indeed for your response.

Okay good to know this. Given that my model is specified in preference space where utility is linear in parameters, can't I just take the ratio of the non-price attribute and the price attribute although the non-price parameters are random? In the following code, the cost parameter is not random while the others are random:

deltaMethod_settings=list(expression=c(WTP_qgree_mix = "-(qgree/cost)",
WTP_qblue_mix = "-(qblue/cost)",
WTP_anglng_mix = "-(anglng/cost)",
WTP_acess_mix = "-(acess/cost)",
WTP_suround_mix = "-(suround/cost)"))

apollo_deltaMethod(model, deltaMethod_settings)

/Mohammed

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 14:13
by stephanehess
Mohammed

your WTP will be normal too, like I say, so there is a mean and a standard deviation. So if qblue is the mean of the coefficient, then qblue/cost is the mean of the WTP

Stephane

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 14:45
by malemu588@gmail.com
Thank you Stephane.

Yes, that is true, there is a SD as WTP is normal. But my question was really how to estimate the WTP in Apollo when you have random parameters in your model. Sorry if I misunderstood something here. As you said, I need to specify a closed form for the mean and sd to use the delta method, and I was not entirely sure if it is correct just to divided the non-random parameters by the non-random parameters (cost), the same for the sd. The example provided in the manual is for non-random parameters if I am not mistaken. One suggestion was to use simulation which is fine. Thanks for your time.

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 14:52
by stephanehess
Hi

you seem to be confusing two things here when you say about dividing the "non-random parameters". If your non-cost coefficients follow a random distribution, then your WTP follows a random distribution too.

If the denominator of WTP is fixed, i.e. a non-random cost coefficient, then the WTP distribution always has defined moments, and you can just divide the random distribution by the fixed cost coefficient. You do not need the Delta method for that, the Delta method simply gives you the standard errors

Does this help?

Stephane

Re: delta method to calculate WTP (normal and log-normal parameters)

Posted: 09 Mar 2022, 15:02
by malemu588@gmail.com
Stephane, thanks really for your help. I appreciate it very much, it helps a lot.

Best,
Mohammed