MyNixOS website logo
Description

Standard and Generalized Lacunarity for Binary Time Series.

Estimates lacunarity and generalized lacunarity for unidimensional binary time series. The lacunarity index summarizes the similarity of parts from different regions of a series at a given scale by averaging the behavior of variable size structures of zeros and ones. The generalized lacunarity concept provides an enhanced measure of the organization of the gaps over all measured scales and over the different arrangements of smaller and larger gaps in the series.

lacunarity

lacunarity estimates the lacunarity and the generalized lacunarity of unidimensional binary time series. Lacunarity is a scale-dependent measure of translational heterogeneity: it describes how the gaps of a pattern are distributed, and — unlike density alone — it tells apart series that are clustered from series that are evenly spread.

Methodology

For a sliding box of size $s$, the box mass $m$ is the number of ones it covers. From the distribution of box masses, the lacunarity index is

$$\Lambda(s) = \frac{\langle m^2 \rangle}{\langle m \rangle^2} = 1 + \frac{\mathrm{Var}(m)}{\langle m \rangle^2} \ge 1,$$

so $\Lambda(s) = 1$ means a perfectly homogeneous pattern and larger values mean gappier, more heterogeneous textures. The generalized lacunarity $\Lambda_q(s) = \left(Z_{2q}(s)/Z_q(s)^2\right)^{1/q}$ extends this to an arbitrary moment order $q$, yielding a spectrum of scaling exponents $\gamma(q)$. See vignette("lacunarity") for the full theory and references (Allain & Cloitre, 1991; Vernon-Carter et al., 2009).

Installation

You can install the released version from CRAN with:

install.packages("lacunarity")

and the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("Ikarobarreto/lacunarity")

Example

lac() returns the lacunarity scaling exponent y, the lacunarities Ds at each scale and the box scales s:

library(lacunarity)

x <- rbinom(1200, size = 1, prob = 0.8)
lac(x)
#> $y
#> [1] 0.01408786
#> 
#> $Ds
#> [1] 1.129157 1.068018 1.040669 1.024022 1.013987
#> 
#> $s
#>      [,1]
#> [1,]    2
#> [2,]    4
#> [3,]    8
#> [4,]   16
#> [5,]   32

Lacunarity captures texture, not just density. The series z (blocks of ones and zeros) and w (a random shuffle of z) have the same number of ones, yet very different lacunarities:

z <- c(rep(c(rep(1, 8), rep(0, 8)), 25), rep(c(rep(1, 16), rep(0, 16)), 25))
w <- sample(z)

c(density_z = mean(z), density_w = mean(w))      # identical density
#> density_z density_w 
#>       0.5       0.5
c(lac_z = lac(z)$y, lac_w = lac(w)$y)            # different lacunarity
#>     lac_z     lac_w 
#> 0.1908516 0.1142697

genlac() returns the generalized lacunarity; its scaling spectrum yq over the moment orders q summarises how small and large gaps scale:

g <- genlac(x)
round(g$yq, 3)
#>  [1] -0.148 -0.157 -0.166 -0.176 -0.185 -0.192 -0.191 -0.162 -0.092 -0.029
#> [11]  0.014  0.020  0.023  0.025  0.027  0.027  0.028  0.028  0.028  0.028

See vignette("lacunarity") for plots and a full walkthrough.

Metadata

Version

0.1.0

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • 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-linux
  • 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
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • 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-uefi
  • x86_64-windows