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
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 |
n |
is either the set of nodes for |
Details
In case of regs
, all the regions are ploted.
Value
plot object
See Also
Regions class
Description
Regions class
Usage
regs
Format
An object of class regs
of length 0.
Details
The regs
class contains:
A summary
data.table
which updates thesomsp
object with the region ids of all classification schemes up tonregions
. Each different classification scheme is stored as an individual region, e.g.regions.2
,regions.3
, etc.A
data.table
with the original data set, as insomsp
.
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
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 |
Details
x
should be in tidy format
with four columns: time, latitude, longitude and variable.
Value
A sominp
object. It contains:
a
matrix
that can be used as input for thesom
function of thekohonen package
.a
data.table
with the with spatial point coordinates and a corresponding id.a
data.table
with the original dataset.
See Also
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 |
nregions |
The maximum number of classifications schemes to be determined starting from 2. |
... |
Other arguments passed to methods from |
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:
A summary
data.table
which updates thesomsp
object with the region ids of all classification schemes up tonregions
. Each different classification scheme is stored as an individual region, e.g.,regions.2
,regions.3
, etc. to their corresponding winning unit, the number of points of each node, as well as the median latitude and longitude of each node coordinates and their standard deviation.The original time series which created the SOM as a
data.table
, as insomsp
.
See Also
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:
A summary
data.table
with the coordinates of each SOM node, the distances of objects to their corresponding winning unit, the number of points of each node, as well as the median latitude and longitude of each node coordinates and their standard deviation.A Self-Organizing Map object (see also
kohonen
).The
sominp
object used as input for the SOM, with an id number coressponding to location and a node number to the classification group of SOM.
They can be plotted by plot
and plot_ts
functions or summarized by summary
.
See Also
Spatial SOM
Description
somspa
creates a Self-Organizing Map from spatial data.
Usage
somspa(x, ...)
Arguments
x |
A |
... |
Other arguments passed to methods from |
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:
A summary
data.table
with the coordinates of each SOM node, the distances of objects to their corresponding winning unit, the number of points of each node, as well as the median latitude and longitude of each node coordinates and their standard deviation.A Self-Organizing Map object (see also
kohonen
).The
sominp
object used as input for the SOM, with an id number coressponding to location and a node number to the classification group of SOM.
See Also
som
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