predict.flux | R Documentation |
Use a flux
object to predict population movements
given either a RasterLayer containing a single population layer, or a
location_dataframe
object containing population and location data with the columns
location
(character), population
(numeric), x
(numeric)
and y
(numeric).
The model can be calculated either for both directions (by setting the optional parameter
symmetric = FALSE
, resulting in an asymmetric movement matrix) or for
the summed movement between the two (symmetric = TRUE
, giving a
symmetric matrix)).
## S3 method for class 'flux'
predict(object, location_dataframe, min_network_pop = 50000,
symmetric = FALSE, go_parallel = FALSE, number_of_cores = NULL, ...)
object |
A theoretical model of type |
location_dataframe |
A |
min_network_pop |
Optional parameter for the minimum population of a site in order for it to be processed |
symmetric |
Optional parameter to define whether to calculate symmetric or asymmetric (summed across both directions) movement |
go_parallel |
Flag to enable parallel calculations (if set to TRUE). Note that parallel programming will only improve the performance with larger datasets; for smaller datasets the performance will get worse due to the overhead of scheduling the tasks. |
number_of_cores |
Optional parameter to specify the number of cores used for parallel calculations. If no value is specified, the program will automatically detect the number of cores available on the machine when parallel programming is enabled. |
... |
additional arguments affecting the predictions produced. |
A list containing a location dataframe from the input with columns
location
, population
and coordinates
and a matrix
containing the predicted population movements.
# load kenya raster
data(kenya)
# aggregate to 10km to speed things up
kenya10 <- raster::aggregate(kenya, 10, sum)
# generate a flux object
flux <- radiationWithSelection()
# run the prediction for the theoretical model
predicted_movement <- predict(flux, kenya10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.