Skip to main content
Jump to: navigation, search

STEM Model Creator/Tutorials

< STEM Model Creator
Revision as of 12:21, 21 June 2013 by (Talk | contribs) (Add New Model Parameter)


Create a SEIR model by extending SIR

This tutorial shows how to create a new SEIR Disease Model by extending the existing SIR Disease Model. STEM already has a built-in SEIR model, so this tutorial is more a simple how-to.

Create Model Project and Initial Disease Model

  1. Launch the STEM application
  2. Open the Designer perspective
  3. From the New menu, select Model Generator Project
    STEM ModelCreator NewModelGeneratorProject.png
  4. Choose Create and configure a new STEM Model Package
  5. Click Next
  6. On the Model Package page, enter the following values:
    • Package Name: Demo
    • Package Prefix: com.example.diseasemodels
  7. Click Add Model to add the disease model
  8. On the Model Properties page, enter these values:
    • Model Name: MySEIR
    • Model Type: Disease Model
    • Parent Model: Select SIR from the list
    [ Model Properties image]
  9. Click Finish
  10. At this point, your package properties should look like this:
    package properties image
  11. Click Finish to run the Model Generator and create your model project
    This step may take 1-2 minutes to complete
  12. After the Model Generator finishes, the Visual Editor should automatically open
    Initial layout picture

Add New Compartment

Now that your model project is created, it's time to add new parameters and compartments. First, lets create a new compartment.

We're creating an S-E-I-R model, which is made up of compartments S, E, I, and R. Since we extended the built-in S-I-R model, we need to add a new E compartment.

  1. In the Visual Editor, click the Add Compartment button.
    Add Compartment Button
  2. In the Add Compartment dialog, enter the following values
    • Name: e (make sure this is lower case)
    • Compartment Type: Standard
    • Data Type: double
  3. Click Finish
  4. A new e box now appears in the diagram.
  5. You may want to rearrange the shapes so that the S, E, I, and R boxes are in order (easier when connecting the compartments)
    To rearrange, select a compartment and drag it to a new location.
    [ layout picture ]

That's it. You've added a new compartment to your model. This is now a S-E-I-R model.

Add New Model Parameter

In addition to inheriting compartments from the parent SIR model, the new model also inherits the model (or rate) parameters from SIR. Inherited parameters include Transmission Rate (transmissionRate), Recovery Rate (recoveryRate), Immunity Loss Rate, etc.

We already added the new Exposed state to the disease model. In the textbook SEIR example, the movement from the E to I compartments is called the Incubation Rate. The next step is to add the incubationRate model parameter to the MySEIR model.

  1. In the Visual Editor, click the Edit Model button.
    [ Edit Model Button ]
  2. In the Edit Model dialog, click the Add Parameter button
  3. In the Edit Parameter dialog, enter the following values:
    • Name: incubationRate
    • Display Name: Incubation Rate
    • Data Type: double
    Default Value: 0.0
    Optionally, add a minimum constraint of 0.0 and maximum constraint of 1.0
  4. Click OK to add the parameter
  5. Click OK again to apply the changes
  6. Save the Visual Editor file

Create Transitions and Expressions

Create Disease and Add to Scenario

Run in STEM

Add seasonal modulation to the SEIR model

Back to the top