spflow_model-class: Class spflow_model

spflow_model-classR Documentation

Class spflow_model

Description

An S4 class that contains the estimation results of spatial econometric interaction models estimated by the spflow() function.

There are four subclasses that are specific to the chosen estimation method (OLS, MLE, Bayesian MCMC or S2SLS). They contain some additional information specific to the corresponding method but most behaviors and data are identical among them.

Usage

## S4 method for signature 'spflow_model'
coef(object, param_subset = NULL)

## S4 method for signature 'spflow_model'
fitted(object, return_type = "V")

## S4 method for signature 'spflow_model'
logLik(object)

## S4 method for signature 'spflow_model_mcmc'
mcmc_results(object)

## S4 method for signature 'spflow_model'
nobs(object, which = "sample")

## S4 method for signature 'spflow_model'
neighborhood(object, which_nb)

## S4 method for signature 'spflow_model'
resid(object, return_type = "V")

## S4 method for signature 'spflow_model'
results(object)

## S4 method for signature 'spflow_model'
results_flat(
  object,
  coef_info = c("est", "sd"),
  main_info = c("estimation_method", "model_coherence", "R2_corr", "ll", "sd_error")
)

## S4 method for signature 'spflow_model'
sd_error(object)

## S4 method for signature 'spflow_model_varcov'
varcov(object)

Arguments

object

A spflow_model

param_subset

A character indicating the subset of model parameters to be returned "rho" relates to the autoregression parameters and "delta" to those of the exogenous variables.

return_type

A character indicating the format of the returned values:

  • "V" leads to an atomic vector

  • "M" leads to a OD matrix where missing data is replaced by zeros

  • "OD" leads to a data.frame with columns being the the values and the id's of the destinations and the origins

which

A character vector indicating the subset of observations to consider should be one of c("fit", "cart", "pop", "pair", "orig", "dest").

which_nb

A character vector: "OW" for origin- and "DW" for destination neighborhood

coef_info

A character indicating column names in the results

main_info

A character indicating named elements in the estimation_control or estimation_diagnostics

Slots

estimation_results

A data.frame that contains the main results() of the estimation

estimation_control

A list that contains all control parameters of the estimation (see spflow_control())

estimation_diagnostics

A list of further indicators about the estimation

spflow_formula

A formula

spflow_networks

A spflow_network_multi-class()

spflow_matrices

A list or NULL

spflow_formula

The formula used to fit the model

spflow_indicators

A data.frame containing the indicators of od-pairs

spflow_moments

A list of moment matrices used for estimating the model

spflow_nbfunctions

A list that may contain a function to calculate the log-determinant term and one to validate the parameter space for the spatial interaction model.

Main results

The main results are accessed with the results() method. They are given in the form of a data frame with the following columns;

  • est: value of the estimated parameter

  • sd: value of the standard deviation of the parameter

  • t.test: value of the t-statistic under the two-sided hypothesis that the parameter value is 0.

  • p.val: the p-value associated to the t-test

  • quant_025: for Bayesian estimation the lower bound of 95% interval

  • quant_975: for Bayesian estimation the upper bound of 95% interval

Author(s)

Lukas Dargel

See Also

spflow(), spflow_network_classes()

Examples


spflow_results <- spflow(y9 ~ . + P_(DISTANCE), multi_net_usa_ge)

# General methods
results(spflow_results) # data.frame of main results
coef(spflow_results) # vector of estimated coefficients
fitted(spflow_results) # vector of fitted values
resid(spflow_results) # vector of residuals
nobs(spflow_results) # number of observations
sd_error(spflow_results) # standard deviation of the error term
predict(spflow_results) # computation of the in sample predictor
plot(spflow_results) # some plots for assessing the model

# MLE methods
logLik(spflow_results) # value of the likelihood function

# MLE, OLS and S2SLS methods
varcov(spflow_results) # variance covariance matrix of the estimators

# MCMC methods
spflow_results_mcmc <- spflow(
  y2 ~ . + P_(DISTANCE),
  multi_net_usa_ge,
  estimation_control = spflow_control(estimation_method = "mcmc",
                                model = "model_2"))
results(spflow_results_mcmc)
plot(mcmc_results(spflow_results_mcmc)) # parameter values during the mcmc sampling

LukeCe/spflow documentation built on Nov. 11, 2023, 8:20 p.m.