Create a spatial interaction models data frame from a collection of interaction models
Source:R/sim_df.R
sim_df.RdThis function build a data frame from a collection of spatial interaction
models. The data frame has a list column sim of type sim_list which
stores the collection of models and classical columns that contain
characteristics of the models. The name of the list column can be set to
something else than sim (but not a name used by other default columns). See
details for the default columns.
Value
a data frame representation of the spatial interaction model
collection with classes sim_df and data.frame
Details
The data frame has one row per spatial interaction model and the following columns:
sim(default name): the last column that contains the modelsalpha: the return to scale parameter used to build the modelbeta: the cost inverse scale parameter used to build the modeldiversity: model defaultdiversity()(Shannon's diversity)iterations: the number of iterations used to produce the model (1 for a static model)converged:TRUEis the iterative calculation of the model converged (for models produced byblvim()and related approaches),FALSEfor no convergence andNAfor static models
Examples
positions <- matrix(rnorm(10 * 2), ncol = 2)
distances <- as.matrix(dist(positions))
production <- rep(1, 10)
attractiveness <- c(2, rep(1, 9))
all_flows <- grid_blvim(distances, production, c(1.25, 1.5), c(1, 2, 3), attractiveness)
all_flows_df <- sim_df(all_flows)
all_flows_df$converged
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE