Package 'SecDim'

Title: The Second Dimension of Spatial Association
Description: Most of the current methods explore spatial association using observations at sample locations, which are defined as the first dimension of spatial association (FDA). The proposed concept of the second dimension of spatial association (SDA), as described in Yongze Song (2022) <doi:10.1016/j.jag.2022.102834>, aims to extract in-depth information about the geographical environment from locations outside sample locations for exploring spatial association.
Authors: Yongze Song [aut, cph] , Wenbo Lv [aut, cre]
Maintainer: Wenbo Lv <[email protected]>
License: GPL-3
Version: 3.2.9000
Built: 2024-10-29 05:16:38 UTC
Source: https://github.com/ausgis/SecDim

Help Index


Spatial grid dataset.

Description

Spatial datasets of explanatory variables at a 500-m resolution.

Usage

grids

Format

grids: A data frame of explanatory variables with 68757 rows and 11 columns.

Author(s)

Yongze Song [email protected]


Generating second-dimension variables for a spatial variable

Description

Generating second-dimension variables for a spatial variable

Usage

gsdvar(
  pointlocation,
  gridlocation,
  gridvar,
  distbuf = seq(1, 10, 1),
  quantileprob = seq(0, 1, 0.1)
)

Arguments

pointlocation

A matrix or data frame of point locations

gridlocation

A matrix or data frame of grid locations

gridvar

A matrix or data frame of grid variables

distbuf

A vector of distance buffer values

quantileprob

A vector of quantile probability values

Value

A data frame containing the selected variables for the second dimension

Examples

data(obs)
data(grids)
pointlocation <- obs[sample(nrow(obs), 20), c("Lon", "Lat")]
gridlocation <- grids[, c("Lon", "Lat")]
gridvar <- grids$Elevation
system.time({
sdavars <- gsdvar(pointlocation, gridlocation, gridvar,
                  distbuf = c(1, 2, 3), quantileprob = c(0, 0.5, 1))
})

Spatial datasets of trace elements.

Description

Spatial datasets of trace elements.

Usage

obs

Format

obs: A data frame of trace elements with 614 rows and 5 variables

Author(s)

Yongze Song [email protected]


Removing outliers.

Description

Function for removing outliers.

Usage

rmvoutlier(x, coef = 2.5)

Arguments

x

A vector of a variable

coef

A number of the times of standard deviation. The default value is 2.5.

Value

Location of outliers in the vector

Examples

data("obs")
obs$Cr_ppm <- log(obs$Cr_ppm)
krm <- rmvoutlier(obs$Cr_ppm)
krm

Spatial datasets of the first dimension variables of trace elements.

Description

Spatial datasets of the first dimension variables of trace elements.

Usage

sample_vars_fda

Format

sample_vars_fda: A list with 8 elements

Author(s)

Yongze Song [email protected]


Spatial datasets of the second dimension variables of trace elements.

Description

Spatial datasets of the second dimension variables of trace elements.

Usage

sample_vars_sda

Format

sample_vars_sda: A list with 8 elements

Author(s)

Yongze Song [email protected]


Preparing explanatory variables data for SDA-based prediction

Description

Function for preparing explanatory variables data for SDA-based prediction or the testing data for cross validation

Usage

sdapredvars(xlist)

Arguments

xlist

A list of the SDA explanatory variables

Value

A data.frame of variables for prediction or validation

Examples

data("obs")
data("sample_vars_sda")
obs$Cr_ppm <- log(obs$Cr_ppm)
krm <- rmvoutlier(obs$Cr_ppm)
y <- obs$Cr_ppm[-krm]
x <- list(sample_vars_sda[[1]][-krm, 1:11])
kvalidate <- sample(length(y), 0.3*length(y), replace = FALSE)
yv <- y[kvalidate]
xv <- lapply(x, function(x) x[kvalidate,])
sdaxv <- sdapredvars(xv)
sdayxv <- cbind(yv, sdaxv)

Selecting variables using linear regression

Description

Function for selecting variables using linear regression

Usage

selectvarlm(y, x, ctr.vif = 10)

Arguments

y

A vector of a response variable

x

A data.frame of explanatory variables

ctr.vif

A number of VIF threshold

Value

A data.frame of selected variables

Examples

data("obs")
data("sample_vars_sda")
obs$Cr_ppm <- log(obs$Cr_ppm)
krm <- rmvoutlier(obs$Cr_ppm)
y <- obs$Cr_ppm[-krm]
x <- sample_vars_sda$Elevation[-krm, 1:11]
sx <- selectvarlm(y, x)

Selecting variables for the SDA model

Description

Function for selecting variables for the second dimension of spatial association (SDA) model

Usage

selectvarsda(y, xlist)

Arguments

y

A vector of a response variable

xlist

A list of the SDA explanatory variables

Value

A list of the selected the second dimension variables

Examples

data("obs")
data("sample_vars_sda")
obs$Cr_ppm <- log(obs$Cr_ppm)
krm <- rmvoutlier(obs$Cr_ppm)
y <- obs$Cr_ppm[-krm]
x <- list(sample_vars_sda[[1]][-krm, 1:11])
system.time({ # ~0.01s
  sx <- selectvarsda(y, xlist = x)
})

Fast calculation of the variance inflation factor (VIF)

Description

Function for fast calculation of the variance inflation factor (VIF)

Usage

vif(x)

Arguments

x

A data.frame of explanatory variables

Value

Variance inflation factor (VIF) values of variables

Examples

data("sample_vars_sda")
x <- sample_vars_sda$Elevation[, sample(55, 10)]
vif(x)