si_predict {simodels}R Documentation

Predict spatial interaction based on pre-trained model

Description

Predict spatial interaction based on pre-trained model

Usage

si_predict(
  od,
  model,
  constraint_production,
  constraint_attraction,
  constraint_total,
  output_col = "interaction",
  ...
)

Arguments

od

A data frame representing origin-destination data, e.g. as created by si_to_od()

model

A model object, e.g. from lm() or glm()

constraint_production

Character representing column in od. This argument, when set, ensures that the outputs are 'production constrained': the total 'interaction' (e.g. n. trips) for all OD pairs is set such that the total for each zone of origin cannot go above this value.

constraint_attraction

Character representing column in od. This argument, when set, ensures that the outputs are 'attraction constrained': the total 'interaction' (e.g. n. trips) for all OD pairs is set such that the sum of trips to destination is equal to the mean value per destination.

constraint_total

Single number representing the total interaction. This argument, when set, ensures that the sum of the interaction calculated will equal the value given.

output_col

Character string containing the name of the new output column. "interaction" by default.

...

Arguments passed to fun

Value

An sf data frame

See Also

si_calculate

Examples

od = si_to_od(si_zones, si_zones, max_dist = 4000)
m = lm(od$origin_all ~ od$origin_bicycle)
od_updated = si_predict(od, m)

[Package simodels version 0.1.0 Index]