Search code examples
netlogovotingagent-based-modeling

Changing initial conditions in agent-based voter model


How could I change the initial conditions in this voter model?

There are agents with four opinions: negative confident, negative unsure, positive unsure, or positive confident. I'm not sure about the correct changes to make it work with setting values independently, i.e. x% negative confident, y% negative unsure, z% positive unsure and w% positive confident (x+y+z+w=100%).

Thank you in advance.


Solution

  • Your question can be broken into two separate pieces:

    • how to sample from a multinomial
    • how to put interdependent variables in the interface

    The first question has an easy answer. The second question does not. For example, suppose you include 3 sliders for w, x, and y and the compute z=1-w-x-y, how will you ensure z>0? The easiest way around this is to allow setting all 4 independently as relative weights, and then produced your probabilities by scaling each weight (i.e., by dividing by (w + x + y + z). This way you do not have to depend on the user to set sensible combinations of the slider values. (You can rule out having all zeros.)