Learn R Programming

spatialreg.hp (version 0.0-1)

plot.spatialreghp: Plot for a spatialreg.hp object

Description

Plot for a spatialreg.hp object

Usage

# S3 method for spatialreghp
plot(x, plot.perc = FALSE, commonality = FALSE, color = NULL, dig = 4, ...)

Value

a ggplot object

Arguments

x

A spatialreg.hp object.

plot.perc

Logical;if TRUE, the bar plot (based on ggplot2 package) of the percentage to individual effects of variables and spatial towards total explained variation, the default is FALSE to show plot with original individual effects.

commonality

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

color

Color of variables.

dig

Integer; number of decimal places in Venn diagram.

...

unused

Author

Jiangshan Lai lai@njfu.edu.cn

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)
plot(spatialreg.hp(COL.lag.eig))
plot(spatialreg.hp(COL.lag.eig,commonality=TRUE),commonality=TRUE)

Run the code above in your browser using DataLab