Description Usage Arguments Details Value References See Also Examples
Model-based recursive partitioning based on linear regression adjusting for a (global) spatial simultaneous autoregressive lag.
1 2 3 4 |
formula |
formula specifying the response variable and regressors and partitioning variables, respectively. For details see below. |
data |
data.frame to be used for estimating the model tree. |
listw |
a weights object for the spatial lag part of the model. |
method |
"eigen" (default) - the Jacobian is computed as the product
of (1 - rho*eigenvalue) using |
zero.policy |
default NULL, use global option value; if TRUE assign zero to the lagged value of zones without
neighbours, if FALSE (default) assign NA - causing |
interval |
default is NULL, search interval for autoregressive parameter |
control |
list of extra control arguments - see |
rhowystart |
numeric. A vector of length |
abstol |
numeric. The convergence criterion used for estimation of the model.
When the difference in log-likelihoods of the model from two consecutive
iterations is smaller than |
maxit |
numeric. The maximum number of iterations to be performed in estimation of the model tree. |
dfsplit |
logical or numeric. |
verbose |
Should the log-likelihood value of the estimated model be printed for every iteration of the estimation? |
plot |
Should the tree be plotted at every iteration of the estimation? Note that selecting this option slows down execution of the function. |
... |
Additional arguments to be passed to |
Spatial lag trees learn a tree where each terminal node is associated with different regression coefficients while adjusting for a (global) spatial simultaneous autoregressive lag. This allows for detection of subgroup-specific coefficients with respect to selected covariates, while adjusting for spatial correlations in the data. The estimation algorithm iterates between (1) estimation of the tree given an offset of the spatial lag effect, and (2) estimation of the spatial lag model given the tree structure.
The code is still under development and might change in future versions.
The function returns a list with the following objects:
formula |
The formula as specified with the |
call |
the matched call. |
tree |
The final |
lagsarlm |
The final |
data |
The dataset specified with the |
nobs |
Number of observations. |
loglik |
The log-likelihood value of the last iteration. |
df |
Degrees of freedom. |
dfsplit |
degrees of freedom per selected split as specified with the |
iterations |
The number of iterations used to estimate the |
maxit |
The maximum number of iterations specified with the |
rhowystart |
Offset in estimation of the first tree as specified in the |
abstol |
The prespecified value for the change in log-likelihood to evaluate
convergence, as specified with the |
listw |
The |
mob.control |
A list containing control parameters passed to
|
Wagner M, Zeileis A (2019). Heterogeneity and Spatial Dependence of Regional Growth in the EU: A Recursive Partitioning Approach. German Economic Review, 20(1), 67–82. doi: 10.1111/geer.12146 https://eeecon.uibk.ac.at/~zeileis/papers/Wagner+Zeileis-2019.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## data and spatial weights
data("GrowthNUTS2", package = "lagsarlmtree")
data("WeightsNUTS2", package = "lagsarlmtree")
## spatial lag model tree
system.time(tr <- lagsarlmtree(ggdpcap ~ gdpcap0 + shgfcf + shsh + shsm |
gdpcap0 + accessrail + accessroad + capital + regboarder + regcoast + regobj1 + cee + piigs,
data = GrowthNUTS2, listw = WeightsNUTS2$invw,
minsize = 12, alpha = 0.05))
print(tr)
plot(tr, tp_args = list(which = 1))
## query coefficients
coef(tr, model = "tree")
coef(tr, model = "rho")
coef(tr, model = "all")
system.time({
ev <- eigenw(WeightsNUTS2$invw)
tr1 <- lagsarlmtree(ggdpcap ~ gdpcap0 + shgfcf + shsh + shsm |
gdpcap0 + accessrail + accessroad + capital + regboarder + regcoast + regobj1 + cee + piigs,
data = GrowthNUTS2, listw = WeightsNUTS2$invw, method = "eigen",
control = list(pre_eig = ev), minsize = 12, alpha = 0.05)
})
coef(tr1, model = "rho")
|
Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm
Loading required package: spatialreg
Loading required package: spData
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
Loading required package: Matrix
Registered S3 methods overwritten by 'spatialreg':
method from
residuals.stsls spdep
deviance.stsls spdep
coef.stsls spdep
print.stsls spdep
summary.stsls spdep
print.summary.stsls spdep
residuals.gmsar spdep
deviance.gmsar spdep
coef.gmsar spdep
fitted.gmsar spdep
print.gmsar spdep
summary.gmsar spdep
print.summary.gmsar spdep
print.lagmess spdep
summary.lagmess spdep
print.summary.lagmess spdep
residuals.lagmess spdep
deviance.lagmess spdep
coef.lagmess spdep
fitted.lagmess spdep
logLik.lagmess spdep
fitted.SFResult spdep
print.SFResult spdep
fitted.ME_res spdep
print.ME_res spdep
print.lagImpact spdep
plot.lagImpact spdep
summary.lagImpact spdep
HPDinterval.lagImpact spdep
print.summary.lagImpact spdep
print.sarlm spdep
summary.sarlm spdep
residuals.sarlm spdep
deviance.sarlm spdep
coef.sarlm spdep
vcov.sarlm spdep
fitted.sarlm spdep
logLik.sarlm spdep
anova.sarlm spdep
predict.sarlm spdep
print.summary.sarlm spdep
print.sarlm.pred spdep
as.data.frame.sarlm.pred spdep
residuals.spautolm spdep
deviance.spautolm spdep
coef.spautolm spdep
fitted.spautolm spdep
print.spautolm spdep
summary.spautolm spdep
logLik.spautolm spdep
print.summary.spautolm spdep
print.WXImpact spdep
summary.WXImpact spdep
print.summary.WXImpact spdep
predict.SLX spdep
user system elapsed
1.868 0.012 1.926
Spatial lag model tree
Model formula:
ggdpcap ~ gdpcap0 + shgfcf + shsh + shsm | gdpcap0 + accessrail +
accessroad + capital + regboarder + regcoast + regobj1 +
cee + piigs
Fitted party:
[1] root
| [2] capital in no
| | [3] piigs in no: n = 176
| | (Intercept) gdpcap0 shgfcf shsh shsm
| | 0.110545460 -0.011707661 0.002077862 0.021946900 0.001792086
| | [4] piigs in yes
| | | [5] regcoast in no: n = 13
| | | (Intercept) gdpcap0 shgfcf shsh shsm
| | | 0.16061625 -0.01589749 -0.04688569 0.07885805 -0.02344598
| | | [6] regcoast in yes: n = 39
| | | (Intercept) gdpcap0 shgfcf shsh shsm
| | | 0.073481036 -0.011064754 0.091556636 0.116680209 0.009419106
| [7] capital in yes: n = 27
| (Intercept) gdpcap0 shgfcf shsh shsm
| 0.205608579 -0.022342977 -0.007502503 0.041083421 0.052843323
Number of inner nodes: 3
Number of terminal nodes: 4
Number of parameters per node: 5
Objective function (residual sum of squares): 0.01553945
Rho (from lagsarlm model):
rho
0.8373894
(Intercept) gdpcap0 shgfcf shsh shsm
3 0.11054546 -0.01170766 0.002077862 0.02194690 0.001792086
5 0.16061625 -0.01589749 -0.046885688 0.07885805 -0.023445980
6 0.07348104 -0.01106475 0.091556636 0.11668021 0.009419106
7 0.20560858 -0.02234298 -0.007502503 0.04108342 0.052843323
rho
0.8373894
rho .tree3 .tree5 .tree6 .tree7
0.837389353 0.110545460 0.160616252 0.073481036 0.205608579
.tree3:gdpcap0 .tree5:gdpcap0 .tree6:gdpcap0 .tree7:gdpcap0 .tree3:shgfcf
-0.011707661 -0.015897486 -0.011064754 -0.022342977 0.002077862
.tree5:shgfcf .tree6:shgfcf .tree7:shgfcf .tree3:shsh .tree5:shsh
-0.046885688 0.091556636 -0.007502503 0.021946900 0.078858046
.tree6:shsh .tree7:shsh .tree3:shsm .tree5:shsm .tree6:shsm
0.116680209 0.041083421 0.001792086 -0.023445980 0.009419106
.tree7:shsm
0.052843323
user system elapsed
1.829 0.020 1.902
rho
0.8373894
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.