Simulation with AnyLogic/Agent-Based Modeling/Step 8. Adding adoption from word of mouth

From Wikibooks, open books for an open world
< Simulation with AnyLogic‎ | Agent-Based Modeling
Jump to navigation Jump to search

Step 8. Adding Adoption from Word of Mouth

In the current model people purchase the product affected by the advertising only. Actually, the advertising effect is great only when the product is launched on the market. Later on, people mostly purchase product under the influence of acquaintances that have already purchased it.

Now we will capture adoption from word of mouth. To consider the word of mouth influence, we should modify our model a little bit.
First of all, we will add special object defining the settings of the agent's environment.

Step 1. Creating a new model1.gif Add an object to define the agent' s environment

  1. Open the Main class diagram.
  2. Drag the Environment Step 8. Adding adoption from word of mouth1.gif element from the General page of the Palette view onto the diagram of class Main.
    Step 8. Adding adoption from word of mouth2.png
  3. Set this object as the environment for our agents. Select the embedded object people by clicking on it and type environment in its Environment property.
    Step 8. Adding adoption from word of mouth3.png

Now we need to define some new parameters:

  • ContactRate - the rate, with which potential adopters come into contact with adopters;
  • AdoptionFraction - the person’s cogency affecting the proportion of contacts that are sufficiently persuasive to induce his acquaintances to purchase the product.

Step 1. Creating a new model1.gif Define the number of contacts of the person per year

  1. Open the Person class diagram.
  2. Add new parameter ContactRate.
  3. Assume a contact rate of 100 per person per year. In the Default Value, type 100.

Step 1. Creating a new model1.gif Define the person’s cogency

  1. Add one more parameter.
  2. Name it AdoptionFraction.
  3. Set the default value to 0.015.

Step 1. Creating a new model1.gif Modify the statechart to introduce inter-agent communication

  1. Open the Person class diagram by double-clicking the Person item in the Project view.
  2. Add an internal transition to the Adopter state. Drag the Transition Step 3. Adding Adoption from Advertisement9.gif element from the Statechart page of the Palette view onto the diagram of active object class (so that the starting point of the transition lies on a border of Adopters state). Drag the ending point of the transition onto another border of Adopters state:
    Step 8. Adding adoption from word of mouth4.png
  3. This transition models how this person persuades his acquaintance to purchase the product. Transition’s rate depends on this person’s cogency and contact rate.
    Go to the General page of the transition's Properties view. Choose Rate from the Triggered by drop-down list and set this transiton to be taken with the following Rate:
    Step 8. Adding adoption from word of mouth5.png
  4. Specify the Action for the transition:
    send("Buy!", RANDOM);
    This transition sends a message to the statechart of some acquaintance of this person. The send() method sends a message to some another agent. The first parameter specifies the message that is sent, and the second defines the agent-recipient. In our case we send our message to some randomly chosen agent, so we specify special constant RANDOM here.
    You can find the method's description on the Agent class page of the AnyLogic API Reference (since we have defined our Person class as an agent, it extends the Agent active object class, that provides additional API frequently needed by agents in agent-based models).
  5. Draw one more transition from PotentialAdopter to Adopter state. This transition models the product purchase influenced by the acquaintance.
    Step 8. Adding adoption from word of mouth6.png
  6. Modify the properties of the transition. This transition should be taken when the statechart of the agent receives the "Buy!" message sent by its acquaintance. To make the transition message triggered, choose Message from the Triggered by drop-down list. Now set this transition to be triggered only by "Buy!" strings. For that, choose String as the Message type, set If message equals as the transition's Fire transition and type "Buy!" in the edit box below.
    Step 8. Adding adoption from word of mouth7.png

Now we should modify some properties of our agent to forward messages received by the acquaintance to its statechart.

Step 1. Creating a new model1.gif Modify the agent properties

  1. Click on the Person in the Project view to open the Person class properties and open the Agent page of the agent's Properties view.
  2. In the field On Message Received, type statechart.receiveMessage(msg);
    Now when an agent receives a message sent by another agent, it forwards it to its statechart, where the message is processed as we have defined (namely, it triggers the transition modeling the product purchase).
    Step 8. Adding adoption from word of mouth8.png

Run the model and observe the adoption process. You can see the adoption becomes faster because of word of mouth.

Step 8. Adding adoption from word of mouth9.png

You see classic S-shaped diffusion curves – the process somewhat resembles the epidemic diffusion. So far we have just reproduced the system dynamics model results!