predict.flux: Predict from theoretical flux object

View source: R/movement.R

predict.fluxR Documentation

Predict from theoretical flux object

Description

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)).

Usage

## S3 method for class 'flux'
predict(object, location_dataframe, min_network_pop = 50000,
  symmetric = FALSE, go_parallel = FALSE, number_of_cores = NULL, ...)

Arguments

object

A theoretical model of type flux object

location_dataframe

A location_dataframe object or RasterLayer containing population data

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.

Value

A list containing a location dataframe from the input with columns location, population and coordinates and a matrix containing the predicted population movements.

Examples

# 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)

SEEG-Oxford/movement documentation built on April 17, 2023, 4:17 p.m.