Learn R Programming

spflow (version 0.1.0)

spflow_model-class: 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 behaviours and data are identical among them.

Usage

# S4 method for spflow_model
coef(object)

# S4 method for spflow_model fitted(object)

# S4 method for spflow_model nobs(object)

# S4 method for spflow_model predict(object, ..., type = "BP")

# S4 method for spflow_model resid(object)

# S4 method for spflow_model results(object)

# S4 method for spflow_model sd_error(object)

# S4 method for spflow_model_mle logLik(object)

# S4 method for spflow_model_mle_s2sls_ols varcov(object)

# S4 method for spflow_model_mcmc mcmc_results(object)

Arguments

...

Further arguments passed to the prediction function

type

A character declaring the type of prediction (for now only "BP")

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())

N

A numeric that corresponds to the number of origin-destination pairs (the sample size in this model)

sd_error

A numeric representing the standard deviation of the residual

R2_corr

A numeric that serves as a goodness of fit criterion. The R2_corr is computed as squared correlation between the fitted values and the observed values of the dependent variable.

resid

A numeric vector of regression residuals

fitted

A numeric vector of fitted values computed as the in sample prediction trend signal (TS) prediction described by @Goulard2017

spatial_filter_matrix

A matrix (can be sparse) or NULL

design_matrix

A matrix (can be sparse) or NULL

varcov

A matrix or NULL

ll

A numeric or NULL

AIC

A numeric or NULL

BIC

A numeric or NULL

mcmc_results

A data.frame containing the estimated parameters for each iteration of the MCMC sampling procedure

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

See Also

spflow(), spflow_network_classes()

Examples

Run this code
# NOT RUN {
spflow_results <- spflow(y9 ~ . + G_(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

# 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 ~ . + G_(DISTANCE),
  multi_net_usa_ge,
  flow_control = spflow_control(estimation_method = "mcmc",
                                model = "model_2"))
results(spflow_results)
mcmc_results(spflow_results_mcmc) # parameter values during the mcmc sampling

# }

Run the code above in your browser using DataLab