{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Illustration of Poisson and Exponential processes.",
"config": {
"axis": {
"labelFontSize": 12,
"titleFontSize": 14,
"titleFont": "Arial",
"labelFont": "Arial"
}
},
"hconcat": [
{
"title": {
"text": "Poisson Process (λ = 4)",
"fontSize": 14,
"font": "Arial"
},
"width": 250,
"height": 250,
"data": {
"sequence": {
"start": 0,
"stop": 10,
"step": 0.1,
"as": "t"
}
},
"transform": [
{
"calculate": "floor(random() * 10000)",
"as": "seed_value"
},
{
"calculate": "if(random() < 4 * 0.1, 1, 0)",
"as": "event_occurrence"
},
{
"window": [
{
"op": "sum",
"field": "event_occurrence",
"as": "cumulative_events"
}
],
"frame": [
null,
0
]
}
],
"mark": {
"type": "line",
"point": true,
"color": "#004976"
},
"encoding": {
"x": {
"field": "t",
"type": "quantitative",
"title": "Time"
},
"y": {
"field": "cumulative_events",
"type": "quantitative",
"title": "Cumulative Events"
}
}
},
{
"title": {
"text": "Exponential Inter-Arrival Times (λ = 4)",
"fontSize": 14,
"font": "Arial"
},
"width": 250,
"height": 250,
"data": {
"sequence": {
"start": 0,
"stop": 10,
"step": 0.1,
"as": "t"
}
},
"transform": [
{
"calculate": "-log(random()) / 4",
"as": "inter_arrival_time"
},
{
"window": [
{
"op": "sum",
"field": "inter_arrival_time",
"as": "cumulative_time"
}
],
"frame": [
null,
0
]
}
],
"mark": {
"type": "line",
"point": true,
"color": "#E47A2E"
},
"encoding": {
"x": {
"field": "cumulative_time",
"type": "quantitative",
"title": "Cumulative Time"
},
"y": {
"field": "inter_arrival_time",
"type": "quantitative",
"title": "Inter-Arrival Time"
}
}
}
]
}