Title: | Spatial Analysis with Self-Organizing Maps |
---|---|
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>). |
Authors: | Yannis Markonis [aut, cre], Filip Strnad [aut], Simon Michael Papalexiou [aut], Mijael Rodrigo Vargas Godoy [ctb] |
Maintainer: | Yannis Markonis <[email protected]> |
License: | GPL-3 |
Version: | 1.2.4 |
Built: | 2025-02-20 03:59:39 UTC |
Source: | https://github.com/cran/somspace |
cnet
plots the canonical network map of a single classification scheme.
cnet(x, n, thres)
cnet(x, n, thres)
x |
regs object. |
n |
number of regions. |
thres |
the cross-correlation threshold of the network. |
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.
plot object
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)
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)
Reconstruction of European hydroclimate derived from tree-rings. The variable used is self-calibrated Palmer Drought Severity Index (scPDSI) at annual time step.
data(owda)
data(owda)
An object of class data.table
(inherits from data.frame
) with 1355264 rows and 4 columns.
Markonis et al. (2018) Nature Communications 9(1):1767 (Nature Springer)
str(owda)
str(owda)
Plots the time series of SOM nodes or regions mean
plot_ts(x, n)
plot_ts(x, n)
x |
is either a |
n |
is either the set of nodes for |
In case of regs
, all the regions are ploted.
plot object
Regions class
regs
regs
An object of class regs
of length 0.
The regs
class contains:
A summary data.table
which updates the somsp
object with the region ids of all classification schemes
up to nregions
. 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 in somsp
.
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.
sominp
transforms the data set from data.table
to
somsp
format, which can be used as argument in the somspa
function.
sominp(x)
sominp(x)
x |
The |
x
should be in tidy format
with four columns: time, latitude, longitude and variable.
A sominp
object. It contains:
a matrix
that can be used as input for the som
function of
the kohonen package
.
a data.table
with the with spatial point coordinates and a corresponding id.
a data.table
with the original dataset.
dummy <- owda[Time <= 1510] inp_som <- sominp(dummy)
dummy <- owda[Time <= 1510] inp_som <- sominp(dummy)
somregs
applies hierarchical cluster analysis to the Self-Organizing Map
to form regions with homogeneous characteristics (classification scheme).
somregs(x, nregions, ...)
somregs(x, nregions, ...)
x |
A |
nregions |
The maximum number of classifications schemes to be determined starting from 2. |
... |
Other arguments passed to methods from |
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.
A regs
object, which contains:
A summary data.table
which updates the somsp
object with the region ids of all classification schemes
up to nregions
. 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 in somsp
.
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)
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
somsp
somsp
An object of class somsp
of length 0.
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
.
somspa
creates a Self-Organizing Map from spatial data.
somspa(x, ...)
somspa(x, ...)
x |
A |
... |
Other arguments passed to methods from |
x
should be created by sominp
.
The output somsp
objects can be plotted by plot
and plot_ts
functions or summarized by summary
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.
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
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