Getting Started

Once you have FRED Local installed and have verified the installation as described in previous sections, you are ready to use FRED to build models and run your own simulations.

This section presents some suggestions for using FRED Local, whether you are running the Docker image or the local installation. We also provide some suggestions for updating the simpleflu model to become more familiar with the FRED Modeling Language™.

Note

If you are running FRED Local in Docker, please see the instructions on running FRED models using direct shell access.

Epistemix Tutorial Models

The other tutorial models downloaded in the installation instructions as part of the FRED-tutorials repository provide a good overview of some key features of FRED. We recommend reading through the tutorials documentation found at the FRED Language Tutorials link and running one or more simulations for each of the models.

Each model has a METHODS script, just list simpleflu, so you can run this script directly. A more instructive approach might be to execute the FRED SIMS commands directly as we show in the prior example. The FRED SIMS documentation includes reference pages for each command, if you wish to explore these commands further.

Learning FRED programming

It is beneficial to modify the simpleflu and other tutorial programs as a way to experience the keywords and syntax of FRED programs. In the simpleflu model directory, for example, here are some changes you could make after reading through the other tutorials. Copy the code to a new directory and run your model after each suggestion to see the impact on the results.

Suggested simpleflu Changes for Practice

  1. Modify the locations setting in the main.fred file to use your local county. Note that if your county population is more than a few hundred thousand, you may need to increase the memory for your docker container. You can do this in the Preferences settings in Docker Desktop, under the Resources options. For the simpleflu model, we would recommend 8 GB of memory per 1 million residents of an area. FRED does use a lot of memory, and if the memory available is exceeded, then the program will be killed by the operating system.

  2. Add a variables.fred file to define a symptomatic_transmissibility variable set to 1.0, and replace the INFLUENZA.trans assignments to use this variable in both the InfectiousSymptomatic and InfectiousAsymptomatic states. Don’t forget to include the new variables.fred file in your main.fred file.

  3. Add a parameters.fred file to the program that overrides the value of symptomatic_transmissibility to be 0.75. Generate the weekly.pdf plots for both transmissibility values to compare when the peak number of exposures occurs within the population.

  4. Modify the INFLUENZA state so that an agent has a 5% chance of dying when they are symptomatic and a 1% chance of dying when they are asymptomatic. You will need to use the die() action for this scenario, which causes an agent to die.

Create a New Model

At some point you will want to create your own models with FRED. We recommend reading through the available documentation before attempting this, of course. You should also consider creating a state diagram of your conditions as a way to think through the behavior and transitions for the agents in your model. FRED’s declarative programming style lends itself to such diagrams, and the modelers at Epistemix often use them.

As an example, here is a state transition diagram of the INFLUENZA condition in the simple flu model, in a form you might create before writing the condition.

simpleflu state transition diagram

A state transition diagram for the simple flu INFLUENZA condition.

As an alternative, here is a diagram generated from the simpleflu code directly. This has the advantage of showing the states and FRED code used in the program.

simpleflu state transition diagram with embedded code

A generated state transition diagram for the INFLUENZA condition. This shows the actual state names used in the FRED program, and the code for each state. Note that the implicit transition from Susceptible to Exposed is not reflected here.

Getting Help

If you need assistance or have questions about using FRED Local or the FRED Modeling Language, contact our Customer Service team at support@epistemix.com.