(warning: experimental functionality)
Use the statistics contained in an spflow_model-class()
to efficiently
estimate new models.
spflow_refit(
object,
refit_type = "ar_family",
sample_weights = NULL,
protected_params = "(Intercept)",
keep_data = FALSE
)
A character
A list of lists
A character
A logical, if TRUE
the refitted model retains all data of the original
A list of models
There are three possible ways to refit the model, which can be selected via
the refit_type
argument.
"ar_family" allows to estimate the 9 forms of autocorrelation version
detailed in the docs of spflow_control()
"stepwise" implements a backward selection procedure for the explanatory variables.
"samples" allows to estimate the same model on different sub samples. the interface to this functionality will probably change in future versions.
# fit the most exhaustive model (default)
res <- spflow(y9 ~ . + P_(DISTANCE), multi_net_usa_ge)
# refit the family of 9 models based on different autocorrelation structures
res9_ar <- spflow_refit(res)
compare_results(res9_ar)
#> Model (9) Model (8) Model (7) Model (6) Model (5) Model (4)
#> rho_d 0.497*** 0.483*** 0.425***
#> rho_o 0.333*** 0.342*** 0.287***
#> rho_w -0.227*** -0.165*** 0.247***
#> rho_od 0.357***
#> rho_odw 0.566***
#> (Intercept) 10.198*** 8.301*** 7.092** 16.222*** 27.141*** 30.935***
#> (Intra) 9.871*** 9.696*** 7.943*** 3.174' 0.52 -1.896
#> D_X 0.983*** 0.968*** 1.061*** 1.203*** 1.19*** 1.502***
#> D_X.lag1 0.509*** 0.368*** 0.169' 0.442*** 0.972*** 1.081***
#> I_X 2.035*** 2.049*** 2.086*** 2.142*** 2.154*** 2.167***
#> O_X -0.759*** -0.756*** -0.8*** -1.06*** -1.282*** -1.334***
#> O_X.lag1 -0.367*** -0.263*** -0.149' -0.302** -0.577*** -0.781***
#> P_DISTANCE -2.622*** -2.308*** -2.352*** -4.214*** -6*** -7.227***
#> model_coherence Validated Validated Validated Validated Validated Validated
#> R2_corr 0.992 0.992 0.991 0.987 0.982 0.98
#> ll -548.984 -550.168 -561.218 -619.626 -651.906 -662.03
#> AIC 1121.968 1124.336 1144.437 1259.252 1323.812 1344.061
#> N_sample 256 256 256 256 256 256
#> Model (3) Model (2) Model (1)
#> rho_d 0.474***
#> rho_o 0.394***
#> rho_w
#> rho_od
#> rho_odw
#> (Intercept) 26.203*** 14.778*** 40.341***
#> (Intra) 3.59' 4.893** -1.49
#> D_X 0.809*** 1.566*** 1.491***
#> D_X.lag1 1.095*** 0.51*** 1.734***
#> I_X 2.119*** 2.081*** 2.117***
#> O_X -1.245*** -0.856*** -1.397***
#> O_X.lag1 -0.496*** -0.607*** -1.208***
#> P_DISTANCE -5.072*** -4.542*** -8.653***
#> model_coherence Validated Validated Validated
#> R2_corr 0.983 0.989 0.978
#> ll -641.99 -586.944 -670.117
#> AIC 1303.98 1193.887 1356.235
#> N_sample 256 256 256
# refit based on stepwise selection procedure
res_Xstep <- spflow_refit(res, refit_type = "stepwise")
compare_results(res_Xstep)
#> Drop (0) Drop (1) Drop (2) Drop (3) Drop (4) Drop (5)
#> rho_d 0.497*** 0.491*** 0.509*** 0.568*** 0.531*** 0.395***
#> rho_o 0.333*** 0.403*** 0.387*** 0.49*** 0.494*** 0.798***
#> rho_w -0.227*** -0.143*** -0.105** -0.201*** -0.14*** -0.253***
#> (Intercept) 10.198*** 3.341* 3.352* -0.964 0.252 10.423***
#> (Intra) 9.871*** 10.58*** 10.516*** 14.32***
#> D_X 0.983*** 0.865*** 0.906*** 0.743*** 0.671***
#> D_X.lag1 0.509*** 0.189*
#> I_X 2.035*** 2.052*** 2.059*** 1.999*** 2.794*** 2.825***
#> O_X -0.759*** -0.732*** -0.7*** -0.585*** -0.652*** -0.729***
#> O_X.lag1 -0.367***
#> P_DISTANCE -2.622*** -1.547*** -1.328***
#> model_coherence Validated Validated Validated Validated Validated Validated
#> R2_corr 0.992 0.992 0.992 0.991 0.987 0.982
#> ll -548.984 -556.669 -559.204 -571.951 -613.818 -663.807
#> AIC 1121.968 1135.337 1138.408 1161.902 1243.637 1341.615
#> N_sample 256 256 256 256 256 256
#> Drop (6) Drop (7)
#> rho_d 0.795*** 0.337***
#> rho_o 0.746*** 0.673***
#> rho_w -0.54*** 0.232'
#> (Intercept) -3.054** -9.03***
#> (Intra)
#> D_X
#> D_X.lag1
#> I_X 2.812***
#> O_X
#> O_X.lag1
#> P_DISTANCE
#> model_coherence Unknown Unknown
#> R2_corr 0.958 0.731
#> ll -784.434 -1006.997
#> AIC 1580.868 2023.994
#> N_sample 256 256