MyNixOS website logo
Description

Ising Model for Spatial Data.

Performs simulations of binary spatial raster data using the Ising model (Ising (1925) <doi:10.1007/BF02980577>; Onsager (1944) <doi:10.1103/PhysRev.65.117>). It allows to set a few parameters that represent internal and external pressures, and the number of simulations (Stepinski and Nowosad (2023) <doi:10.1098/rsos.231005>).

spatialising

Codecov testcoverage Lifecycle:experimental R-CMD-check

The goal of spatialising is to perform simulations of binary spatial raster data using the Ising model.

Installation

You can install the development version of spatialising from GitHub with:

# install.packages("devtools")
devtools::install_github("Nowosad/spatialising")

Example

The spatialising package expects raster data with just two values, -1 and 1. Here, we will use the r_start.tif file built in the package.

library(spatialising)
library(terra)
r1 = rast(system.file("raster/r_start.tif", package = "spatialising"))
plot(r1)

Most of the raster area is covered with the value of 1, and just about 5% of the area is covered with the value of -1. The main function in this package is kinetic_ising(). It accepts the input raster and at least two additional parameters: B – representing external pressure and J – representing the strength of the local autocorrelation tendency. The output is a raster modified based on the provided parameters.

r2 = kinetic_ising(r1, B = -0.3, J = 0.7)
plot(r2)

The kinetic_ising() function also has a fourth argument called updates. By default, it equals to 1, returning just one raster as the output. However, when given a value larger than one, it returns many rasters. Each new raster is the next iteration of the Ising model of the previous one.

ri1 = kinetic_ising(r1, B = -0.3, J = 0.7, updates = 3)
plot(ri1, nr = 1)

Obtained results depend greatly on the set values of B and J. In the example above, values of B = -0.3 and J = 0.7 resulted in expansion of the yellow category (more -1 values).

On the other hand, values of B = 0.3 and J = 0.7 give a somewhat opposite result with less cell with the yellow category:

ri2 = kinetic_ising(r1, B = 0.3, J = 0.7, updates = 3)
plot(ri2, nr = 1)

Finally, in the last example, we set values of B = -0.3 and J = 0.4. Note that the result shows much more prominent data change, with a predominance of the yellow category only after a few updates.

ri3 = kinetic_ising(r1, B = -0.3, J = 0.4, updates = 3)
plot(ri3, nr = 1)

Documentation

Read the related article:

  1. Stepinski, T. F. & Nowosad, J. (2023). The kinetic Ising model encapsulates essential dynamics of land pattern change, Royal Society Open Science, https://doi.org/10.1098/rsos.231005

Contribution

Contributions to this package are welcome - let us know if you have any suggestions or spotted a bug. The preferred method of contribution is through a GitHub pull request. Feel also free to contact us by creating an issue.

Metadata

Version

0.6.0

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows