Software
PART I. Spatial Stratified Heterogeneity Models
GD package: Spatial Heterogeneity Analysis: Spatial Data Discretization and Geographical Detectors
Example:
## install and library the pacakge
install.packages("GD")
library("GD")
## NDVI: ndvi_40
## set optional parameters of optimal discretization
## optional methods: equal, natural, quantile, geometric, sd and manual
discmethod <- c("equal","natural","quantile")
discitv <- c(4:6)
## "gdm" function
## In this case, Climatezone and Mining are categorical variables,
## and Tempchange and GDP are continuous variables.
ndvigdm <- gdm(NDVIchange ~ Climatezone + Mining + Tempchange + GDP,
continuous_variable = c("Tempchange", "GDP"),
data = ndvi_40,
discmethod = discmethod, discitv = discitv) # ~3s
ndvigdm
plot(ndvigdm)
IDSA package: Interactive Detector for Spatial Associations
Example:
## install and library the pacakge
install.packages("IDSA")
library("IDSA")
data(sim)
idsa.ab <- idsa(y ~ xa + xb, location = c("la", "lo"), data = sim, c(4, 4),
methoddisc = "quantile", methodoverlay = "fuzzyAND")
idsa.ab$qs.y # PID
idsa.ab$qs.interaction # adjusted PID
# zonal comparison between zones
install.packages("GD")
library("GD")
zonalcomparison <- gdrisk(y ~ overlay, data = idsa.ab$data)
plot(zonalcomparison)
PART II. Spatial Line Segment Models
HS package: Homogenous Segmentation for Spatial Lines Data
Example:
## install and library the pacakge
install.packages("HS")
library("HS")
data(tsdwa)
testdata <- tsdwa[1:300,]
testdata$length <- testdata$SLK.end - testdata$SLK.start
# SHS model for the honogenous segmentation using multiple variables
testdata <- shs(var = c("Curvature", "Deflection"), length = "length",
testdata, range = c(0.1, 0.5))
# visualisation
segplot(start = "SLK.start", var = c("Curvature", "Deflection"),
seg.id = "seg.id", testdata, plot.range = 1:300)
SK package: Segment-Based Ordinary Kriging and Segment-Based Regression Kriging for Spatial Prediction
PART III. Carbon Emissions and Energy
EDA package: Energy decomposition analysis for measuring factors of energy or carbon emission changes
Example:
## install and library the pacakge
install.packages("EDA")
library("EDA")
data(carbon)
data(factordata)
## set parameters
cdata <- carbon[,-c(1,2)]
years <- carbon$year
Sector <- c("b1", "b2", "b3")
Fuel <- colnames(cdata)
Factor <- names(factordata)
## run EDA model using the LMDI method
eda1 <- EDA(cdata, factordata, years = years, Factor = Factor,
Fuel = Fuel, Sector = Sector, method = "LMDI")
eda1
plot(eda1)