-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
67 lines (46 loc) · 2.11 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
58
59
60
61
62
63
64
65
66
67
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# traveltimeHMM
`traveltimeHMM` package implements a Hidden Markov Model (HMM) with a random trip effect to estimate the distribution of travel time. The HMM is used to capture dependency on hidden congestion states. The trip effect is used to capture dependency on driver behaviour. Variations of those two types of dependencies leads to four models to estimate the distribution of travel time. Prediction methods for each model is provided.
[Package website](https://melmasri.github.io/traveltimeHMM/)
## Installation
The package is still under development in the Beta stage.
Install from [GitHub](https://github.com/melmasri/traveltimeHMM) with:
```{r eval=FALSE}
# install.packages("devtools")
devtools::install_github("melmasri/traveltimeHMM")
```
## Example
This package includes a small data set (`tripset`) that aggregates map-matched anonymized mobile phone GPS data collected in Quebec city in 2014 using the Mon Trajet smartphone application developed by [Brisk Synergies Inc](https://brisksynergies.com/). The precise duration of the time period is kept confidential.
View the data with:
```{r}
library(traveltimeHMM)
data(tripset)
head(tripset)
```
To fit a simple `HMM` model use the following code
```{r eval=FALSE}
fit <- traveltimeHMM(data = tripset,nQ = 2,max.it = 20, model = "HMM")
```
Predict for a single trip with:
```{r eval=FALSE}
single_trip <- subset(tripset, tripID==2700)
pred <- predict(object = fit,
tripdata = single_trip,
starttime = single_trip$time[1],
n = 1000)
hist(pred, freq = FALSE)
```
## Bugs
This is a work in progress. For bugs and features, please refer to [here](https://github.com/melmasri/traveltimeHMM/issues).
## References
Woodard, D., Nogin, G., Koch, P., Racz, D., Goldszmidt, M., Horvitz, E., 2017. "Predicting travel time reliability using mobile phone GPS data". *Transportation Research Part C*, 75, 30-44. <http://dx.doi.org/10.1016/j.trc.2016.10.011>