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.
# S4 method for spflow_model
coef(object, param_subset = NULL)
# S4 method for spflow_model
fitted(object, return_type = "V")
# S4 method for spflow_model
logLik(object)
# S4 method for spflow_model_mcmc
mcmc_results(object)
# S4 method for spflow_model
nobs(object, which = "sample")
# S4 method for spflow_model
neighborhood(object, which_nb)
# S4 method for spflow_model
resid(object, return_type = "V")
# S4 method for spflow_model
results(object)
# S4 method for 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 spflow_model
sd_error(object)
# S4 method for 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
Examples
spflow_results <- spflow(y9 ~ . + P_(DISTANCE), multi_net_usa_ge)
# General methods
results(spflow_results) # data.frame of main results
#> est sd t.stat p.val quant_025 quant_975
#> rho_d 0.4973547 0.03014394 16.499323 1.380740e-41 0.4382736 0.5564357
#> rho_o 0.3329122 0.03698759 9.000647 6.519306e-17 0.2604179 0.4054066
#> rho_w -0.2266926 0.04430103 -5.117097 6.286715e-07 -0.3135210 -0.1398642
#> (Intercept) 10.1984199 2.16127645 4.718702 4.000168e-06 5.9623959 14.4344439
#> (Intra) 9.8708850 1.53144280 6.445481 6.109021e-10 6.8693122 12.8724577
#> D_X 0.9830507 0.06864236 14.321342 3.560579e-34 0.8485141 1.1175872
#> D_X.lag1 0.5087106 0.11464892 4.437116 1.380786e-05 0.2840028 0.7334183
#> O_X -0.7587555 0.03809640 -19.916726 4.597166e-53 -0.8334230 -0.6840879
#> O_X.lag1 -0.3671947 0.09261763 -3.964630 9.661449e-05 -0.5487219 -0.1856675
#> I_X 2.0353094 0.08256791 24.650126 3.559790e-68 1.8734793 2.1971395
#> P_DISTANCE -2.6218397 0.38393401 -6.828881 6.756072e-11 -3.3743365 -1.8693429
coef(spflow_results) # vector of estimated coefficients
#> rho_d rho_o rho_w (Intercept) (Intra) D_X
#> 0.4973547 0.3329122 -0.2266926 10.1984199 9.8708850 0.9830507
#> D_X.lag1 O_X O_X.lag1 I_X P_DISTANCE
#> 0.5087106 -0.7587555 -0.3671947 2.0353094 -2.6218397
fitted(spflow_results) # vector of fitted values
#> [1] 70.5269714 50.7313438 59.2264813 25.3655601 45.6058515 54.4762978
#> [7] 37.6779691 18.7507221 47.9836203 37.5703377 28.7870075 10.6905430
#> [13] 16.1966491 11.2783405 -4.9354540 -5.5816679 41.3374471 82.1821197
#> [19] 52.1207339 29.9805582 51.1448302 58.5083918 34.4574412 20.0691126
#> [25] 49.3828677 37.4529444 27.2178711 10.8583329 15.8500487 11.3125403
#> [31] -5.7514817 -6.1967351 34.1375713 36.0149122 91.3951293 12.3503008
#> [37] 41.3826090 53.2312287 37.7203015 7.3806426 37.7303268 30.6623934
#> [43] 22.5659230 -0.2063087 6.4415599 2.7836281 -14.8862015 -15.2430073
#> [49] 30.5627047 47.7528130 46.8684821 64.3020217 60.0761184 59.1740105
#> [55] 38.9652316 40.6681479 69.4908949 48.5042522 36.6737188 29.0457289
#> [61] 32.4958891 25.0209675 10.9306841 8.9236977 18.9354615 36.1343754
#> [67] 42.6122027 27.4590332 92.6830387 53.7228657 29.3976429 23.3065551
#> [73] 53.5330013 39.9311829 24.1628968 8.8976655 14.9695239 9.4347148
#> [79] -8.4324922 -9.6142483 8.7390923 25.8169757 37.2048266 6.3518237
#> [85] 35.3401430 104.0637226 34.9837712 3.9658545 42.5431999 36.2965027
#> [91] 30.0294154 -2.5893626 4.6375913 2.3782630 -15.9603743 -16.0624156
#> [97] 18.5303796 26.9681095 45.9887403 11.7927226 37.4365940 59.4876780
#> [103] 82.4410414 11.2762724 44.9284581 46.4316953 42.2520340 5.9158728
#> [109] 14.5677699 13.2709974 -6.1348805 -4.7997091 24.6590951 37.5557968
#> [115] 42.0719644 39.3316067 55.9344261 55.6190608 37.1786941 69.2205942
#> [121] 70.5764298 48.7424554 35.4925554 37.7430799 39.5995689 27.2606756
#> [127] 15.4195397 11.8415220 -0.9055022 12.6994834 18.1594381 15.9208212
#> [133] 33.5966295 39.5491777 16.1562774 17.6188308 112.6727508 33.4194194
#> [139] 14.8840369 14.6381350 17.9169322 10.9619384 -9.0387227 -10.7416673
#> [145] 9.9829415 21.9153739 31.8342476 13.0509628 41.0264227 53.3675144
#> [151] 39.9722262 14.1352760 52.4940337 92.3529657 38.2953233 10.0997124
#> [157] 23.4924025 21.4734556 -1.5214615 -1.5058850 14.0800556 25.0552728
#> [163] 37.8915148 13.7516229 38.5051146 60.1218789 49.3519835 14.4964664
#> [169] 48.9562662 51.7450356 81.8134737 11.8411638 21.7755550 26.8981991
#> [175] 1.3394303 3.8510539 21.6226725 31.9016973 39.6206858 30.8519718
#> [181] 48.0189195 53.9346162 36.5267668 40.3964283 69.7619523 48.1084226
#> [187] 36.3508586 67.9458825 44.0175017 30.6554901 25.4147031 17.4867914
#> [193] 17.2576525 28.5474487 35.9991028 24.4924361 43.6744066 51.8872710
#> [199] 35.7232743 35.5621154 65.5965569 52.5095209 36.4785991 37.0401619
#> [205] 80.1195332 36.3463648 26.3574629 26.1497495 20.0284743 31.8894554
#> [211] 41.3225975 25.9957653 46.6441672 57.7135263 43.0844510 30.2817124
#> [217] 67.5022825 58.9613080 49.6887945 31.2874109 44.1960761 69.4418945
#> [223] 27.9141870 30.6490787 26.2195488 37.9051564 45.0504243 31.8092147
#> [229] 51.7607265 59.6135893 45.7991604 37.7111146 68.0924405 56.7932772
#> [235] 46.1957980 45.1392431 53.1312301 46.0212568 58.7370703 36.6092050
#> [241] 24.6482531 36.2671916 46.8855409 31.2785881 51.5774578 60.6124862
#> [247] 46.6625990 36.5661751 67.8520529 59.1232486 49.2772416 38.5180404
#> [253] 52.8097787 49.1933030 39.2000900 60.2497586
resid(spflow_results) # vector of residuals
#> [1] 2.11214514 -0.36023608 -1.75806680 4.43755945 -1.08440288 -1.13266088
#> [7] 1.16325271 0.87485174 1.04545118 1.63772552 1.09333930 1.87023862
#> [13] 1.47642316 -0.24498135 -1.74180881 0.41396006 1.71222841 1.77732851
#> [19] 1.93913800 -4.73442974 -0.30259970 1.01831525 0.71342279 -1.15517073
#> [25] 1.21095372 2.58094837 -1.21191981 1.77091048 -0.27303257 1.56480736
#> [31] -2.28205848 0.91231583 2.31035455 1.12820872 3.14325346 1.96066070
#> [37] 4.27565875 2.53713948 0.66683022 0.51840733 -3.35303396 1.61610502
#> [43] 1.42318977 0.14678503 1.51792516 1.35120638 1.95981058 2.13908927
#> [49] 0.93127606 1.15534829 3.66505039 0.68510613 2.23823202 1.98637092
#> [55] 0.41040316 -1.14542829 -3.02390742 1.52865502 -2.91340460 2.17920116
#> [61] -1.35941639 -5.09645503 0.22899702 1.62893951 0.07269726 -3.22157135
#> [67] 2.71277110 -2.45167656 -2.71376611 -0.58524790 -0.09683602 1.04538529
#> [73] 0.79342982 -1.33730206 -4.19678177 -0.12431848 2.36691044 1.01667402
#> [79] -0.83390265 0.31721541 0.26606021 0.63337982 3.03595133 0.01454234
#> [85] -1.79106129 -1.39992376 -0.77020907 0.42146458 0.39075490 2.34650081
#> [91] 0.61616375 -0.94772474 -3.93805935 -2.56814798 0.73339382 -1.07730709
#> [97] 2.42976871 -1.77539197 -1.70862051 -4.40142627 -1.01707591 1.00188682
#> [103] -0.40709153 0.88110389 1.50819554 -0.33973639 2.01923436 -0.52759714
#> [109] -0.99142361 -0.35439571 0.29705948 1.02702855 2.34275842 -1.63374451
#> [115] 0.11629287 -1.59737486 2.62034094 -0.37091715 -1.18267013 -0.28286629
#> [121] 0.62398250 1.50071357 -3.90002191 -1.47012638 -3.61102954 -0.26724981
#> [127] 1.30215092 3.15877660 0.98188639 -0.75192661 -2.40283394 -0.20594510
#> [133] 2.27154948 -1.43780699 2.94742084 0.86891396 0.82781841 3.74875488
#> [139] -2.12987885 1.52444210 0.55645235 -2.90053840 -1.56784108 -0.06277611
#> [145] -0.96795717 -0.83857494 -3.38564727 -0.70961780 -0.92334047 -0.61810446
#> [151] 1.19311184 -0.41358547 -3.25542774 1.61682070 0.12650374 -3.03047945
#> [157] 0.39350570 1.92589277 1.52739323 0.42076456 1.76602611 0.52480121
#> [163] 0.81831364 0.25964817 -0.96844474 -1.04543447 -3.05448556 -0.01815262
#> [169] 0.49554949 -2.94328012 -3.54045432 -0.25398533 0.40381038 3.54493469
#> [175] -2.99158913 1.33598296 2.63159488 -5.98139858 -0.15614663 -0.03061795
#> [181] 5.48032343 0.30744542 -1.66195682 -0.83641828 -1.52076091 -4.03372627
#> [187] -2.03983747 0.57782125 -1.40671831 0.30582816 1.26291385 5.79797746
#> [193] 1.87016414 -0.88249135 -4.22357045 -1.10954732 -1.37561115 1.86301727
#> [199] -0.24009616 4.42511943 -0.78363133 -1.30184847 -0.27800154 -1.13858067
#> [205] -0.67901517 -1.37650543 -3.20553978 -1.48073898 0.18977448 2.38363548
#> [211] -0.71877507 0.86256078 -3.07518488 3.13047824 0.81439417 -0.80584736
#> [217] 0.56230286 1.21657523 0.91497607 -1.18324637 -1.65044114 -1.62354683
#> [223] -4.04725903 -1.85122433 0.05755356 1.78439671 -5.40162602 -1.31146829
#> [229] 1.49664962 -0.23470668 1.01518042 0.45971663 1.92472813 -0.29281082
#> [235] -0.40713111 2.19693076 6.51250777 0.56201636 -0.50488173 -1.00520433
#> [241] 0.42497081 -0.39394802 2.69021017 -1.13506342 -1.23135606 -0.36034669
#> [247] -2.52104765 -0.59367156 -0.30425164 -0.51413292 -0.71558832 -2.04517397
#> [253] -0.64098273 -1.28806789 2.60004031 0.41125216
nobs(spflow_results) # number of observations
#> [1] 256
sd_error(spflow_results) # standard deviation of the error term
#> [1] 1.992727
predict(spflow_results) # computation of the in sample predictor
#> ID_DEST ID_ORIG ACTUAL SIGNAL FITTED PREDICTION
#> 1 SH SH 68.4148262 45.14187869 70.5269714 73.3433069
#> 2 HH SH 51.0915798 16.65173183 50.7313438 50.5508350
#> 3 MV SH 60.9845481 20.78620988 59.2264813 58.4977416
#> 4 NW SH 20.9280007 6.74202435 25.3655601 29.8333749
#> 5 HB SH 46.6902544 19.83175525 45.6058515 45.0204405
#> 6 BB SH 55.6089587 24.70945965 54.4762978 54.1563699
#> 7 BE SH 36.5147164 13.68924708 37.6779691 39.2350586
#> 8 RP SH 17.8758703 6.06733312 18.7507221 19.7131880
#> 9 NI SH 46.9381691 25.25085093 47.9836203 48.5063528
#> 10 ST SH 35.9326122 17.00246835 37.5703377 40.1078545
#> 11 SN SH 27.6936682 10.37997566 28.7870075 29.9427223
#> 12 SL SH 8.8203044 3.09035668 10.6905430 13.3920884
#> 13 HE SH 14.7202260 7.27461553 16.1966491 17.9051881
#> 14 TH SH 11.5233219 3.17514177 11.2783405 11.5937970
#> 15 BW SH -3.1936452 -4.70142469 -4.9354540 -6.4251620
#> 16 BY SH -5.9956280 -4.87625289 -5.5816679 -4.3004844
#> 17 SH HH 39.6252187 8.90619695 41.3374471 43.8499013
#> 18 HH HH 80.4047912 56.28423399 82.1821197 84.0948500
#> 19 MV HH 50.1815959 18.48234820 52.1207339 54.3192325
#> 20 NW HH 34.7149880 5.50693165 29.9805582 24.9194289
#> 21 HB HH 51.4474299 19.06373172 51.1448302 51.3751342
#> 22 BB HH 57.4900766 23.47436695 58.5083918 59.6261725
#> 23 BE HH 33.7440184 11.85245456 34.4574412 35.7488878
#> 24 RP HH 21.2242833 5.10584320 20.0691126 19.2050183
#> 25 NI HH 48.1719140 24.48282739 49.3828677 50.8444281
#> 26 ST HH 34.8719960 16.04097843 37.4529444 39.7907488
#> 27 SN HH 28.4297909 9.02760737 27.2178711 26.3855800
#> 28 SL HH 9.0874224 2.21963035 10.8583329 12.1871358
#> 29 HE HH 16.1230813 6.50659199 15.8500487 15.5003457
#> 30 TH HH 9.7477330 2.30441544 11.3125403 12.8813129
#> 31 BW HH -3.4694232 -5.46944823 -5.7514817 -7.5868789
#> 32 BY HH -7.1090509 -5.70742635 -6.1967351 -5.2906657
#> 33 SH MV 31.8272167 3.80610118 34.1375713 38.4657908
#> 34 HH MV 34.8867035 9.24777437 36.0149122 37.4726019
#> 35 MV MV 88.2518758 67.66716631 91.3951293 95.1124657
#> 36 NW MV 10.3896401 -0.66193310 12.3503008 14.6797515
#> 37 HB MV 37.1069503 13.96363595 41.3826090 45.6374393
#> 38 BB MV 50.6940892 20.54627431 53.2312287 55.9419698
#> 39 BE MV 37.0534713 9.99313090 37.7203015 39.5486281
#> 40 RP MV 6.8622353 -0.46132174 7.3806426 8.4022380
#> 41 NI MV 41.0833607 19.84980079 37.7303268 34.8620392
#> 42 ST MV 29.0462884 12.64581662 30.6623934 32.5762780
#> 43 SN MV 21.1427333 6.56658390 22.5659230 24.7788697
#> 44 SL MV -0.3530937 -2.95665623 -0.2063087 0.2988507
#> 45 HE MV 4.9236348 2.06703177 6.4415599 7.7378385
#> 46 TH MV 1.4324217 -1.28421275 2.7836281 4.1464103
#> 47 BW MV -16.8460120 -9.80630565 -14.8862015 -12.3355392
#> 48 BY MV -17.3820966 -9.39875734 -15.2430073 -12.2148136
#> 49 SH NW 29.6314287 10.87256117 30.5627047 33.5032918
#> 50 HH NW 46.5974648 17.38300334 47.7528130 48.4785495
#> 51 MV NW 43.2034317 20.44871242 46.8684821 50.4487996
#> 52 NW NW 63.6169156 38.53995989 64.3020217 64.8064531
#> 53 HB NW 57.8378864 24.27086805 60.0761184 62.1891396
#> 54 BB NW 57.1876396 27.14566513 59.1740105 61.0000945
#> 55 BE NW 38.5548284 15.05668358 38.9652316 39.7320052
#> 56 RP NW 41.8135762 13.55375164 40.6681479 39.3064228
#> 57 NI NW 72.5148023 31.22580187 69.4908949 66.3906747
#> 58 ST NW 46.9755972 21.24811476 48.5042522 50.2506954
#> 59 SN NW 39.5871234 13.35944111 36.6737188 32.9939261
#> 60 SL NW 26.8665277 10.47407241 29.0457289 30.6525058
#> 61 HE NW 33.8553055 13.71663564 32.4958891 30.9422606
#> 62 TH NW 30.1174226 8.38685437 25.0209675 19.7018279
#> 63 BW NW 10.7016871 1.93406181 10.9306841 10.2239990
#> 64 BY NW 7.2947582 0.85665453 8.9236977 9.6651894
#> 65 SH HB 18.8627642 1.85061197 18.9354615 18.1268404
#> 66 HH HB 39.3559468 8.82812331 36.1343754 32.9535146
#> 67 MV HB 39.8994316 12.96260136 42.6122027 44.6547494
#> 68 NW HB 29.9107098 2.15918795 27.4590332 24.4082536
#> 69 HB HB 95.3968049 67.82889877 92.6830387 89.8419618
#> 70 BB HB 54.3081136 20.12662324 53.7228657 53.1191875
#> 71 BE HB 29.4944789 8.03764169 29.3976429 28.7006894
#> 72 RP HB 22.2611698 2.82686847 23.3065551 24.0325921
#> 73 NI HB 52.7395715 22.67092183 53.5330013 54.1150348
#> 74 ST HB 41.2684850 13.76200370 39.9311829 38.4419208
#> 75 SN HB 28.3596786 6.14693284 24.1628968 19.6579683
#> 76 SL HB 9.0219840 0.21425840 8.8976655 8.6065659
#> 77 HE HB 12.6026134 4.69468644 14.9695239 16.9180049
#> 78 TH HB 8.4180407 0.29904350 9.4347148 10.3337208
#> 79 BW HB -7.5985895 -7.28135378 -8.4324922 -9.2939148
#> 80 BY HB -9.9314637 -7.62203470 -9.6142483 -9.3098710
#> 81 SH BB 8.4730321 -2.98174889 8.7390923 9.4211235
#> 82 HH BB 25.1835958 3.52869328 25.8169757 26.1119478
#> 83 MV BB 34.1688753 9.83517447 37.2048266 39.8285598
#> 84 NW BB 6.3372813 -4.67608023 6.3518237 6.1033809
#> 85 HB BB 37.1312043 10.41655799 35.3401430 33.3203646
#> 86 BB BB 105.4636464 79.28865402 104.0637226 102.4496829
#> 87 BE BB 35.7539803 6.44605294 34.9837712 34.2670531
#> 88 RP BB 3.5443899 -3.54133053 3.9658545 3.7132766
#> 89 NI BB 42.1524450 17.37149181 42.5431999 42.6738182
#> 90 ST BB 33.9500019 10.63457681 36.2965027 38.3747927
#> 91 SN BB 29.4132517 4.08827492 30.0294154 30.2561348
#> 92 SL BB -1.6416378 -5.55224079 -2.5893626 -4.3275891
#> 93 HE BB 8.5756506 -0.13767442 4.6375913 1.1119357
#> 94 TH BB 4.9464110 -3.29545256 2.3782630 -0.4468313
#> 95 BW BB -16.6937681 -11.92024826 -15.9603743 -15.8898549
#> 96 BY BB -14.9851085 -11.40999715 -16.0624156 -18.3800959
#> 97 SH BE 16.1006108 2.79045325 18.5303796 20.2606236
#> 98 HH BE 28.7435015 8.69919562 26.9681095 25.0376683
#> 99 MV BE 47.6973609 16.07444578 45.9887403 44.0713929
#> 100 NW BE 16.1941489 0.02735294 11.7927226 6.7571944
#> 101 HB BE 38.4536699 15.11999116 37.4365940 36.4038703
#> 102 BB BE 58.4857912 23.23846766 59.4876780 60.1599121
#> 103 BE BE 82.8481329 56.79369123 82.4410414 81.9151941
#> 104 RP BE 10.3951685 1.35556902 11.2762724 11.8663350
#> 105 NI BE 43.4202626 22.54199414 44.9284581 46.2383705
#> 106 ST BE 46.7714317 16.87384812 46.4316953 46.0768166
#> 107 SN BE 40.2327996 12.49954937 42.2520340 44.0411680
#> 108 SL BE 6.4434700 -0.26446287 5.9158728 4.9138562
#> 109 HE BE 15.5591935 5.63452772 14.5677699 13.3205154
#> 110 TH BE 13.6253932 3.41088792 13.2709974 12.7160998
#> 111 BW BE -6.4319400 -5.75716775 -6.1348805 -6.0232053
#> 112 BY BE -5.8267377 -4.51019028 -4.7997091 -3.7517394
#> 113 SH RP 22.3163367 7.03082891 24.6590951 26.7389132
#> 114 HH RP 39.1895413 13.81487386 37.5557968 35.6869355
#> 115 MV RP 41.9556715 17.48228275 42.0719644 41.6646471
#> 116 NW RP 40.9289816 10.38671061 39.3316067 37.3284556
#> 117 HB RP 53.3140852 21.77150755 55.9344261 58.1050027
#> 118 BB RP 55.9899779 25.11337380 55.6190608 55.0822942
#> 119 BE RP 38.3613642 13.21785863 37.1786941 35.6845261
#> 120 RP RP 69.5034605 44.98621120 69.2205942 68.9925525
#> 121 NI RP 69.9524473 30.89844450 70.5764298 71.0940325
#> 122 ST RP 47.2417418 20.45368823 48.7424554 50.1003646
#> 123 SN RP 39.3925773 12.37154819 35.4925554 30.9651599
#> 124 SL RP 39.2132063 11.68255318 37.7430799 35.7883406
#> 125 HE RP 43.2105984 14.45804725 39.5995689 35.8850093
#> 126 TH RP 27.5279254 8.52656617 27.2606756 26.2645689
#> 127 BW RP 14.1173888 2.94907620 15.4195397 16.0061888
#> 128 BY RP 8.6827454 1.48079056 11.8415220 14.2703920
#> 129 SH NI -1.8873886 -7.06704411 -0.9055022 -0.7061123
#> 130 HH NI 13.4514100 -0.08953277 12.6994834 12.3005144
#> 131 MV NI 20.5622720 4.51201446 18.1594381 15.8918339
#> 132 NW NI 16.1267663 -5.22262998 15.9208212 15.8401160
#> 133 HB NI 31.3250800 8.33417009 33.5966295 35.3496306
#> 134 BB NI 40.9869847 12.74480531 39.5491777 37.9135006
#> 135 BE NI 13.2088565 1.12289293 16.1562774 18.9505317
#> 136 RP NI 16.7499169 -2.38294632 17.6188308 18.4518430
#> 137 NI NI 111.8449323 89.92711162 112.6727508 113.1773718
#> 138 ST NI 29.6706645 8.55218891 33.4194194 36.5632111
#> 139 SN NI 17.0139158 0.47004888 14.8840369 12.9964805
#> 140 SL NI 13.1136929 -3.92678741 14.6381350 16.0490381
#> 141 HE NI 17.3604798 1.02070979 17.9169322 18.4476095
#> 142 TH NI 13.8624768 -3.84200232 10.9619384 8.4560995
#> 143 BW NI -7.4708816 -10.95533043 -9.0387227 -10.8550340
#> 144 BY NI -10.6788912 -11.48947773 -10.7416673 -11.6051119
#> 145 SH ST 10.9508987 -1.35406291 9.9829415 7.3510222
#> 146 HH ST 22.7539488 5.42998205 21.9153739 20.6999573
#> 147 MV ST 35.2198949 11.26939407 31.8342476 28.4570463
#> 148 NW ST 13.7605806 -1.23895331 13.0509628 11.2699813
#> 149 HB ST 41.9497631 13.38661573 41.0264227 39.9091581
#> 150 BB ST 53.9856189 19.96925409 53.3675144 52.1900597
#> 151 BE ST 38.7791143 9.41611069 39.9722262 40.6980771
#> 152 RP ST 14.5488615 1.13366118 14.1352760 13.0575440
#> 153 NI ST 55.7494614 22.51355268 52.4940337 49.1848010
#> 154 ST ST 90.7361450 67.88954844 92.3529657 93.4380138
#> 155 SN ST 38.1688195 9.23033580 38.2953233 38.1350175
#> 156 SL ST 13.1301918 0.05688925 10.0997124 6.5834307
#> 157 HE ST 23.0988968 6.07315543 23.4924025 23.4143483
#> 158 TH ST 19.5475629 3.38244646 21.4734556 22.4329377
#> 159 BW ST -3.0488547 -5.43581562 -1.5214615 -0.2432541
#> 160 BY ST -1.9266496 -4.73209812 -1.5058850 -1.0460725
#> 161 SH SN 12.3140295 1.67094499 14.0800556 15.9264697
#> 162 HH SN 24.5304716 8.06411158 25.0552728 24.7408400
#> 163 MV SN 37.0732012 14.83766194 37.8915148 37.8667641
#> 164 NW SN 13.4919748 0.51987363 13.7516229 13.4961900
#> 165 HB SN 39.4735594 15.41904546 38.5051146 36.8741952
#> 166 BB SN 61.1673134 23.07045280 60.1218789 59.2396676
#> 167 BE SN 52.4064691 14.68931253 49.3519835 45.6632072
#> 168 RP SN 14.5146190 2.69902173 14.4964664 14.0580549
#> 169 NI SN 48.4607167 24.07891324 48.9562662 48.7044066
#> 170 ST SN 54.6883157 18.87783639 51.7450356 49.1723750
#> 171 SN SN 85.3539281 56.43990148 81.8134737 77.5280470
#> 172 SL SN 12.0951492 1.81571620 11.8411638 11.1306089
#> 173 HE SN 21.3717446 8.10558516 21.7755550 21.5083421
#> 174 TH SN 23.3532644 6.48364516 26.8981991 29.9032473
#> 175 BW SN 4.3310194 -2.80168609 1.3394303 -2.0523497
#> 176 BY SN 2.5150709 -1.16383025 3.8510539 4.9897341
#> 177 SH SL 18.9910776 4.84216720 21.6226725 23.2441600
#> 178 HH SL 37.8830959 11.71697575 31.9016973 25.5526752
#> 179 MV SL 39.7768324 15.77526300 39.6206858 38.6220722
#> 180 NW SL 30.8825897 8.09534611 30.8519718 30.4118901
#> 181 HB SL 42.5385961 19.94721222 48.0189195 53.1257957
#> 182 BB SL 53.6271707 23.89077828 53.9346162 54.2049756
#> 183 BE SL 38.1887236 12.38614148 36.5267668 33.9329145
#> 184 RP SL 41.2328466 12.47086792 40.3964283 39.7369302
#> 185 NI SL 71.2827132 30.14291815 69.7619523 68.1829375
#> 186 ST SL 52.1421489 20.16523104 48.1084226 44.4023933
#> 187 SN SL 38.3906960 12.27655739 36.3508586 33.1542877
#> 188 SL SL 67.3680612 44.85884689 67.9458825 68.3445274
#> 189 HE SL 45.4242200 15.87452403 44.0175017 41.9987643
#> 190 TH SL 30.3496619 9.47597378 30.6554901 29.8787977
#> 191 BW SL 24.1517893 5.43432195 25.4147031 26.1128829
#> 192 BY SL 11.6888139 3.36433651 17.4867914 23.3295325
#> 193 SH HE 15.3874884 2.13177058 17.2576525 17.4259730
#> 194 HH HE 29.4299400 9.10928192 28.5474487 27.3191426
#> 195 MV HE 40.2226732 13.90429553 35.9991028 31.7955413
#> 196 NW HE 25.6019835 4.44325387 24.4924361 22.9940945
#> 197 HB HE 45.0500177 17.53298477 43.6744066 41.7607393
#> 198 BB HE 50.0242537 22.41068917 51.8872710 53.0744455
#> 199 BE HE 35.9633705 11.39047659 35.7232743 34.8136414
#> 200 RP HE 31.1369960 8.35170651 35.5621154 39.1654952
#> 201 NI HE 66.3801883 28.19575987 65.5965569 64.3656109
#> 202 ST HE 53.8113694 19.28684174 52.5095209 50.9048890
#> 203 SN HE 36.7566006 11.67177087 36.4785991 35.4433840
#> 204 SL HE 38.1787426 8.97986855 37.0401619 35.4208937
#> 205 HE HE 80.7985484 55.86372959 80.1195332 79.3503263
#> 206 TH HE 37.7228702 9.06465365 36.3463648 34.8674285
#> 207 BW HE 29.5630026 3.48716368 26.3574629 22.5427277
#> 208 BY HE 27.6304885 2.48594721 26.1497495 23.3146884
#> 209 SH TH 19.8386999 4.78096809 20.0284743 20.6229942
#> 210 HH TH 29.5058199 11.65577664 31.8894554 33.5738372
#> 211 MV TH 42.0413726 17.30172227 41.3225975 40.3990571
#> 212 NW TH 25.1332045 5.86214386 25.9957653 26.5157090
#> 213 HB TH 49.7193521 19.88601311 46.6441672 43.6246023
#> 214 BB TH 54.5830481 26.00158230 57.7135263 60.1013958
#> 215 BE TH 42.2700568 15.91550806 43.0844510 44.0954036
#> 216 RP TH 31.0875598 9.16889669 30.2817124 29.0151283
#> 217 NI TH 66.9399797 30.08171903 67.5022825 67.7048706
#> 218 ST TH 57.7447327 23.34480404 58.9613080 59.7412373
#> 219 SN TH 48.7738184 16.79850215 49.6887945 50.4350513
#> 220 SL TH 32.4706573 9.32998957 31.2874109 29.3647244
#> 221 HE TH 45.8465173 15.81332491 44.1960761 42.6660303
#> 222 TH TH 71.0654413 44.88243287 69.4418945 67.6116326
#> 223 BW TH 31.9614460 5.37312284 27.9141870 23.1801396
#> 224 BY TH 32.5003030 6.54390950 30.6490787 27.4585429
#> 225 SH BW 26.1619952 6.65533055 26.2195488 25.4051288
#> 226 HH BW 36.1207597 13.63284189 37.9051564 39.5045985
#> 227 MV BW 50.4520503 18.53055830 45.0504243 39.6244760
#> 228 NW BW 33.1206830 9.16028023 31.8092147 30.8334791
#> 229 HB BW 50.2640769 22.05654475 51.7607265 53.1520227
#> 230 BB BW 59.8482959 27.12771553 59.6135893 59.3910111
#> 231 BE BW 44.7839799 16.49838132 45.7991604 46.5937999
#> 232 RP BW 37.2513979 13.34233565 37.7111146 38.8286582
#> 233 NI BW 66.1677123 32.71931984 68.0924405 69.5531399
#> 234 ST BW 57.0860880 24.27747088 56.7932772 56.4581065
#> 235 SN BW 46.6029291 17.26409982 46.1957980 45.6608556
#> 236 SL BW 42.9423123 15.03926667 45.1392431 48.1970789
#> 237 HE BW 46.6187224 19.98676387 53.1312301 58.8927503
#> 238 TH BW 45.4592405 15.12405177 46.0212568 46.6453579
#> 239 BW BW 59.2419521 37.37245371 58.7370703 58.6124471
#> 240 BY BW 37.6144094 10.71734846 36.6092050 36.8193662
#> 241 SH BY 24.2232823 6.33451815 24.6482531 25.2819151
#> 242 HH BY 36.6611396 13.24887956 36.2671916 35.3087908
#> 243 MV BY 44.1953308 18.79212240 46.8855409 48.1579354
#> 244 NW BY 32.4136515 7.93688875 31.2785881 29.3928360
#> 245 HB BY 52.8088138 21.56987962 51.5774578 49.9076584
#> 246 BB BY 60.9728329 27.49198243 60.6124862 60.3586853
#> 247 BE BY 49.1836466 17.59937458 46.6625990 43.5917623
#> 248 RP BY 37.1598466 11.72806580 36.5661751 35.9820005
#> 249 NI BY 68.1563045 32.03918833 67.8520529 67.6284680
#> 250 ST BY 59.6373815 24.83520417 59.1232486 58.4924684
#> 251 SN BY 49.9928299 18.75597145 49.2772416 47.8228317
#> 252 SL BY 40.5632144 12.82329701 38.5180404 35.7294293
#> 253 HE BY 53.4507614 18.83956319 52.8097787 51.8503777
#> 254 TH BY 50.4813709 16.14885422 49.1933030 47.0807689
#> 255 BW BY 36.6000497 10.57136425 39.2000900 40.6588545
#> 256 BY BY 59.8385064 37.39603969 60.2497586 60.0175270
plot(spflow_results) # some plots for assessing the model
# MLE methods
logLik(spflow_results) # value of the likelihood function
#> [1] -548.9839
# MLE, OLS and S2SLS methods
varcov(spflow_results) # variance covariance matrix of the estimators
#> rho_d rho_o rho_w (Intercept) (Intra)
#> rho_d 0.0009086574 -1.171459e-04 -0.0006129781 0.02147703 -0.01172771
#> rho_o -0.0001171459 1.368082e-03 -0.0003832369 0.02821303 -0.01669415
#> rho_w -0.0006129781 -3.832369e-04 0.0019625809 0.02782310 0.01641565
#> (Intercept) 0.0214770293 2.821303e-02 0.0278230978 4.67111589 -1.07380256
#> (Intra) -0.0117277073 -1.669415e-02 0.0164156524 -1.07380256 2.34531706
#> D_X -0.0003185996 2.403975e-03 -0.0006536813 0.03998041 -0.01878981
#> D_X.lag1 0.0005358630 9.064063e-04 0.0029819578 0.14016449 -0.01330464
#> O_X -0.0008347485 -2.966763e-04 0.0003416020 -0.04693018 0.02461834
#> O_X.lag1 0.0001175570 -1.661665e-03 -0.0019199727 -0.16095050 0.01739528
#> I_X 0.0001932830 6.065356e-05 -0.0004389804 0.01457882 -0.10706317
#> P_DISTANCE -0.0032790545 -9.210100e-03 -0.0025193738 -0.68102587 0.23098240
#> sigma2 0.0006839084 6.436158e-04 -0.0008072690 0.02927621 -0.01883151
#> D_X D_X.lag1 O_X O_X.lag1
#> rho_d -0.0003185996 0.0005358630 -0.0008347485 0.0001175570
#> rho_o 0.0024039748 0.0009064063 -0.0002966763 -0.0016616647
#> rho_w -0.0006536813 0.0029819578 0.0003416020 -0.0019199727
#> (Intercept) 0.0399804068 0.1401644942 -0.0469301797 -0.1609504982
#> (Intra) -0.0187898147 -0.0133046362 0.0246183380 0.0173952806
#> D_X 0.0047117731 0.0010099393 -0.0003375339 -0.0028026660
#> D_X.lag1 0.0010099393 0.0131443750 -0.0017261178 -0.0074675250
#> O_X -0.0003375339 -0.0017261178 0.0014513353 0.0006614985
#> O_X.lag1 -0.0028026660 -0.0074675250 0.0006614985 0.0085780258
#> I_X -0.0003876059 -0.0005796298 -0.0006125004 0.0003864860
#> P_DISTANCE -0.0144762373 -0.0298811873 0.0088086667 0.0253592314
#> sigma2 0.0010424510 0.0006775221 -0.0008221625 -0.0006364295
#> I_X P_DISTANCE sigma2
#> rho_d 1.932830e-04 -0.003279055 0.0006839084
#> rho_o 6.065356e-05 -0.009210100 0.0006436158
#> rho_w -4.389804e-04 -0.002519374 -0.0008072690
#> (Intercept) 1.457882e-02 -0.681025872 0.0292762150
#> (Intra) -1.070632e-01 0.230982398 -0.0188315100
#> D_X -3.876059e-04 -0.014476237 0.0010424510
#> D_X.lag1 -5.796298e-04 -0.029881187 0.0006775221
#> O_X -6.125004e-04 0.008808667 -0.0008221625
#> O_X.lag1 3.864860e-04 0.025359231 -0.0006364295
#> I_X 6.817460e-03 -0.001442223 0.0002110135
#> P_DISTANCE -1.442223e-03 0.147405322 -0.0071251811
#> sigma2 2.110135e-04 -0.007125181 0.1241087598
# 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)
#> est quant_025 quant_975 sd t.stat
#> rho_d 0.4412606 0.3846987 0.4984196 0.02876601 15.339652
#> (Intercept) 10.5011075 6.8392127 14.2699031 1.90103967 5.523876
#> (Intra) 11.6363307 8.7061345 14.5600127 1.48718766 7.824386
#> D_X 1.0143050 0.9692560 1.0594282 0.02302016 44.061601
#> D_X.lag1 0.7329137 0.5841528 0.8839473 0.07595332 9.649527
#> O_X -0.8052802 -0.8808949 -0.7298320 0.03831536 -21.017165
#> O_X.lag1 -0.4503336 -0.5657120 -0.3325744 0.05938663 -7.583081
#> I_X 1.9481702 1.7885691 2.1126829 0.08435211 23.095691
#> P_DISTANCE -2.8909145 -3.3959727 -2.3718988 0.26064096 -11.091559
#> p.val
#> rho_d 1.016093e-37
#> (Intercept) 8.423279e-08
#> (Intra) 1.506906e-13
#> D_X 1.011488e-118
#> D_X.lag1 6.835659e-19
#> O_X 7.664474e-57
#> O_X.lag1 6.902731e-13
#> I_X 1.532208e-63
#> P_DISTANCE 1.899431e-23
plot(mcmc_results(spflow_results_mcmc)) # parameter values during the mcmc sampling