-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
58 lines (46 loc) · 1.09 KB
/
README.Rmd
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# citymodes
The goal of citymodes is to show how to represent how mode split varies with distance and other variables across different settlements.
## Univariate
```{r}
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))
txtplot::txtplot(d, scen_dutch, ylim = c(0, 1))
```
## Multinomial data
Generate fake data on 3 modes.
```{r}
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)
txtplot::txtplot(d, b)
txtplot::txtplot(d, a)
```
## Individual level data
```{r}
# m = d
# for(i in seq_along(d)) {
# m[i] = sample(x = 1:3, size = length(d), replace = TRUE, prob = c(a))
# }
```