This function creates a list of parameters, that are used to fine tune the
estimation with spflow()
.
Here we can change the estimation method, adjust how the exogenous
variables enter the model, and also define the spatial autocorrelation structure.
spflow_control(
estimation_method = "mle",
model = "model_9",
use_intra = TRUE,
sdm_variables = "same",
weight_functions = NULL,
approx_parameter_space = TRUE,
fitted_value_method = "TS",
approx_expectation = TRUE,
expectation_approx_order = 10,
logdet_approx_order = 2,
mle_hessian_method = "mixed",
mle_optim_limit = 100,
mcmc_iterations = 5500,
mcmc_burn_in = 2500,
mcmc_resampling_limit = 100,
twosls_instrumental_variables = "same",
twosls_decorrelate_instruments = FALSE,
twosls_reduce_pair_instruments = TRUE,
track_condition_numbers = FALSE,
na_rm = FALSE,
allow_singular = TRUE,
reduce_model_size = FALSE
)
A character which indicates the estimation method, should be one of
c("mle","s2sls","mcmc")
A character indicating the model number, that controls different spatial
dependence structures should be one of paste0("model_", 1:9)
.
Details are given in the documentation of spflow_control()
.
A logical which activates the option to use a separate set of parameters for intra-regional flows (origin == destination)
Either a formula or a character; the formula can be used to explicitly
declare the variables in SDM specification, the character should be one of
c("same", "all")
which are short cuts for using all available variables
or the same as used in the main formula provided to spflow()
A named list of functions that derive weights from the input data. The function "pair" is evaluated in the data-set of OD-pairs, "orig" in the data for origins and "dest" relates to the destination. Each function should return a single vector weight and in case there are multiple ones their product is used as weights.
A logical indicating whether the test for the feasible parameter space should be based on an approximation. Note that FALSE requires solving a system with a potentially large number of equations.
A character indicating the method used for computing the fitted values. Should be one of c("TS", "TC", "BP").
A logical indicating whether the expected value of the flows should be computed based on a truncated power series. Note that FALSE requires solving a system with a potentially large number of equations.
A numeric indicating the order of the power series expression used to approximate the expected value of the flows.
A numeric indicating the order of the Taylor expansion used to approximate the value of the log-determinant term.
A character which indicates the method for Hessian calculation
A numeric indicating the number of trials given to the optimizer of the likelihood function. A trial refers to a new initiation of the optimization procedure using different (random) starting values for the parameters. If the optimizer does not converge after the indicated number of trails an error will be thrown after this limit.
A numeric indicating the number of iterations
A numeric indicating the length of the burn in period
A numeric indicating the maximal number of trials during rejection sampling of the autoregressive parameters
Either a formula or a character; the formula can be used to explicitly
declare the variables that should be used as instruments during S2SLS
estimation, the character should be one of c("same", "all")
which
are short cuts for using all available variables or the same as used in
the main formula provided to spflow()
A logical whether to perform a PCA to remove (linear) correlation from the instruments generated for the S2SLS estimator
A logical that indicates whether the number of instruments that are
derived from pair attributes should be reduced or not. The default is
TRUE
, because constructing these instruments is often the most demanding
part of the estimation (Dargel 2021)
.
A logical that controls whether or not the reciprocal condition numbers of the systems that are solved during the estimation are tracked.
A logical, if FALSE
the estimation throws an error when the data
contains NA
values. Otherwise the estimation proceeds with a sub-sample.
A logical, when FALSE
a singular fit will lead to an error.
A logical, if TRUE
all data will be removed from the model.
This is helpful when comparing many models but doing will inhibit some
methods of the model.
A list of parameters used to control the model estimation with spflow()
The option model
allows to declare one of nine different forms of
autocorrelation that follow the naming convention of
LeSage and Pace (2008)
.
The most general specification is "model_9", leading to the model
$$y = \rho_dW_dy + \rho_o W_oy + \rho_wW_wy + Z\delta + \epsilon.$$
All other models special cases of this one. The constraints that lead to the different sub models are summarized in this table.
Model Number | Autocorrelation Parameters | Constraints |
Model 9 | \(\rho_d, \rho_o, \rho_w\) | unconstrained |
Model 8 | \(\rho_d, \rho_o, \rho_w\) | \(\rho_w = - \rho_d \rho_o\) |
Model 7 | \(\rho_d, \rho_o\) | \(\rho_w = 0\) |
Model 6 | \(\rho_{dow}\) | \(\rho_d = \rho_o = \rho_w\) |
Model 5 | \(\rho_{do}\) | \(\rho_d = \rho_o, \rho_w = 0\) |
Model 4 | \(\rho_w\) | \(\rho_d = \rho_o = 0\) |
Model 3 | \(\rho_o\) | \(\rho_d = \rho_w = 0\) |
Model 2 | \(\rho_d\) | \(\rho_o = \rho_w = 0\) |
Model 1 | none | \(\rho_d = \rho_o = \rho_w = 0\) |
Dargel L (2021).
“Revisiting estimation methods for spatial econometric interaction models.”
Journal of Spatial Econometrics, 10.
https://doi.org/10.1007/s43071-021-00016-1.
LeSage JP, Pace RK (2008).
“Spatial Econometric Modeling of Origin-Destination Flows.”
Journal of Regional Science, 941--967.
https://doi.org/10.1111/j.1467-9787.2008.00573.x.
# default is MLE estimation of the most comprehensive model
default_control <- spflow_control()
# change the estimation method
custom_control <- spflow_control(estimation_method = "mcmc")
# change the form of autocorrelation to be considered
custom_control <- spflow_control(model = "model_7")
# declare precisely which variables are to be used in the SDM form
custom_control <-
spflow_control(sdm_variables = ~ O_(v1 + v2) + D_(v2 + v3) + I_(v1 + v4))
# deactivate the intra-regional coefficients and SDM variables
custom_control <- spflow_control(use_intra = FALSE, sdm_variables = "none")