generated from byu-transpolab/template_bookdown
-
Notifications
You must be signed in to change notification settings - Fork 0
/
03-method.Rmd
112 lines (91 loc) · 3.4 KB
/
03-method.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Methods
```{r setup, include = FALSE}
# load R libraries here; the `include` flag in the chunk options above tells
# whether to print the results or not. Usually you don't want to print the
# library statements, or any code on the pdf.
# Main Packages ========
# I use these in every doc
library(tidyverse)
library(knitr)
library(kableExtra)
library(modelsummary)
library(DiagrammeR)
options(dplyr.summarise.inform = FALSE)
# Other packages ------
# These sometimes get used, and sometimes don't.
library(mlogit)
# Instructions and options =========
# prints missing data in tables as blank space
options(knitr.kable.NA = '')
# tells kableExtra to not load latex table packages in the chunk output
options(kableExtra.latex.load_packages = FALSE)
# round and format numbers that get printed in the text of the article.
inline_hook <- function(x) {
if (is.numeric(x)) {
format(x, digits = 3, big.mark = ",")
} else x
}
knitr::knit_hooks$set(inline = inline_hook)
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
# options for latex-only output
if(knitr::is_latex_output()) {
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
}
```
In this chapter, you describe the approach you have taken on the problem. This
usually involves a discussion about both the data you used and the models you
applied.
## Data
```{r pipeline}
grViz(diagram = "
digraph boxes_and_circles {
# a 'graph' statement
graph [overlap = true, fontsize = 10]
# several 'node' statements
node [shape = box,
fontname = Helvetica]
'Multimodal Network'; Pavement; Rides; 'Attributed Network';
'Elevation Data'; 'Chosen Path';
'Alternate Path 1';
'Alternate Path 2';
'Alternate Path 3';
'Estimation Data';
node [shape = circle,
color = blue,
fixedsize = true,
width = 0.9] // sets as circles
R5; FMM;
# several 'edge' statements
'Multimodal Network' -> 'Attributed Network'
'Pavement' -> 'Attributed Network'
'Attributed Network' -> R5
'Attributed Network' -> FMM
'Elevation Data' -> R5
FMM -> 'Chosen Path' [color = blue]
Rides -> FMM [color = blue]
R5 -> 'Alternate Path 1' [color = red]
R5 -> 'Alternate Path 2' [color = green]
R5 -> 'Alternate Path 3' [color = teal]
'Chosen Path' -> 'Estimation Data' [color = blue]
'Alternate Path 1' -> 'Estimation Data' [color = red]
'Alternate Path 2' -> 'Estimation Data' [color = green]
'Alternate Path 3' -> 'Estimation Data' [color = teal]
}
")
```
## Models
If your work is mostly a new model, you probably will have introduced some
details in the literature review. But this is where you describe the
mathematical construction of your model, the variables it uses, and other
things. Some methods are so common (linear regression) that it is unnecessary to
explore them in detail. But others will need to be described, often with
mathematics. For example, the probability of a multinomial logit model is
\begin{equation}
P_i(X_{in}) = \frac{e^{X_{in}\beta_i}}{\sum_{j \in J}e^{X_{jn}\beta_j}}
(\#eq:mnl)
\end{equation}
Use [LaTeX mathematics](https://www.overleaf.com/learn/latex/mathematical_expressions).
You'll want to number display equations so that you can
refer to them later in the manuscript. Other simpler math can be described inline,
like saying that $i, j \in J$. Details on using equations in bookdown are available
[here](https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html).