-
Notifications
You must be signed in to change notification settings - Fork 1
/
des_model_walkthrough.qmd
69 lines (39 loc) · 2.55 KB
/
des_model_walkthrough.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
## Key Steps in a DES
### Arrivals
To start with, all we’re looking at is generating patients to arrive!
One great thing about DES is controlled randomness.
We can work out the average time between patients arriving at the centre - maybe every 5 minutes - but we don’t want people to just turn up at exact 5-minute intervals.
That’s not very realistic, and it doesn’t help us understand how the system copes with variation.
So we sample the gap between arrivals from a distribution.
Where the bar higher, there is a greater chance that the random number picked will be somewhere around that value.
![](images/simple_distribution.png)
::: {.callout-note}
Computers aren’t very good at being random!
So we give it a ‘seed’ to start from.
If our seed is 1, maybe the arrival times sampled from the distribution will be
5 minutes, 2 minutes, 3 minutes, 6 minutes, 5 minutes
If our seed is 101, maybe the arrival times will be
10 minutes, 2 minutes, 5 minutes, 5 minutes, 3 minutes
:::
This is great, because we can either
- Change the random number and see how the **same system** can cope with **different patterns of arrivals**
- Keep the random number the same and see how **changing the system** affects performance
#### Exercise 1
In the playground, you can drag the sliders to change the values.
Then you can click ‘run simulation’ to start a new simulation.
Take a look at the graphs that are created!
::: {.callout-info}
- Try changing the slider with the title 'How many patients should arrive per day on average?'.
Look at the graph below it.
- How do the numbers on the horizontal axis change?
- Change the average number of patients back to the default (80) and click on 'Run simulation'.
- Look at the charts that show the variation in patient arrivals per simulation run.
- Look at the scatter (dot) plots at the bottom of the page to understand how the arrival times of patients varies across different simulation runs and different days.
- Hover over the dots to see more detail about the arrival time of each patient. By 6am, roughly how many patients have arrived in each simulation run?
- Think about how this randomness in arrival times across different runs could be useful.
- Try changing the random number the computer uses without changing anything else. What happens to the number of patients? Do the bar charts and histograms look different?
:::
```{=html}
<iframe width="10780" height="700" src="https://hsma-programme.github.io/
Teaching_DES_Concepts_Streamlit/" title="Webpage example"></iframe>
```