Page 1 of 1

MNL model using allocation data

Posted: 15 Jan 2021, 01:13
by TCEagle
Does Apollo allow one to use proportions data from stated preference tasks in the MNL model?

I often have projects where I ask doctors to allocate a proportion of their patients across alternatives in the task. The log likelihood function becomes a simple weighted sum of the predicted probabilities across all alternatives in the task weighted by a proportion that sums to 1.0 across all alternatives in a task. E.G., LogLikelihood = sum[across all Alts](proportion * probability)[for each alt]. The likelihood is the product across all alts of the predicted probability raised to the proportion assign to the alt. It can be considered a proportion-form of the weighted MNL model where the weights are the frequency of observations choosing the alternative in the choice task -- only the frequency of observations is replaced by the proportions assigned to the alternative by the respondent.

Does anyone have an example likelihood function routine I can use to write my own? Or does someone already have such a routine. I would like to use in the HB routines of Apollo...

Thanks,

Tom

Re: MNL model using allocation data

Posted: 18 Jan 2021, 20:47
by dpalma
Hi Tom,

Currently, Apollo does not have any pre-coded function to estimate choice models where the choices are not at the individual task level. If you want to estimate a choice model with aggregate data, you could use one of two approaches.
  • One way to do it is to expand your data so that it represents individual choices. For example, if your data has two alternatives with 40% choosing alternative A, you could create 10 choices, all of them with the same two alternatives, and make four of them choose option A, and 6 option B.
  • The other way is using weight, and is more like the approach you mention. Considering the same example, you would create a new database with two observations, both with the same alternatives. The first observation chooses A, and the second B. The you assign a weight of 40% to the first observation, and 60% to the second.
To use weights, you need to include them in the database, and use the setting

Code: Select all

apollo_control$weights = "nameOfWeightColumn"
Where you need to change “nameOfWeightColumn” to whatever is appropriate in your database.

Cheers
David

Re: MNL model using allocation data

Posted: 18 Jan 2021, 21:22
by TCEagle
No, I think you misunderstood the issue. The allocation is at the individual respondent level. Think of a respondent allocating patients across a choice set of different treatments. The loglikelihood is the sum(allocation(j) * log(predicted Prob j)) where we sum across alternatives in the task.

Thanks,

Tom

Re: MNL model using allocation data

Posted: 19 Jan 2021, 15:15
by dpalma
Hi Tom,

Using the second approach would lead to the loglikelihood you want. Here are more detailed instructions.

Imagine you have one choice exercise with two alternatives (A and B), and two doctors answered your survey. The first doctor assigned 40% to alternative A, and 60% to alternative B. The second doctor assigned 50% to each alternative.

You would have to create a database as follows:

Code: Select all

doc obs xA1 xA2 xB1 xB2 choice weight
  1   1  a1  a2  b1  b2      A    0.6
  1   2  a1  a2  b1  b2      B    0.4
  2   1  a1  a2  b1  b2      A    0.5
  2   2  a1  a2  b1  b2      B    0.5
Where a1, a2, b1, and b2 are the numeric values of the attributes of each alternative (I’m assuming two attributes per alternative).

If you set apollo_control$weights="weight", then the loglikelihood of each row would become:
log( Prob(choice)^weight ) = weight*log(Prob(choice))
Then apollo would add the loglike across rows, leading to the “sum” in your formula.

You could implement this without the need to expand the database, but it would require some fiddling around.

Cheers
David

Re: MNL model using allocation data

Posted: 19 Jan 2021, 15:31
by TCEagle
Awesome! Thank you David! That is a huge help. I had not thought to replicate the tasks and changing the choice.

Tom