Skip to content
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
Closed

add support for individual probabilities in choice #211

gdementen opened this issue Apr 1, 2016 · 1 comment
Assignees
Milestone

Comments

@gdementen
Copy link
Member

  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
Copy link
Member Author

#213 would make it yet nicer.

  better:
      test2:
          - event_outcome: choice(EVENT_PROBABILITIES)

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

No branches or pull requests

1 participant