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.
- Open the Main class diagram.
- Drag the Environment element from the General page of the Palette view onto the diagram of class Main.
- 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.
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.
- Open the Person class diagram.
- Add new parameter ContactRate.
- Assume a contact rate of 100 per person per year. In the Default Value, type 100.
- Add one more parameter.
- Name it AdoptionFraction.
- Set the default value to 0.015.
- Open the Person class diagram by double-clicking the Person item in the Project view.
- Add an internal transition to the Adopter state. Drag the Transition 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:
- 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:
- Specify the Action for the transition:
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).
- Draw one more transition from PotentialAdopter to Adopter state. This transition models the product purchase influenced by the acquaintance.
- 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.
Now we should modify some properties of our agent to forward messages received by the acquaintance to its statechart.
- 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.
- In the field On Message Received, type
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).
Run the model and observe the adoption process. You can see the adoption becomes faster because of word of mouth.
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!