Difference between revisions of "Dynamic and uncertainty"
m (→Resampling) |
|||
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
__TOC__ | __TOC__ | ||
− | Uncertain variables propagate uncertainty samples during dynamic simulation. If an uncertain variable is used in a dynamic simulation, its uncertainty sample is calculated only once, in the initial time period. | + | Uncertain variables propagate uncertainty samples during [[Dynamic Simulation|dynamic simulation]]. If an uncertain variable is used in a dynamic simulation, its uncertainty sample is calculated only once, in the initial time period. |
'''Example:''' The following definitions model population changes over time: | '''Example:''' The following definitions model population changes over time: | ||
− | + | :<code>Variable Population := [[Normal]](30, 2)</code> | |
− | + | :<code>Variable Birthrate := [[Normal]](1.2, .3)</code> | |
− | + | :<code>Time := 1 .. 10</code> | |
− | + | :<code>Variable Pop_by_year := [[Dynamic]](Population, [[Self]][ [[Time]] - 1] + Birthrate)</code> | |
[[File:Chapter17_14.png]] | [[File:Chapter17_14.png]] | ||
Line 18: | Line 18: | ||
==Resampling== | ==Resampling== | ||
− | If you want to create a new uncertainty sample for each time period (that is, resample for each time period), place the distribution in the last parameter of the | + | If you want to create a new uncertainty sample for each time period (that is, resample for each time period), place the distribution in the last parameter of the [[Dynamic function]]. For example, replace <code>Birthrate</code> with its [[definition]] in <code>Pop_by_year</code>: |
− | + | :<code>Pop_by_year := [[Dynamic]](Population, [[Self]][ [[Time]] - 1] + [[Normal]](1.2, .3))</code> | |
− | An alternative way to create a new uncertainty sample for each time period is to make <code>Birthrate</code> a dynamic variable: | + | An alternative way to create a new uncertainty sample for each time period is to make <code>Birthrate</code> a [[dynamic]] variable: |
− | + | :<code>Birthrate := [[Dynamic]]([[Normal]](1.2, .3), [[Normal]](1.2, .3))</code> | |
− | + | :<code>Pop_by_year := [[Dynamic]](Population, [[Self]][ [[Time]] - 1] + Birthrate)</code> | |
+ | |||
+ | An even cleaner but equivalent way is to define <code>Birthrate</code> to use an identical independent distribution (i.i.d.) ''over'' [[Time]]: | ||
+ | |||
+ | :<code>Birthrate := [[Normal]](1.2, .3, over:[[Time]])</code> | ||
==See Also== | ==See Also== | ||
− | * [[Dynamic]] | + | * [[Dynamic]] |
− | + | * [[Dynamic Simulation]] | |
+ | * The [[Multivariate_distributions#Over_indexes_as_parameters_to_probability_distributions|Over parameter]] for probability distributions. | ||
<footer>Dynamic dependencies / {{PAGENAME}} / Dynamic on non-Time Indexes</footer> | <footer>Dynamic dependencies / {{PAGENAME}} / Dynamic on non-Time Indexes</footer> |
Latest revision as of 23:22, 7 August 2017
Uncertain variables propagate uncertainty samples during dynamic simulation. If an uncertain variable is used in a dynamic simulation, its uncertainty sample is calculated only once, in the initial time period.
Example: The following definitions model population changes over time:
Variable Population := Normal(30, 2)
Variable Birthrate := Normal(1.2, .3)
Time := 1 .. 10
Variable Pop_by_year := Dynamic(Population, Self[ Time - 1] + Birthrate)
The uncertainty samples for Population
and Birthrate
are each calculated once, at the initial time period. The same samples are then used for each subsequent time period.
Resampling
If you want to create a new uncertainty sample for each time period (that is, resample for each time period), place the distribution in the last parameter of the Dynamic function. For example, replace Birthrate
with its definition in Pop_by_year
:
An alternative way to create a new uncertainty sample for each time period is to make Birthrate
a dynamic variable:
Birthrate := Dynamic(Normal(1.2, .3), Normal(1.2, .3))
Pop_by_year := Dynamic(Population, Self[ Time - 1] + Birthrate)
An even cleaner but equivalent way is to define Birthrate
to use an identical independent distribution (i.i.d.) over Time:
See Also
- Dynamic
- Dynamic Simulation
- The Over parameter for probability distributions.
Enable comment auto-refresher