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™.
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
simpleflu Changes for Practice
locationssetting 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
simpleflumodel, 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.
Add a variables.fred file to define a
symptomatic_transmissibilityvariable set to
1.0, and replace the
INFLUENZA.transassignments to use this variable in both the
InfectiousAsymptomaticstates. Don’t forget to include the new variables.fred file in your main.fred file.
Add a parameters.fred file to the program that overrides the value of
0.75. Generate the weekly.pdf plots for both transmissibility values to compare when the peak number of exposures occurs within the population.
INFLUENZAstate 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
condition in the simple flu model, in a form you might create before writing
As an alternative, here is a diagram generated from the
directly. This has the advantage of showing the states and FRED code used in