Learn R Programming

spatialreg.hp (version 0.0-1)

spatialreg.hp: Hierarchical Partitioning of R2 for Spatial Simultaneous Autoregressive Model

Description

Hierarchical Partitioning of R2 for Spatial Simultaneous Autoregressive Model

Usage

spatialreg.hp(mod, iv = NULL, commonality = FALSE)

Value

Total.R2

The R2 for the full model.

commonality.analysis

If commonality=TRUE, a matrix containing the value and percentage of all commonality (2^N-1 for N predictors or matrices).

Individual.R2

A matrix containing individual effects and percentage of individual effects for spatial and each predictor

Arguments

mod

Fitted spatialreg objects.

iv

optional The relative importance of predictor groups will be assessed. The input for iv should be a list, where each element contains the names of variables belonging to a specific group. These variable names must correspond to the predictor variables defined in the model (mod).

commonality

Logical; If TRUE, the result of commonality analysis is shown, the default is FALSE.

Author

Jiangshan Lai lai@njfu.edu.cn

Details

This function conducts hierarchical partitioning to calculate the individual contributions of spatial and each predictor towards total R2 from spatialreg package for spatial simultaneous autoregressive model.

References

  • Lai J.,Zhu W., Cui D.,Mao L.(2023)Extension of the glmm.hp package to Zero-Inflated generalized linear mixed models and multiple regression.Journal of Plant Ecology,16(6):rtad038<DOI:10.1093/jpe/rtad038>

  • Lai J.,Zou Y., Zhang S.,Zhang X.,Mao L.(2022)glmm.hp: an R package for computing individual effect of predictors in generalized linear mixed models.Journal of Plant Ecology,15(6):1302-1307<DOI:10.1093/jpe/rtac096>

  • Lai J.,Zou Y., Zhang J.,Peres-Neto P.(2022) Generalizing hierarchical and variation partitioning in multiple regression and canonical analyses using the rdacca.hp R package.Methods in Ecology and Evolution,13(4):782-788<DOI:10.1111/2041-210X.13800>

  • Chevan, A. & Sutherland, M. (1991). Hierarchical partitioning. American Statistician, 45, 90-96. doi:10.1080/00031305.1991.10475776

  • Nimon, K., Oswald, F.L. & Roberts, J.K. (2013). Yhat: Interpreting regression effects. R package version 2.0.0.

  • Nimon, Ho, L. S. T. and Ane, C. 2014. "A linear-time algorithm for Gaussian and non-Gaussian trait evolution models". Systematic Biology 63(3):397-408.

Examples

Run this code
library(spatialreg)
library(spdep)
data(oldcol, package="spdep")
listw <- spdep::nb2listw(COL.nb, style="W")
ev <- eigenw(listw)
W <- as(listw, "CsparseMatrix")
trMatc <- trW(W, type="mult")
COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, listw=listw,
method="eigen", control=list(pre_eig=ev, OrdVsign=1))
spatialreg.hp(COL.lag.eig)
spatialreg.hp(COL.lag.eig,iv=list(pre1="INC",pre2="HOVAL"))
spatialreg.hp(COL.lag.eig,iv=list(pre1="INC",pre2="HOVAL"),commonality=TRUE)
COL.errW.eig <- errorsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
listw, control=list(pre_eig=ev))
spatialreg.hp(COL.errW.eig)
spatialreg.hp(COL.errW.eig,iv=list(pre1="INC",pre2="HOVAL"))
spatialreg.hp(COL.errW.eig,iv=list(pre1="INC",pre2="HOVAL"),commonality=TRUE)

Run the code above in your browser using DataLab