Lecture 02 - Types of Modelsx - Home | CISB-ECN

Download Report

Transcript Lecture 02 - Types of Modelsx - Home | CISB-ECN

BMED 3520
Types of Models
Book Chapters
1 and 2
Recall: Generic Approach of CSB
www.alternative-cancer.net/
science.nationalgeographic.com
dX 12
f
f
f
f
f
f
  0,12 X 240 ,12, 24 X 300 ,12, 30   51,12 X 1251,12,12 X 2851,12, 28 X 5151,12,51 X 5251,12,52
dt
  4,17 X 4 4 ,17, 4 X 2241,17, 22   6,17 X 6 6 ,17, 6 X 226 ,17, 22
f
f
f
f
%ODEs
X12' = gam0_12 X24^f0_12_24 + gam51_12 X12^f51_12_12 >>
>> * X28^f51_12_28 X51^f51_12_51 X52^f51_12_52 >>
>> + gam4_17 X4^f4_17_4 X22^f41_17_22 >>
>> + gam6_17 Xf6_17_6 X22^f6_17_22
&& X22 X30 X51 X52
!! X12
e. o. voit
Recall: Generic Approach of CSB
www.alternative-cancer.net/
science.nationalgeographic.com
dX 12
f
f
f
f
f
f
  0,12 X 240 ,12, 24 X 300 ,12, 30   51,12 X 1251,12,12 X 2851,12, 28 X 5151,12,51 X 5251,12,52
dt
  4,17 X 4 4 ,17, 4 X 2241,17, 22   6,17 X 6 6 ,17, 6 X 226 ,17, 22
f
f
f
f
%ODEs
X12' = gam0_12 X24^f0_12_24 + gam51_12 X12^f51_12_12 >>
>> * X28^f51_12_28 X51^f51_12_51 X52^f51_12_52 >>
>> + gam4_17 X4^f4_17_4 X22^f41_17_22 >>
>> + gam6_17 Xf6_17_6 X22^f6_17_22
&& X22 X30 X51 X52
!! X12
e. o. voit
What is a Model?
Models are not necessarily mathematical
Conceptual
Which way is it again to the Walmart Store?
Physical
Toy cars and trains
Barbies and Bratz
Maps and blueprints
Representation of chemicals (benzene ring)
Mathematical models
4
Generic Features of Models
Example: Google Maps
Mathematical Model
Questions we want to ask
Scale and features displayed
5
Generic Features of Models
Key ingredients:
Simplification
Abstraction
Omission of details
Structure depends on questions asked (and data availability)
Models not unique
Quality of a model:
Not complexity
Not fancy math
But: How well does it answer important questions?
6
Example of a Bad Model
7
Math Models in Biology
Static models
Example: Volume of E. coli
 y
V ( x, y , z )  x     
2
x
 
4
Is this a true description?
2
4 y y z 
 2     
3 2 2 2
z
2



y
3 
8
What does a Model like that do for us?
 y
V ( x, y , z )  x     
2
2
4 y y z   x z 
 2             y2
3 2 2 2 4 3
Volume difficult to measure; length and diameter much easier
Assess whether fatter or longer bacteria have more volume
Study growth (how much does length have to increase to double volume)?
Could use this model to study movement in fluids
9
Dynamic Models
“Dynamic”: Capture changes in “state” of a system over time
A dynamic E. coli volume model: V(x,y,z)
V(x(t), y(t), z(t))
Often written as
(1) ODE (continuous time)
Change in V over time = some function of V, x, y, z, at time t
dV/dt = f(V(t), x(t), y(t), z(t))
(2) Recursive (discrete time)
V at current time point t+1 = some function of V, x, y, z at previous time point t
V(t+1) = f(V(t), x(t), y(t), z(t))
Note: Here, t only considered at discrete time points (e.g., 0, 20, 40, 60, …);
What happens at t = 22.6 is not accounted for.
Deterministic Models
ODE and recursive models are deterministic models:
All variables, interactions, responses and time are implicitly
or explicitly embedded in the equation and its initial condition
Solve the equation twice, obtain the same result
11
Non-deterministic Models
Stochastic processes
Phenomena changing over time and containing random component(s)
A mathematical representation of such a phenomenon
~ Probabilistic model of a dynamic process
Example:
Draw cards from a deck repeatedly (with or without replacement)
T = {discrete time points}; t  T
At each t an observation is made on the random variable X(t) (e.g., X(5) =
Ace)
Then, {X(t): t  T} is a random process or stochastic process
12
Deterministic vs Stochastic
Deterministic Model:
Solve the equation twice, obtain the same result
Stochastic Model:
Every “run” is different (probability of two identical runs very low)
Sidebar:
Is anything truly stochastic?
Does stochasticity depend on the observer or degree of knowledge?
Examples:
Random number generator
The unfortunate flower pot accident
13
Stochastic Models
Applications:
Simulation of (all possible) scenarios
Best, worst, most likely outcomes; outcomes within certain ranges
Make statements about general, average, or collective behavior; trends
Mean and variance, e.g., with respect to time
(How long does it take before some goal is met?)
X(t)
time t
14
Paradigm Example
Binomial (Bernoulli) Process
Bernoullis: Swiss-Dutch family of mathematicians (over three centuries)
Stochastic processes: Daniel Bernoulli (1700 – 1782)
Sequence of “trials” leading to “success” or “failure”
Flipping coin; checking for faulty items; mutations within DNA sequence
Trials independent of each other; no learning (what does that mean?)
Number of trials:
Number of successes:
Success probability per trial:
n
k
p
Probability of having exactly k successes:
P (k; n, p) 
n!
p k (1  p)n k
k! (n  k )!
15
Paradigm Example
n!
P (k; n, p) 
p k (1  p)n k
k! (n  k )!
Examples:
Suppose: Mutation rate per DNA base is 0.0035
What is probability of finding exactly one mutation in a stretch of 10 bases?
P (1;10,0.0035) 
10!
0.00351 (1  0.0035)9  0.0339
1! 9!
What is probability of finding exactly two mutations in a stretch of 10 bases?
P ( 2;10,0.0035) 
10!
0.00352 (1  0.0035)8  0.000537
2! 8!
16
Similar Idea
Poisson Process
If the expected number of occurrences in a given interval is , then the
probability that there are exactly k occurrences (k = 0, 1, 2, ...) is equal to
e   k
P (k;  ) 
k!
Example from before:
Suppose: Mutation rate per DNA base is 0.0035
What is probability of finding exactly one mutation in a stretch of 10 bases?
Bernoulli:
P = 0.0339
(P (k; n, p) 
n!
p k (1  p)n k)
k! (n  k )!
For large number of trials, and / or small rates, Bernoulli has problems, but
is well approximated by Poisson:
Poisson: “rate” with respect to 10 nucleotides is 0.035 (no n in formula)
P(1; 0.035) = exp(-0.035)  0.035 / 1 = 0.9656  0.035  0.0338
17
Frequent Stochastic Process
Random Walk (Gambling Model; sounds silly, but has many applications)
Play game; at every discrete instance: win or lose
Game: win $1, lose $1; probability of winning or losing is p or q = 1-p, respectively
Fair game: p = q = 0.5
Formulate as SP
p
p
i-1
q
q
p
i
p
i+1
q
q
“transient”
0
1
p
q
“absorbing”
N
1
18
Coarse Classification of Models
Deterministic
Stochastic
Continuous
ODEs
Stochastic
Diff. Eqs.
Discrete
Recursive models
SPs
19
Blue Sky Catastrophe
Single nonlinear second-order ordinary differential equation
x
b
2
0
-2
125
250
375
500
time
Stochastic or Deterministic?
20
Other Dichotomies
Linear vs. nonlinear
Spatially distributed vs. spatially homogeneous (PDE vs. ODE)
Open vs. closed
Correlative (black box) vs. explanatory (mechanistic)
X5
y
X3
X1
X2
X4
x
X6
21
Choice of a Model Type
Should be guided by the following:
Scope of the model, including goals, objectives, and possible applications
Data availability or need (types, quantity, quality)
Other available information
(non-quantitative heuristics, qualitative input from experts)
Expected feasibility of the model
Relevance and degree of interest within the scientific community
22
Generic
Modeling
Process
Goals,
Inputs,
and Initial
Exploration
Model
Selection
Model
Design
Model
Analysis
and
Diagnosis
Scope, Goals, Objective
Data, Information
Prior Knowledge
Type of Model
Variables, Interactions
Equations, Parameter Values
Consistency, Robustness
Validation of Dynamics
Exploration of Possible Behaviors
Model
Use and
Applications
Hypothesis Testing, Simulation,
Discovery, Explanation
Manipulation and Optimization
Components of a System / Model
Variables
Dependent
Independent
Time
Processes
Flow of material
Flow of information
A gift to you:
(page 31 bottom)
of components consists of
processes and interactions,
which in some fashion involve
Parameters
Constants (, e, Avogadro’s number,…)
Usually taken for granted and ignored
24
Variables
Dependent:
Quantities of prime interest in the model
May change over time
Typically affected by the action of the systems
Independent:
Quantities in the model that are constant
or under control of the experimenter
Not affected by the action of the systems
Time is independent variable.
25
Distinguish Two Types of Processes
Flow of material
Start and end at a variable
or enter from --or leave toward-- outside the system
Conservation of mass
Flow of information (signal)
Start at a variable and end at a process
No conservation of anything
X 06
X1
X2
X3
X5
X6
X4
26
Parameters
Quantities in the model that do not change during an experiment
May change from one experiment to the next
Are assigned numerical values
Connect model to reality
Model structure: totality of all the model can possibly do
Parameter values: characterize one model implementation
Example:
dX / dt = a X – b X2
27
Parameter Estimation
Find numerical values for (all) parameters so that the model “fits”
some data
Arguably the most difficult aspect of modeling
Separate class later in semester
Example: Hill model:
v( S )  Vmax S 4 /( K M4  S 4 )
v(S)
v(S)
Vmax
12
6
12
6
S
10
KM
20
30
40
S
10
20
30
40
SIRS: A Model System
Remember PBL 1300?
Spread of an infectious disease
1. Processes
Birth
Infection
Death
Immunity
Loss of immunity (susceptibility)
2. Variables
S, I, R
all dependent
no independent variables
29
SIRS: A Model System
Design a diagram
vBirth
vInfection
S
vDeath
I
vImmunity
vSusceptibility
R
30
SIRS: A Model System
Decide on a model structure
Interested in numbers (e.g., I at time t), no geographic spread
Interested in populations, not individuals
Population large enough to ignore random effects
Goal: Find ways of manipulating the epidemic; optimize
ODE model
31
SIRS: A Model System
ODE model
What kinds of functions?
A priori no guidelines
Actual processes very complicated and unknown
What have others done?
Kermack and McKendrick used mass action model,
developed for chemical reactions!
32
SIRS: A Model System
Rationale for mass action model:
Random movement of many molecules; study interactions
Rate of interactions between populations (chemical species,
animals, people) is proportional to their numbers
Rate of interaction between X and Y: k X Y
k is a parameter
Let’s start with this mass action model, although we know that
justification somewhat shaky
Model performance and structure are ideally validated (or refuted)
with actual data
33
SIRS: A Model System
vBirth
vInfection
S
vDeath
I
vImmunity
vSusceptibility
R
S  rB  rS  R  rI  S  I
I  rI  S  I  rR  I  rD  I
R  rR  I  rS  R
34
SIRS: A Model System
Need initial values to get the ODEs started
S(t0) = S0
I(t0) = I0
R(t0) = R0
Also need values for parameters,
S  3  0.01  R  0.0005  S  I
I  0.0005  S  I  0.05  I  0.02  I
R  0.05  I  0.01  R
S0 = 990
I0 = 10
R0 = 0
35
SIRS: A Model System (PLAS)
S' = rB + rS R - rI S I
I' = rI S I - rR I - rD I
R' = rR I - rS R
S
S = 990
I = 10
R=0
rB = 3
rS = .01
rI = 0.0005
rR = 0.05
rD = 0.02
t0 = 0
tf = 100
hr = 0.1
!! S, I, R
I
R
1000
500
0
0
50
100
36
Model Assessment
Diagnostics
Internal consistency
Does material get lost? Generated?
Does diagram make sense?
Does the system have a steady state?
Responses to perturbations
Stability
Sensitivities w.r.t. to perturbations
Analysis
Testing of hypotheses
Scenario simulations
Parameter sweeps
Monte Carlo simulations
Model extensions and refinements
37
Monte Carlo Simulations in PLAS
Negative exponential process; randomize the rate constant
X‘ = - k X/10 + bolus
// k will be a (uniformly chosen) random number between 0 and the argument of rand
k = rand[2.5]
X=1
bolus = 0
@ 20 bolus = 1.2
@ 30 bolus = 0
t0 = 0
tf = 40
hr = (tf-t0)/200
// we want to report values for both the variable and the constant
!! X k
38
Monte Carlo Simulations in PLAS
count = 1
// scripts start with the word "script"
script
//write a header
write "k at 10", "k at 25", "k at last", "X at 5", "final X"
// loops are between "setting" and "next"
setting count = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12,13,14,15,16,17,18,19,20
//"run" computes a solution. Solutions are superimposed.
run
// the syntax of "write" is straightforward
write k@10, k@25, k@last, X@5, X@last
next
end script
39
Monte Carlo Simulations in PLAS
Result different every time PLAS is run
20
1:X
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0.009918516 0.009918516 0.009918516 0.995053
12.78393
1:k
2
3
4
5
0.8378857
0.8378857
0.8378857
0.6577422
3.550455
6
7
8
9
10
0.08316294
0.08316294
0.08316294
0.9592704
11.31275
11
12
13
14
15
16
17
18
19
20
0.8893094
0.8893094
0.8893094
0.641046
3.294892
0.5430006
0.5430006
0.5430006
0.762236
5.493809
1.342433
1.342433
1.342433
0.5110867
1.7297
0.4894406
0.4894406
0.4894406
0.7829244
5.95773
1.750847
1.750847
1.750847
0.4166851
0.9843036
2.374798
2.374798
2.374798
0.3050144
0.4264441
0.6869716
0.6869716
0.6869716
0.7092943
4.430892
1.110721
1.110721
1.110721
0.5738656
2.39799
0.272454
0.272454
0.272454
0.8726453
8.335294
1.745582
1.745582
1.745582
0.4177833
0.9913954
1.410871
1.410871
1.410871
0.4938936
1.572183
0.1037629
0.1037629
0.1037629
0.9494404
10.93529
0.4129154
0.4129154
0.4129154
0.8134616
6.697109
2.038713
2.038713
2.038713
0.3608281
0.6668583
1.713843
1.713843
1.713843
0.4244662
1.035295
1.910993
1.910993
1.910993
0.3846216
0.7920024
10
0
0
20
40
k at 10
k at 25
k at last
X at 5
final X
0.02639851
0.02639851
0.02639851
0.9868874
12.43422
Summary
o
Art of modeling consists of selecting a well suited model;
computational techniques more or less straightforward
o
Many different, correct models possible
o
Choice depends on questions asked, data availability, goals, applications
o
A correct diagram is a huge step forward
o
important to distinguish types of processes
o
Translation of diagram into equations requires choices (experience; art)
o
Generic strategy:
o diagnostics (plus possible refinements)
o analysis and application