Learn R Programming

spflow

The spflow package allows to estimate spatial econometric interaction models. It is designed to exploit the relational structure of flow data, reducing the computational burden and memory requirements.

Installation

You can install development version from GitHub with:

# install.packages("devtools")
devtools::install_github("LukeCe/spflow")

Example

The package provides a new sp_multi_network-class that combines information on the origins, the destinations, and the origin-destination pairs. Once this object is created, we can estimate an interaction model with the spflow() function. The package vignette contains a more detailed example.

library("spflow")
spflow(y9 ~ . + G_(DISTANCE), multi_net_usa_ge)
#> --------------------------------------------------
#> Spatial interaction model estimated by: MLE  
#> Autocorrelation structure: model_9 (SDM)  
#> Observations: 256  
#> 
#> --------------------------------------------------
#> Coefficients:
#>                 est    sd  t.stat  p.value
#> rho_d          0.48  0.03   15.75     0.02
#> rho_o          0.36  0.03   10.59     0.03
#> rho_w         -0.25  0.04   -5.95     0.05
#> (Intercept)   10.00  1.92    5.21     0.06
#> (Intra)       11.32  3.07    3.69     0.08
#> DEST_X         0.94  0.06   14.97     0.02
#> DEST_X.lag1    0.62  0.11    5.80     0.05
#> ORIG_X        -0.78  0.04  -21.20     0.02
#> ORIG_X.lag1   -0.32  0.08   -3.93     0.08
#> INTRA_X        1.95  0.08   23.98     0.01
#> INTRA_X.lag1  -0.34  0.19   -1.76     0.16
#> DISTANCE      -2.80  0.34   -8.25     0.04
#> 
#> --------------------------------------------------
#> R2_corr: 0.9927709

License

GPL 3

Copy Link

Version

Install

install.packages('spflow')

Monthly Downloads

46

Version

0.1.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Lukas Dargel

Last Published

September 9th, 2021

Functions in spflow (0.1.0)

%p%

Additional infix operators for more concise code
results_flat

Access results of a spflow_model() as a one row data.frame
sd_error

custom_primitives

A set of primitive functions to test conditions
nnodes

neighborhood

results

results<-

Replacement method for internal purposes
spflow

Estimate spatial interaction models that incorporate spatial dependence
spflow_control

spflow_model-class

Class spflow_model
named_list

Some helpers to create lookups that allow to program with key value pairs
translist

Additional list operators that allow a more concise and functional programming style
varcov

spflow_model

spflow-deprecated

Deprecated functions in package spflow.
sp_multi_network-class

Class sp_multi_network
sp_multi_network

pair_merge

multinom_coef

Compute the multinomial coefficient
spflow-package

Spatial econometric interaction models in R
maybe

Functions that replace errors by NULL
multinom_lookup_template

Create a lookup table for the multinomial coefficient
npairs

sp_network_nodes-class

sp_network_nodes Class
paris_data

Example data for commuting flows within Paris
mcmc_results

sp_network_nodes

moment_empirical_var

Compute the moment expression in an interaction model in matrix form
sp_network_pair

Create an S4 object that contains information on origin-destination pairs
sp_network_pair-class

Class sp_network_pair
spflow_model_matrix

Generate design matrices for the spatial interaction model
spflow_model_moments

Compute the principal moments for a spatial flow model
spflow_network_classes

spflow network classes
spflow_sim

Simulate spatial interactions
pull_member

spatial_filter

Derive the spatial filter of an interaction model
spatial_model_order

Derive the order of the spatial model
dat

expand_flow_neighborhood

Derive the flow neighborhood matrices
add_details

define_variable_roles

Internal functions to generate model matrices
derive_log_det_calculator

assert_errors

A set of functions to create customized error messages
by_source_model_matrix

Internal functions to generate model matrices
example_data

Simulated data for stylized versions of Germany and the USA
id