The goal of citymodes is to show how to represent how mode split varies with distance and other variables across different settlements.
d = seq(0.2, 20, by = 0.2)
a = -3.894
b1 = -0.5872
b2 = 1.832
b3 = 0.007956
logit_pcycle = a + (b1 * d) + (b2 * sqrt(d) ) + (b3 * d^2)
scen_baseline = boot::inv.logit(logit_pcycle)
scen_dutch = boot::inv.logit(logit_pcycle + 2.499 -0.07384 * d)
txtplot::txtplot(d, scen_baseline, ylim = c(0, 1))
#> 1 +-+------------+-----------+------------+-----------+--+
#> | |
#> | |
#> 0.8 + +
#> | |
#> 0.6 + +
#> | |
#> | |
#> 0.4 + +
#> | |
#> 0.2 + +
#> | |
#> | *************************** |
#> 0 +-+------------+-----------+*************************--+
#> 0 5 10 15 20
txtplot::txtplot(d, scen_dutch, ylim = c(0, 1))
#> 1 +-+------------+-----------+------------+-----------+--+
#> | |
#> | |
#> 0.8 + +
#> | |
#> 0.6 + +
#> | |
#> | ********** |
#> 0.4 + ** ***** +
#> | * ***** |
#> 0.2 + ***** +
#> | ******* |
#> | ****************** |
#> 0 +-+------------+-----------+------------+-----------*--+
#> 0 5 10 15 20
Generate fake data on 3 modes.
w = a = b = rep(1, length(d))
b = scen_dutch
a = 1 - b
w[d < 2] = 1
w[d >= 2] = 0
a[d < 2] = 0
b[d < 2] = 0
txtplot::txtplot(d, w)
#> +-+------------+-----------+------------+-----------+--+
#> 1 + ****** +
#> | |
#> 0.8 + +
#> | |
#> 0.6 + +
#> | |
#> | |
#> 0.4 + +
#> | |
#> 0.2 + +
#> | |
#> 0 + ********************************************** +
#> +-+------------+-----------+------------+-----------+--+
#> 0 5 10 15 20
txtplot::txtplot(d, b)
#> 0.5 +-+------------+-----------+------------+-----------+--+
#> | ****** |
#> | *** |
#> 0.4 + *** +
#> | *** |
#> 0.3 + ** +
#> | *** |
#> 0.2 + **** +
#> | **** |
#> | **** |
#> 0.1 + ****** +
#> | ************ |
#> 0 + ****** +
#> +-+------------+-----------+------------+-----------+--+
#> 0 5 10 15 20
txtplot::txtplot(d, a)
#> 1 +-+------------+-----------+------------+-----------+--+
#> | ***************** |
#> | ******** |
#> 0.8 + ****** +
#> | ***** |
#> 0.6 + ***** +
#> | ****** |
#> | |
#> 0.4 + +
#> | |
#> 0.2 + +
#> | |
#> 0 + ****** +
#> +-+------------+-----------+------------+-----------+--+
#> 0 5 10 15 20
# m = d
# for(i in seq_along(d)) {
# m[i] = sample(x = 1:3, size = length(d), replace = TRUE, prob = c(a))
# }