Skip to content

Commit a93880b

Browse files
committed
final cran notes
1 parent a9757d7 commit a93880b

4 files changed

Lines changed: 38 additions & 29 deletions

File tree

.Rbuildignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
^_pkgdown\.yml$
88
^docs$
99
^pkgdown$
10-
^vignettes/*_files$
10+
^vignettes
1111
^cran-comments\.md$
1212
^doc$
1313
^Meta$
14-
^revdep$
14+
^revdep$

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ Authors@R:
55
person("Ivann", "Schlosser", , "ivann.schlosser.19@ucl.ac.uk", role = c("aut", "cre"),
66
comment = c(ORCID = "0009-0004-4099-3198"))
77
Maintainer: Ivann Schlosser <ivann.schlosser.19@ucl.ac.uk>
8-
Description: Building on top of the RcppArmadillo linear
8+
Description: Building on top of the 'RcppArmadillo' linear
99
algebra functionalities to do fast spatial interaction models in the
1010
context of urban analytics, geography, transport modelling. It uses
1111
the Newton root search algorithm to determine the optimal cost
1212
exponent and can run country level models with thousands of origins
1313
and destinations. It aims at implementing an easy approach based on
1414
matrices. Currently, the simplest form of production, destination and
1515
doubly constrained models are implemented.
16-
Date: 2024-12-10
16+
Date: 2025-04-17
1717
License: MIT + file LICENSE
1818
URL: https://ischlo.github.io/cppSim/, https://github.com/ischlo/cppSim
1919
Depends:

docs/.nojekyll

Lines changed: 0 additions & 1 deletion
This file was deleted.

vignettes/getting_started_2.Rmd

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ data("london_msoa")
3535
3636
```
3737

38-
The two data sets provided consist in the flow matrix `flows_test` with cycling and walking flows combined between every MSOA in Greater London. The data was obtained from the 2011 UK census open data portal. The second matrix is a distance matrix between the centroids of every MSOAs in Greater London. It was computed using the great [`cppRouting`](https://github.com/vlarmet/cppRouting) package and OpenStreetMap networks adapted to be suitable for cycling and walking. The networks can be downloaded in a good format with the python package `OSMnx`, or with the recently published, but yet under development [`cppRnet`]() package in R
38+
The two data sets provided consist in the flow matrix `flows_test` with cycling and walking flows combined between every MSOA in Greater London. The data was obtained from the 2011 UK census open data portal. The second matrix is a distance matrix between the centroids of every MSOAs in Greater London. It was computed using the great [`cppRouting`](https://github.com/vlarmet/cppRouting) package and OpenStreetMap networks adapted to be suitable for cycling and walking. The networks can be downloaded in a good format with the python package `OSMnx`, or with the recently published, but yet under development [`cppRosm`](https://ischlo.github.io/cppRosm/) package in R
3939

4040
Let's have a look at the size of these:
4141

@@ -48,20 +48,20 @@ dim(flows_test)
4848

4949
```{r echo=FALSE, fig.show='hold', out.width="45%"}
5050
51-
par(cex=.6)
52-
plot(density(distance_test), main = 'Distribution of distances',xlab = 'OD distance (km)')
53-
plot(density(flows_test), main = 'Distribution of flows', xlab = 'flow',log="x")
51+
par(cex = .6)
52+
plot(density(distance_test), main = "Distribution of distances", xlab = "OD distance (km)")
53+
plot(density(flows_test), main = "Distribution of flows", xlab = "flow", log = "x")
5454
5555
```
5656

5757
# Visualisation
5858

5959
```{r, include=FALSE,eval=TRUE,echo=FALSE}
6060
61-
london_msoa |>
62-
sf::st_as_sf(wkt = ncol(london_msoa),crs=4326) |>
63-
sf::st_geometry() |>
64-
plot(main="London MSOAs")
61+
london_msoa |>
62+
sf::st_as_sf(wkt = ncol(london_msoa), crs = 4326) |>
63+
sf::st_geometry() |>
64+
plot(main = "London MSOAs")
6565
6666
```
6767

@@ -73,9 +73,11 @@ If the coefficient of the distance decay (cost) function is known, one can simpl
7373
7474
beta <- .1
7575
76-
res_model <- cppSim::run_model(flows = flows_test
77-
,distance = distance_test
78-
,beta = beta)
76+
res_model <- cppSim::run_model(
77+
flows = flows_test,
78+
distance = distance_test,
79+
beta = beta
80+
)
7981
8082
str(res_model)
8183
@@ -86,15 +88,18 @@ dim(res_model$values)
8688
Let's have a look at the correlation between the model output and data:
8789

8890
```{r echo=FALSE}
89-
plot(c(res_model$values)
90-
,c(flows_test)
91-
,main = 'Model vs Data')
91+
plot(c(res_model$values),
92+
c(flows_test),
93+
main = "Model vs Data"
94+
)
9295
9396
```
9497

9598
```{r}
96-
cor(c(res_model$values)
97-
,c(flows_test))
99+
cor(
100+
c(res_model$values),
101+
c(flows_test)
102+
)
98103
99104
```
100105

@@ -106,8 +111,9 @@ If you want to run a full simulation that will calibrate a model and determine t
106111

107112
```{r}
108113
109-
res_sim <- cppSim::simulation(flows_matrix = flows_test
110-
,dist_matrix = distance_test
114+
res_sim <- cppSim::simulation(
115+
flows_matrix = flows_test,
116+
dist_matrix = distance_test
111117
)
112118
113119
str(res_sim)
@@ -119,17 +125,21 @@ res_sim$best_fit_beta
119125
The output will be a list with two elements, first the output of a model run that best fits the observed data. Second, the optimal distance decay exponent that produces this result. This value will be relevant for further modelling. Let's see some of the model results:
120126

121127
```{r}
122-
plot(res_sim$best_fit_values
123-
,flows_test
124-
# ,log = 'xy'
125-
,main = 'Model vs Data')
128+
plot(res_sim$best_fit_values,
129+
flows_test
130+
# ,log = 'xy'
131+
,
132+
main = "Model vs Data"
133+
)
126134
```
127135

128136
Let's see how the model output correlates with the observed data:
129137

130138
```{r}
131-
cor(x=c(res_sim$best_fit_values)
132-
,y=c(flows_test))
139+
cor(
140+
x = c(res_sim$best_fit_values),
141+
y = c(flows_test)
142+
)
133143
134144
```
135145

0 commit comments

Comments
 (0)