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. This may take a day or two at busy times. There is no need to submit the post multiple times.

Marginal rate of substitution for different sociodemographic groups

Ask questions about post-estimation functions (e.g. prediction, conditionals, etc) or other processing of results.
Post Reply
kkavta
Posts: 2
Joined: 09 Feb 2024, 12:41

Marginal rate of substitution for different sociodemographic groups

Post by kkavta »

Dear Prof. Hess.

I recently estimated a mixed logit model and calculated two different Marginal Rate of Substitution (MRS) indicators for the entire sample in the following way:

randcoeff[["b_tt"]] = -exp( mu_log_b_tt + sigma_log_b_tt * draws_tt )
randcoeff[["b_info"]] = exp(mu_log_b_info + sigma_log_b_info * draws_info)
randcoeff[["b_money"]] = exp(mu_log_b_money + sigma_log_b_money * draws_money)

1) Value of Risk Reduction (VRR) = (unconditionals[["b_info"]]/unconditionals[["b_tt"]])
(mean(VRR)); (sd(VRR))

2) Willingness to Accept (WTA) = (unconditionals[["b_tt"]]/unconditionals[["b_money"]])
(mean(WTA)); (sd(WTA))

Now, I aim to calculate these indicators for different socio-demographic groups using the below code:

VRR_ageL35 = (unconditionals[["b_info"]]/unconditionals[["b_tt"]]* (database$age == 1|database$age==2|database$age ==3))
(mean(VRR_ageL35)); (sd(VRR_ageL35))

WTA_ageL35 = ((unconditionals[["b_tt"]]/unconditionals[["b_money"]]) * (database$age == 1|database$age==2|database$age ==3))
(mean(WTA_ageL35)); (sd(WTA_ageL35))

The questions are the following:

A) Is the way I'm using to calculate MRS for different socio-demographic groups correct? If it is correct way, then my next question is:

B) Behaviorally, the values of VRR and WTA should have inverse relation, i.e. the socio-demogrpahic group that has higher value for VRR should have lower value for WTA, but unfortunately it is not the case in the results. What could be the reason for this?

Thank you for your kind support.

Regards,
K
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Marginal rate of substitution for different sociodemographic groups

Post by stephanehess »

Hi

it looks like you are not including those socio-demographics in the random coefficients, so they would not affect the MRS

Regarding your code, you will want to use subset instead of multiplication by a 0/1 indicator

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
kkavta
Posts: 2
Joined: 09 Feb 2024, 12:41

Re: Marginal rate of substitution for different sociodemographic groups

Post by kkavta »

Dear Prof. Hess,

Thank you for the reply.

Is it must to add socio-demographic variables in randcoeff to get MRS for different SD group? Instead can't it be obtained just by splitting the data base for the SD group of interest and calculating MRS?

I attempted to conduct the analysis by changing the database specific to SD group and then calculating the MRS separately. However, I encountered a issue where the MRS values do not change despite changes in the database. Could you kindly review the code below to identify any potential errors?

Code: Select all

unconditionals <- apollo_unconditionals(model,apollo_probabilities,apollo_inputs)

conditionals <- apollo_conditionals(model,apollo_probabilities,apollo_inputs)

mean(unconditionals[["b_tt"]])
sd(unconditionals[["b_tt"]])
summary(conditionals[["b_tt"]])

mean(unconditionals[["b_info"]])
sd(unconditionals[["b_info"]])
summary(conditionals[["b_info"]])

mean(unconditionals[["b_money"]])
sd(unconditionals[["b_money"]])
summary(conditionals[["b_money"]])

VRR = (unconditionals[["b_info"]]/unconditionals[["b_tt"]])
(mean(VRR)); (sd(VRR))

summary((conditionals[["b_info"]]/conditionals[["b_tt"]]))

WTA = (unconditionals[["b_tt"]]/unconditionals[["b_money"]])
(mean(WTA)); (sd(WTA))

summary((conditionals[["b_tt"]]/conditionals[["b_money"]]))

database_backup=database

database = subset(database,(database$age == 1|database$age==2|database$age ==3))

apollo_inputs = apollo_validateInputs()

VRR_ageL35 = (unconditionals[["b_info"]]/unconditionals[["b_tt"]])
(mean(VRR_ageL35)); (sd(VRR_ageL35))

WTA_ageL35 = ((unconditionals[["b_tt"]]/unconditionals[["b_money"]]))
(mean(WTA_ageL35)); (sd(WTA_ageL35))
database = database_backup

database = subset(database,(database$job_exp==1))

apollo_inputs = apollo_validateInputs()

VRR_expL1 = ((unconditionals[["b_info"]]/unconditionals[["b_tt"]]))
(mean(VRR_expL1)); (sd(VRR_expL1))

WTA_expL1 = ((unconditionals[["b_tt"]]/unconditionals[["b_money"]]))
(mean(WTA_expL1)); (sd(WTA_expL1))

Thank you,
K
Last edited by kkavta on 02 Apr 2024, 19:18, edited 1 time in total.
stephanehess
Site Admin
Posts: 998
Joined: 24 Apr 2020, 16:29

Re: Marginal rate of substitution for different sociodemographic groups

Post by stephanehess »

Hi

your unconditional distributions will not be different for people with different socio-demographics unless you have included the interactions in apollo_randCoeff. So subsetting the data will not do anything

Stephane
--------------------------------
Stephane Hess
www.stephanehess.me.uk
Post Reply