Type: Package
Title: Spatial Analysis with Self-Organizing Maps
Version: 1.2.4
Description: Application of the Self-Organizing Maps technique for spatial classification of time series. The package uses spatial data, point or gridded, to create clusters with similar characteristics. The clusters can be further refined to a smaller number of regions by hierarchical clustering and their spatial dependencies can be presented as complex networks. Thus, meaningful maps can be created, representing the regional heterogeneity of a single variable. More information and an example of implementation can be found in Markonis and Strnad (2020, <doi:10.1177/0959683620913924>).
License: GPL-3
Depends: R (≥ 3.5.0), ggplot2, data.table, kohonen
Imports: maps, reshape2
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
Suggests: knitr, rmarkdown, testthat
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2023-04-27 07:44:00 UTC; mirovago
Author: Yannis Markonis [aut, cre], Filip Strnad [aut], Simon Michael Papalexiou [aut], Mijael Rodrigo Vargas Godoy [ctb]
Maintainer: Yannis Markonis <imarkonis@gmail.com>
Repository: CRAN
Date/Publication: 2023-04-28 17:40:02 UTC

Complex network analysis

Description

cnet plots the canonical network map of a single classification scheme.

Usage

cnet(x, n, thres)

Arguments

x

regs object.

n

number of regions.

thres

the cross-correlation threshold of the network.

Details

The cnet function estimates the cross-correlation matrix of the average time series of each region and plots a map linking the regions with cross-correlations above the selected threshold.

Value

plot object

Examples


dummy <- owda[Time <= 1600]
inp_som <- sominp(dummy)
my_som <- somspa(inp_som, rlen = 100, grid = somgrid(3, 3, "hexagonal"))
my_regions <- somregs(my_som, nregions = 6) 
cnet(my_regions, n = 5, thres = 0.2)

Old World Drought Atlas (1500-2012)

Description

Reconstruction of European hydroclimate derived from tree-rings. The variable used is self-calibrated Palmer Drought Severity Index (scPDSI) at annual time step.

Usage

data(owda)

Format

An object of class data.table (inherits from data.frame) with 1355264 rows and 4 columns.

Source

FZP archive

References

Markonis et al. (2018) Nature Communications 9(1):1767 (Nature Springer)

Examples

str(owda)

Plot time series

Description

Plots the time series of SOM nodes or regions mean

Usage

plot_ts(x, n)

Arguments

x

is either a somsp or a regs object

n

is either the set of nodes for somsp or the number of regions for regs

Details

In case of regs, all the regions are ploted.

Value

plot object

See Also

somspa


Regions class

Description

Regions class

Usage

regs

Format

An object of class regs of length 0.

Details

The regs class contains:

It can be plotted by plot and plot_ts. If plot is used, three additional arguments are needed; a set with the classification schemes that will be ploted, number of rows and number of columns of the plotted panels. plot_ts plots all the time series of a given classification scheme.

See Also

somsp

somregs


Create sominp object

Description

sominp transforms the data set from data.table to somsp format, which can be used as argument in the somspa function.

Usage

sominp(x)

Arguments

x

The data.table object which will be tranformed to somsp object.

Details

x should be in tidy format with four columns: time, latitude, longitude and variable.

Value

A sominp object. It contains:

See Also

somspa

Examples




dummy <- owda[Time <= 1510]
inp_som <- sominp(dummy)


Classify SOM into regions

Description

somregs applies hierarchical cluster analysis to the Self-Organizing Map to form regions with homogeneous characteristics (classification scheme).

Usage

somregs(x, nregions, ...)

Arguments

x

A somsp object.

nregions

The maximum number of classifications schemes to be determined starting from 2.

...

Other arguments passed to methods from hclust function which is used to determine the regions.

Details

nregions must be at least two, i.e., a classification scheme with two regions, and smaller than the number of SOM nodes. In the latter case, each SOM node corresponds to a region. The resulting regs object can be plotted by plot and plot_ts. If plot is used, three additional arguments are needed; a set with the classification schemes that will be ploted, number of rows and number of columns of the plotted panels. plot_ts plots all the time series of a given classification scheme.

Value

A regs object, which contains:

See Also

somsp

somspa

Examples


dummy <- owda[Time <= 1600]
inp_som <- sominp(dummy)
my_som <- somspa(inp_som, rlen = 100, grid = somgrid(4, 4, "hexagonal"))
my_regions <- somregs(my_som, nregions = 9) 
plot(my_regions, regions = c(2, 4, 6, 8), nrow = 2, ncol = 2) 
plot_ts(my_regions, n = 4)


Spatial SOM class

Description

Spatial SOM class

Usage

somsp

Format

An object of class somsp of length 0.

Details

The somsp objects are created by somspa function and contain:

They can be plotted by plot and plot_ts functions or summarized by summary.

See Also

somspa

plot_ts


Spatial SOM

Description

somspa creates a Self-Organizing Map from spatial data.

Usage

somspa(x, ...)

Arguments

x

A sominp object.

...

Other arguments passed to methods from kohonen::som function which is used to create the SOM.

Details

x should be created by sominp. The output somsp objects can be plotted by plot and plot_ts functions or summarized by summary

Value

A somsp object, which contains:

See Also

som

sominp

Examples


dummy <- owda[Time <= 1600] #toy example
inp_som <- sominp(dummy)

my_som <- somspa(inp_som, rlen = 100, grid = somgrid(3, 3, "hexagonal"))
my_som$summary
my_som$som

plot(my_som)
plot_ts(my_som, n = 3)
plot_ts(my_som, n = c(1, 2, 4, 9)) 
plot_ts(my_som, n = 1:max(my_som$summary$node)) #plots all soms