spflow: Estimate spatial interaction models that incorporate spatial...

Description Usage Arguments Value Details References See Also Examples

View source: R/spflow.R

Description

We implement three different estimators of spatial econometric interaction models \insertCiteDargel2021spflow that allow the user to estimate origin-destination flows with spatial autocorrelation.

By default the estimation will include spatial dependence in the dependent variable and the explanatory variables which leads to the spatial Durbin model (SDM) \insertCiteAnselin1988spflow. Moreover, the model includes an additional set of parameters for intra regional flows that start and end in the same geographic site (as proposed by \insertCiteLeSage2009;textualspflow). Both default options can be deactivated via the flow_control argument, which gives fine grained control over the estimation.

Usage

1
2
3
4
5
6
spflow(
  flow_formula,
  sp_multi_network,
  network_pair_id = id(sp_multi_network)[["network_pairs"]][[1]],
  flow_control = spflow_control()
)

Arguments

flow_formula

A formula specifying the spatial interaction model (for details see section Formula interface)

sp_multi_network

A sp_multi_network() object that contains information on the origins, and the destinations and their neighborhood structure

network_pair_id

A character indicating the id of a sp_network_pair() (only relevant if the sp_multi_network() contains multiple sp_network_pair-objects: defaults to the of them)

flow_control

A list generated by spflow_control() that provides fine grained control over the estimation procedure

Value

An S4 class of type spflow_model-class()

Details

Our estimation procedures makes use of the matrix formulation introduced by \insertCiteLeSage2008;textualspflow and further developed by \insertCiteDargel2021;textualspflow to reduce the computational effort and memory requirements. The estimation procedure can be adjusted through the estimation_method argument in spflow_control().

Maximum likelihood estimation (MLE)

Maximum likelihood estimation is the default estimation procedure. The matrix form estimation in the framework of this model was first developed by \insertCiteLeSage2008;textualspflow and then improved by \insertCiteDargel2021;textualspflow.

Spatial two-stage least squares (S2SLS)

The S2SLS estimator is an adaptation of the one proposed by \insertCiteKelejian1998;textualspflow, to the case of origin-destination flows, with up to three neighborhood matrices \insertCiteDargel2021;textualspflow. A similar estimation is done by \insertCiteTamesue2016;textualspflow. The user can activate the S2SLS estimation via the flow_control argument using the input spflow_control(estimation_method = "s2sls").

Bayesian Markov Chain Monte Carlo (MCMC)

The MCMC estimator is based on the ideas of \insertCiteLeSage2009;textualspflow and incorporates the improvements proposed in \insertCiteDargel2021;textualspflow. The estimation is based on a tuned Metropolis-Hastings sampler for the auto-regressive parameters, and for the remaining parameters it uses Gibbs sampling. The routine uses 5500 iterations of the sampling procedure and considers the first 2500 as burn-in period. The user can activate the S2SLS estimation via the flow_control argument using the input spflow_control(estimation_method = "mcmc").

Formula interface

The function offers a formula interface adapted to spatial interaction models, which has the following structure: Y ~ O_(X1) + D_(X2) + I_(X3) + G_(X4) This structure reflects the different data sources involved in such a model. On the left hand side there is the independent variable Y which corresponds to the vector of flows. On the right hand side we have all the explanatory variables. The functions O_(...) and D_(...) indicate which variables are used as characteristics of the origins and destinations respectively. Similarly, I_(...) indicates variables that should be used for the intra-regional parameters. Finally, G_(...) declares which variables describe origin-destination pairs, which most frequently will include a measure of distance.

All the declared variables must be available in the provided sp_multi_network() object, which gathers information on the origins and destinations (inside sp_network_nodes() objects), as well as the information on the origin-destination pairs (inside a sp_network_pair() object).

Using the short notation Y ~ . is possible and will be interpreted as usual, in the sense that we use all variables that are available for each data source. Also mixed formulas, such as Y ~ . + G_(log(X4) + 1), are possible. When the dot shortcut is combined with explicit declaration, it will only be used for the non declared data sources. The following examples illustrate this behaviour.

Formula interface (examples)

Consider the case where we have the flow vector Y and the distance vector DIST available as information on origin-destination pairs. In addition we have the explanatory variables X1, X2 and X3 which describe the regions that are at the same time origins and destinations of the flows.

For this example the four formulas below are equivalent and make use of all explanatory variables X1, X2 and X3 for origins, destinations and intra-regional observations.

Now if we only want to use X1 for the intra-regional model we can do the following (again all four options below are equivalent).

This behaviour is easily combined with transformation of variables as the two equivalent options below illustrate.

References

\insertAllCited

See Also

spflow_control() spflow_network_classes()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# Estimate flows between the states of Germany
spflow(flow_formula = y9 ~ . + G_(DISTANCE),
       sp_multi_network = multi_net_usa_ge,
       network_pair_id = "ge_ge")

# Same as above with explicit declaration of variables...
# ... X is the only variable available
# ... it is used for origins, destination and intra-state flows
spflow(flow_formula = y9 ~ X + G_(DISTANCE),
       sp_multi_network = multi_net_usa_ge,
       network_pair_id = "ge_ge")

# Same as above
spflow(flow_formula = y9 ~ O_(.) + D_(.) + I_(.) + G_(DISTANCE),
       sp_multi_network = multi_net_usa_ge,
       network_pair_id = "ge_ge")

# Same as above
spflow(flow_formula = y9 ~ O_(X) + D_(X) + I_(X) + G_(DISTANCE),
       sp_multi_network = multi_net_usa_ge,
       network_pair_id = "ge_ge")

spflow documentation built on Sept. 9, 2021, 5:06 p.m.