Creating a model in FRED

33
How to Create a Model in the FRED system Public Health Dynamics Laboratory Pitt Public Health University of Pittsburgh Behavior Modeling Workshop October 25 2018 FRED 1

Transcript of Creating a model in FRED

How to Create a Model in the FRED system

Public Health Dynamics LaboratoryPitt Public Health

University of PittsburghBehavior Modeling Workshop

October 25 2018

FRED 1

Agent-based models (ABMs)

• Base entity is agent—person, group, animal, mosquito• Agents are given traits and initial behavior rules that

organize their actions and interactions. • Stochasticity can be included – assignment of agent characteristics – determining which agents interact– how agents obtain information and make decisions

• Model is run over time and repeated numerous times– distribution of possible outcomes for the specified system

• agents can be anything that alters its behavior in response to input from other agents and environment

Property DescriptionInteractive Agents can interact with each other or with the environment

Heterogeneous Agents can have different attributes, states, or behaviors

Dynamic Agents can change their attributes, states, or behaviors with time or location

Stochastic Agents can non-deterministically decide their attributes, states, or behaviors as determined by the model

Rational Agents can act in their best interest based on their own knowledge and preference

Adaptive Agents can change their states or behaviors based on the current state of the system

Autonomous Agents can decide their own states or behaviorsMobile Agents can move in a geographic spaceMemory Agents can remember their previous attributes, states, and behaviors

or the history of the system

Key Properties of Agent-Based ModelingAgent-based models (ABMs)

Agent-based models (ABMs)

Benefits of Agent-Based Modeling

• ABM captures emergent phenomena– Result from the interactions of individual entities– Cannot be reduced to the system's parts– Have properties that are decoupled from the properties of the part

• ABM provides a natural description of a system– Behavior of individuals cannot be clearly defined through

aggregate transition rates– Individual behavior is complex– Activities are a more natural way of describing the system than

processes– Stochasticity applies to the agents' behavior

• ABM is flexible– Can add more agents to agent-based model– Can tune complexity of agents: behavior, degree of rationality,

ability to learn and evolve, and rules of interactions– Can change levels of description and aggregation—agent,

subgroup, group

Agent-based models (ABMs)

How to construct a model• Define the question(s) of interest

– Characterize general problem and some specific features related to it

– Identify aspect of the problem to explore in depth– Generate hypotheses

• Construct an explicit conceptual model– Think about dynamic processes and feedbacks that may play

an important role• Common mistake is to try to write computational model

that addresses too many elements – All models are analogies of real systems– All models fail to represent reality completely – Good models

• Balance simplicity and adequate representation• Incorporate sufficient key elements and processes• Ignore elements that are not directly relevant

Agent-based models (ABMs)

"all models are wrong, but some are useful"

• Since all models are wrong the scientist cannot obtain a "correct" one by excessive elaboration. On the contrary following William of Occam he should seek an economical description of natural phenomena. Just as the ability to devise simple but evocative models is the signature of the great scientist so overelaboration and overparameterization is often the mark of mediocrity. George E. P. Box

• When you construct a model you leave out all the details which you, with the knowledge at your disposal, consider inessential…. Models should not be true, but it is important that they are applicable… George Rasch

Agent-based models (ABMs)

Modeling CycleFormulate

the question

Assemble hypothesis

Choose model structure

Implement model

Analyze model

Railsback and Grimm, Agent-Based and Individual-Based Modeling

Agent-based models (ABMs)

FRED Model Components• Collection of conditions, states (and their

durations) and transitions• Condition– Process to model

• States– Parts of condition

• Durations– How long agents spend in a state before evaluating

whether to move to another state• Transitions– How agents move from one state to another

Example—Infectious Disease Model

S E

Ia

Is

R

• Simple infectious disease model -- influenza• Susceptible• Exposed• Infectious symptomatic• Infectious asymptomatic• Recovered

Infectious Disease Model in FRED

• INF.states = S E Is Ia R• Condition INF• States – Susceptible, Exposed, Infectious

(symptomatic), Infectious (asymptomatic), Recovered

S E

Ia

Is

R

FRED Concepts

• In an infectious disease model, exposed means being in contact with an infection

• In FRED, Condition.exposed_state is state to enter after an exposure event– INF.exposed_state = E– Infection event is required to trigger state change S to E– INF.S.susceptibility = 1.0– S is state that allows introduction of infection– In FRED, state is dormant when state does not change– INF.R.is_dormant = 1

Infectious Disease Model in FRED

• INF.states = S E Is Ia R• Condition INF• States – Susceptible, Exposed, Infectious

(symptomatic), Infectious (asymptomatic), Recovered

• Exposed is exposed state• Recovered state is dormant

S E

Ia

Is

R

FRED Concepts

• FRED conditions have transmission mode• May be ”None” if not transmissible• Condition.transmissibility determines level of

transmissibility of condition• INF.transmission_mode = respiratory• INF.transmissibility = 1.0• INF.Is.transmissibility = 1.0• INF.Ia.transmissibility = 0.5• State level transmissibility modifies condition level

transmissibility

• Duration—When to check for new state• INF.S.duration = -1 (or 99999)• INF.E.duration_distribution = lognormal• INF.E.duration_median = 1.9• INF.E.duration_dispersion = 1.23• INF.Is.duration_distribution = lognormal• INF.Is.duration_median = 5.0• INF.Is.duration_dispersion = 1.5

FRED Concepts

• Transitions

• INF.transition[E][Is] = 0.67

• INF.transition[E][Ia] = 0.33

• INF.transition[Ia][R] = 1

• INF.transition[Is][R] = 1

• Of exposed agents, 67% will become symptomatic and 33% will become asymptomatic (but still infectious)

• All infected agents recover

FRED Concepts

• INF.states = S E Is Ia R• Condition INF• States – Susceptible, Exposed, Infectious

(symptomatic), Infectious (asymptomatic), Recovered

S E

Ia

Is

R

Seeding Event

p = 0.67

p = 0.33P = 1

P = 1

FRED Concepts

FRED Concepts• Summary• Model is made of Conditions• Conditions have states and transitions• States – Have durations– May receive an event (like infection)– May be the result of an event

• Conditions may be transmissible– Level of transmissibility at Condition and state

level, which interact17

FRED Model MATERNITY• Basic Rules• Only females become pregnant• Females below a lower age limit do not get

pregnant • Females above an upper age limit do not get

pregnant • Other females become pregnant at age-specific

annual probability • Births are distributed evenly over the year• Pregnancy has a duration of approximately 280

days and std dev 7 days

• MATERNITY.states = Start Male Female InitNotPregnant InitPregnant Screening NotPregnant Pregnant ChildBirth PostPartumPostReproductive

• Dependency– condition only makes sense if people age– enable_population_dynamics = 1

FRED Model MATERNITY

• First transition divides agents into Male and Female by gender

• Condition.State.duration = 0 means immediately re-evaluate for another transition

• MATERNITY.Start.duration = 0• MATERNITY.transition[Start][Male].is_male =1• MATERNITY.transition[Start][Female].is_female = 1

• The Male state is dormant for MATERNITY• MATERNITY.Male.is_dormant = 1

FRED Model MATERNITY

• All females less than 15 are assumed to be not pregnant at start

• MATERNITY.Female.duration = 0

• MATERNITY.transition[Female][InitNotPregnant].age_is_0-14 = 1

• All females age 50+ are consider post-reproductive

• PostReproductive is a dormant state

• MATERNITY.transition[Female][PostReproductive].age_is_50+ = 1

• MATERNITY.PostReproductive.is_dormant = 1

FRED Model MATERNITY

• All other females are assumed to be initially pregnant (InitPregnant) with 75% of the agent's age-specific annual probability of pregnancy

• MATERNITY.transition[Female][InitPregnant].age_is_15-19 = 0.016• MATERNITY.transition[Female][InitNotPregnant].age_is_15-19 = 0.984• MATERNITY.transition[Female][InitPregnant].age_is_20-24 = 0.073• MATERNITY.transition[Female][InitNotPregnant].age_is_20-24 = 0.928• MATERNITY.transition[Female][InitPregnant].age_is_25-29 = 0.075• MATERNITY.transition[Female][InitNotPregnant].age_is_25-29 = 0.925• MATERNITY.transition[Female][InitPregnant].age_is_30-34 = 0.075• MATERNITY.transition[Female][InitNotPregnant].age_is_30-34 = 0.925• MATERNITY.transition[Female][InitPregnant].age_is_35-39 = 0.045• MATERNITY.transition[Female][InitNotPregnant].age_is_35-39 = 0.955• MATERNITY.transition[Female][InitPregnant].age_is_40-44 = 0.014• MATERNITY.transition[Female][InitNotPregnant].age_is_40-44 = 0.986• MATERNITY.transition[Female][InitPregnant].age_is_45-49 = 0.000525• MATERNITY.transition[Female][InitNotPregnant].age_is_45-49 = 0.999475

FRED Model MATERNITY

• After the InitNotPregnant state, the agent changes to the Screening state

• MATERNITY.transition[InitNotPregnant][Screening] = 1• In this model, InitNotPregnant and InitPregnant are used to

space out the births in the first simulation year

FRED Model MATERNITY

• NotPregnant state has a duration of 365 day, after

which the agent has its annual Screening

• MATERNITY.NotPregnant.duration = 365

• MATERNITY.transition[NotPregnant][Screening] = 1

• Pregnancy has a duration of between 259 and 294,

drawn from a normal distribution with mean 280 days

and std dev 7 days

• MATERNITY.Pregnant.duration_distribution = normal

• MATERNITY.Pregnant.duration_mean = 280

• MATERNITY.Pregnant.duration_stdev = 7

• MATERNITY.Pregnant.duration_lower_bound = 259

• MATERNITY.Pregnant.duration_upper_bound = 294

FRED Model MATERNITY

• InitPregnant state has a duration of 1..280 days with a uniform distribution in order to spread out the initial delivery dates

• MATERNITY.InitPregnant.duration_distribution = uniform• MATERNITY.InitPregnant.duration_lower_bound = 1• MATERNITY.InitPregnant.duration_upper_bound = 280• InitPregnant state always transitions to ChildBirth• MATERNITY.transition[InitPregnant][ChildBirth] = 1• InitNotPregnant state has a duration of 1..365 days with a

uniform distribution in order to spread out subsequent pregnancies

• MATERNITY.InitNotPregnant.duration_distribution = uniform

• MATERNITY.InitNotPregnant.duration_lower_bound =1• MATERNITY.InitNotPregnant.duration_upper_bound = 365

FRED Model MATERNITY

• The Screening state branches to Pregnant, NotPregnant or PostReproductive based on the agent's age and age-specific annual probability of pregnancy

• MATERNITY.Screening.duration = 0• MATERNITY.transition[Screening][NotPregnant].age_is_0-14 = 1• MATERNITY.transition[Screening][Pregnant].age_is_15-19 = 0.0214• MATERNITY.transition[Screening][NotPregnant].age_is_15-19 =

0.9786• MATERNITY.transition[Screening][Pregnant].age_is_20-24 = 0.0791• MATERNITY.transition[Screening][NotPregnant].age_is_20-24 =

0.9209• MATERNITY.transition[Screening][Pregnant].age_is_25-29 = 0.1033• MATERNITY.transition[Screening][PostReproductive].age_is_50+ = 1

FRED Model MATERNITY

• Pregnancy always transitions to ChildBirth

• MATERNITY.transition[Pregnant][ChildBirth] = 1• ChildBirth lasts 1 day and leads to the PostPartum state• ChildBirth generates a maternity event (a new agent)• MATERNITY.ChildBirth.duration = 1• MATERNITY.transition[ChildBirth][PostPartum] = 1• MATERNITY.maternity_state = ChildBirth

FRED Model MATERNITY

• PostPartum period duration is drawn from a normal distribution with mean 30 days and a stddev of 15 days, with a lower bound of 10 days

• MATERNITY.PostPartum.duration_distribution = normal

• MATERNITY.PostPartum.duration_mean = 30• MATERNITY.PostPartum.duration_stdev = 15• MATERNITY.PostPartum.duration_lower_bound =

10

• PostPartum state transitions to the Screening state, resulting in either pregnancy or a new annual screening cycle

• MATERNITY.transition[PostPartum][Screening] = 1

FRED Model MATERNITY

FRED Model MATERNITY• Basic Rules• Only females become pregnant• Females below a lower age limit do not get

pregnant • Females above an upper age limit do not get

pregnant • Other females become pregnant at age-specific

annual probability • Births are distributed evenly over the year• Pregnancy has a duration of approximately 280

days and std dev 7 days

More FRED Features• Multiple conditions can interact, directly and

indirectly• Example– Conditions = INF VAC RISK– VAC can influence INF• VAC.Immune.multiply_susceptibility_to_INF = 0• VAC.Fail.multiply_susceptibility_to_INF = 1

– RISK can influence INF• RISK.High.probability_absent_from_Neighborhood = 1

30

More FRED Features

• Many risk factors are available to use in transitions

– Tutorial on website has comprehensive list

• FRED native actions

– Births and deaths

– Interactions (work, school, neighborhood, home)

• Can query for characteristics to use in transitions

– Demographics, household size, income, etc

• Can use state in one condition to influence transition in

different condition

– COND.transition[STATE][STATE].currently in state

COND.STATE

31

Summary• Project Narrative• Define model

– Conditions– States – Durations – how long before move to next state– Intermediate states can be used to allow partitioning of

population– Dormant states are not reevaluated– Transitions between states– Transitions can be automatic based on duration or may wait for

an event like infection– Can have multiple conditions– Interacting conditions

• Transitions can use states from other conditions as modifiers32

• Questions??

33