New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for individual probabilities in choice #211

Closed
gdementen opened this Issue Apr 1, 2016 · 1 comment

Comments

Projects
None yet
1 participant
@gdementen
Member

gdementen commented Apr 1, 2016

  current:
      test2:
          - threshold1: age / 200
          - threshold2: threshold1 + 0.1 + 0.3 * work
          - u: uniform()
          - event: if(u < threshold1, 1,
                       if(u < threshold2, 2,
                          3))
          - show(groupby(age, work, event))

  desired:
      test2:
          - prob1: age / 200
          - prob2: 0.1 + 0.3 * work
          # list of arrays
          - event: choice([1, 2, 3], [prob1, prob2, 1 - prob1 - prob2])
          # using a 2d array would make it easier in many cases (num_persons * num_choices)
          # e.g.
          # ARRAY is a 4d array, so the result is a 2d array  (num_persons * num_choices)
          - agegroup_idx: trunc(agegroup / 5)
          - event: choice([1, 2, 3], ARRAY[gender * 1, workstate, agegroup_idx])
          - show(groupby(age, work, event))

#117, would make this even nicer.

  desired:
      test2:
          # using .points API as if we had LArray under the hood.
          - event: choice([1, 2, 3], ARRAY.points[gender, workstate, agegroup])

@gdementen gdementen self-assigned this Apr 1, 2016

@gdementen gdementen added this to the 0.12 milestone Apr 1, 2016

@gdementen

This comment has been minimized.

Member

gdementen commented Apr 1, 2016

#213 would make it yet nicer.

  better:
      test2:
          - event_outcome: choice(EVENT_PROBABILITIES)

@gdementen gdementen closed this in d66c5eb May 31, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment