Hello,
I wonder if it is appropriate to calculate WTP using binary variable and continuous variable. For example, I want to calculate the WTP of the presence of an attendant (yes = 1, no = 0). In this case, can I calculate the ratio of b_attendant and b_cost for the WTP?
Your advice will be helpful for me to improve the research paper.
Thank you very much in advance.
Important: Read this before posting to this forum
 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.
 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.
 Before asking a question on the forum, users are kindly requested to follow these steps:
 Check that the same issue has not already been addressed in the forum  there is a search tool.
 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
 Check the frequently asked questions section on the Apollo website, which discusses some common issues/failures. Please see http://www.apollochoicemodelling.com/faq.html
 Make sure that R is using the latest official release of Apollo.
 Users can check which version they are running by entering packageVersion("apollo").
 Then check what is the latest full release (not development version) at http://www.ApolloChoiceModelling.com/code.html.
 To update to the latest official version, just enter install.packages("apollo"). To update to a development version, download the appropriate binary file from http://www.ApolloChoiceModelling.com/code.html, and install the package from file
 If the above steps do not resolve the issue, then users should follow these steps when posting a question:
 provide full details on the issue, including the entire code and output, including any error messages
 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.
Willingnesstopay considering binary variable
Re: Willingnesstopay considering binary variable
Hi,
Yes, you calculate the WTP for binary variables the same way than for continuous ones. If you are using a linear in parameters utility function and fixed (as in nonrandom) coefficients, you simply calculate the ratio of b_attendant and b_cost to get the WTP for "attendant".
Cheers
David
Yes, you calculate the WTP for binary variables the same way than for continuous ones. If you are using a linear in parameters utility function and fixed (as in nonrandom) coefficients, you simply calculate the ratio of b_attendant and b_cost to get the WTP for "attendant".
Cheers
David

 Posts: 7
 Joined: 02 Feb 2021, 07:06
Re: Willingnesstopay considering binary variable
Thank you, David.
I got two more questions:
1. Since the coefficient of travel cost is negative, the ratio is negative. But the value presented by Apollo is the absolute value of this ratio. Can you please clarify how this negative ratio is to be interpreted and what it means for the willingnesstopay estimates?
2. Since the b_attendant variable is binary, I am not sure if calculating the value of human assistant by taking the ratio of the parameters is the right way since the utility won't be differentiable from the binary variable.
Thank you very much for your help in advance.
I got two more questions:
1. Since the coefficient of travel cost is negative, the ratio is negative. But the value presented by Apollo is the absolute value of this ratio. Can you please clarify how this negative ratio is to be interpreted and what it means for the willingnesstopay estimates?
2. Since the b_attendant variable is binary, I am not sure if calculating the value of human assistant by taking the ratio of the parameters is the right way since the utility won't be differentiable from the binary variable.
Thank you very much for your help in advance.
Re: Willingnesstopay considering binary variable
Hi,
Concerning your first question, what do you mean by "the value presented by Apollo"? The way I would calculate the WTP is first estimating a model, and then using the apollo_deltaMethod function to calculate the ratio between two (nonrandom) coefficients and its s.e. Something like:
The value returned by apollo_deltaMethod is not the absolute value, it can be positive, negative or zero. More in general, if the two coefficients have opposite sign you will get a negative marginal rate of substitution, meaning that to increase the utility you need to change the corresponding attributes in opposite directions, e.g. increase quality and decrease price. On the other hand, if you get a positive marginal rate of substitution, it means that to increase the utility you need to change both corresponding attributes in the same direction (note that this could mean an increase or decrease of the attributes, depending on their sign), e.g. reduce both the fate and travel time of a travel mode.
About your second question, the marginal rate of substitution (e.g. the WTP) is defined as dU/dx1 / dU/dx2. If U is a linear or any other continuous function on x1 and x2, then both dU/dx1 and dU/dx2 will exist. The fact that you only evaluate U at x1=0 or x1=1 does not make U discontinuous with respect to x1. So it is fine to calculate the marginal rate of substitution of a dummy variable.
What wouldn't make sense is to calculate the elasticity of the probability with respect to a dummy variable, as the dummy variable only makes discrete changes. In that case, it would be better to calculate the Average Marginal effect: P(i  x1=1)  P(i  x1=0).
Cheers
David
Concerning your first question, what do you mean by "the value presented by Apollo"? The way I would calculate the WTP is first estimating a model, and then using the apollo_deltaMethod function to calculate the ratio between two (nonrandom) coefficients and its s.e. Something like:
Code: Select all
apollo_deltaMethod(model, list(operation='ratio', parName1='b_tt_car', parName2='b_cost'))
About your second question, the marginal rate of substitution (e.g. the WTP) is defined as dU/dx1 / dU/dx2. If U is a linear or any other continuous function on x1 and x2, then both dU/dx1 and dU/dx2 will exist. The fact that you only evaluate U at x1=0 or x1=1 does not make U discontinuous with respect to x1. So it is fine to calculate the marginal rate of substitution of a dummy variable.
What wouldn't make sense is to calculate the elasticity of the probability with respect to a dummy variable, as the dummy variable only makes discrete changes. In that case, it would be better to calculate the Average Marginal effect: P(i  x1=1)  P(i  x1=0).
Cheers
David

 Posts: 10
 Joined: 24 Aug 2020, 15:07
 Location: Brazil
 Contact:
Re: Willingnesstopay considering binary variable
Hi David,
I have a question about computing Average Marginal effect for dummy variables, when you write P(i  x1=1)  P(i  x1=0), does it mean that I need to compute the probability for the complete estimated sample, and then subselect in the sample the observations with x1=1 and x1=0 and calculate the difference? Thanks in advance!
Best,
Gabriel
I have a question about computing Average Marginal effect for dummy variables, when you write P(i  x1=1)  P(i  x1=0), does it mean that I need to compute the probability for the complete estimated sample, and then subselect in the sample the observations with x1=1 and x1=0 and calculate the difference? Thanks in advance!
Best,
Gabriel
Re: Willingnesstopay considering binary variable
Hi Gabriel,
What I mean by P(i  x1=1) is that you take your database, and modify it so that everyone has x1=1, and then forecast the probability of choosing alternative i. Then, you modify the database again so that x1=0 for everyone, and forecast the probability of choosing i again, i.e. P(i  x1=0). Finally, you calculate the AME as the difference between the two.
Cheers
David
What I mean by P(i  x1=1) is that you take your database, and modify it so that everyone has x1=1, and then forecast the probability of choosing alternative i. Then, you modify the database again so that x1=0 for everyone, and forecast the probability of choosing i again, i.e. P(i  x1=0). Finally, you calculate the AME as the difference between the two.
Cheers
David