Package {lacunarity}


Type: Package
Title: Standard and Generalized Lacunarity for Binary Time Series
Version: 0.1.0
Depends: R (≥ 3.0.1)
Description: 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.
License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: zoo, plyr, stats
URL: https://github.com/Ikarobarreto/lacunarity
BugReports: https://github.com/Ikarobarreto/lacunarity/issues
Suggests: rmarkdown, knitr, testthat (≥ 3.0.0)
VignetteBuilder: knitr
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-05-30 15:06:56 UTC; ikaro.barreto
Author: Ikaro Barreto [aut, cre]
Maintainer: Ikaro Barreto <daniel.carvalho.ib@gmail.com>
Repository: CRAN
Date/Publication: 2026-06-03 13:50:14 UTC

lacunarity: lacunarity and generalized lacunarity for binary time series

Description

Estimators of the gliding-box lacunarity index and of the generalized (multifractal-like) lacunarity for one-dimensional binary series. See the package vignette, vignette("lacunarity"), for the underlying theory and worked examples.

Main functions

lac

ordinary lacunarity index \Lambda(s) and its scaling exponent.

genlac

generalized lacunarity \Lambda_q(s) and the spectrum of exponents \gamma(q).

Author(s)

Maintainer: Ikaro Barreto daniel.carvalho.ib@gmail.com

See Also

Useful links:


Generalized lacunarity of a binary series

Description

Computes the generalized (multifractal-like) lacunarity \Lambda_q(s) of a binary time series and the spectrum of scaling exponents \gamma(q).

Usage

genlac(x)

Arguments

x

a binary vector of 0's and 1's.

Details

The ordinary lacunarity is extended to an arbitrary moment order q by

\Lambda_q(s) = \left[ \frac{Z(2q,s)}{Z(q,s)^2} \right]^{1/q},

where Z(q,s) is the q-th moment of the gliding-box mass distribution at scale s. Large positive q emphasises dense boxes and negative q emphasises sparse boxes, so the curve q \mapsto \gamma(q), with \gamma(q) the slope of \log_{10}\Lambda_q(s) on \log_{10} s, describes how gaps of different magnitudes scale. Orders q range over \{-10, \dots, 10\} \setminus \{0\}.

Value

A list with components:

s

the dyadic box scales s = 2^i.

q

the moment orders.

yq

the generalized scaling exponents \gamma(q).

Dqs

the matrix of generalized lacunarities \Lambda_q(s) (rows index q, columns index s).

References

Vernon-Carter, J., Lobato-Calleros, C., Escarela-Perez, R., Rodriguez, E. and Alvarez-Ramirez, J. (2009). A suggested generalization for the lacunarity index. Physica A, 388(20), 4305-4314.

Allain, C. and Cloitre, M. (1991). Characterizing the lacunarity of random and deterministic fractal sets. Physical Review A, 44(6), 3552-3558.

See Also

lac for the ordinary lacunarity index.

Examples

x <- rbinom(1000, 1, 0.85)
genlac(x)

Lacunarity index of a binary series

Description

Computes the gliding-box lacunarity index \Lambda(s) of a binary time series across dyadic scales, together with its scaling exponent.

Usage

lac(x)

Arguments

x

a binary vector of 0's and 1's.

Details

A box of size s is slid one observation at a time along the series and its mass m (the number of ones it covers) is recorded. Writing Z(q,s) for the q-th moment of the resulting box-mass distribution, the lacunarity index is

\Lambda(s) = \frac{Z(2,s)}{Z(1,s)^2} = 1 + \frac{\mathrm{Var}(m)}{\mathrm{mean}(m)^2},

so that \Lambda(s) \ge 1, with equality only for a translationally homogeneous pattern. Larger values indicate gappier, more heterogeneous textures. The scaling exponent y is the slope of \log_2 \Lambda(s) regressed on \log_2 s. Scales are dyadic, s = 2^i, and capped by the longest run of ones.

Value

A list with components:

y

the lacunarity scaling exponent \gamma.

Ds

the lacunarity \Lambda(s) at each scale.

s

the dyadic box scales s = 2^i.

References

Allain, C. and Cloitre, M. (1991). Characterizing the lacunarity of random and deterministic fractal sets. Physical Review A, 44(6), 3552-3558.

Plotnick, R. E., Gardner, R. H., Hargrove, W. W., Prestegaard, K. and Perlmutter, M. (1996). Lacunarity analysis: a general technique for the analysis of spatial patterns. Physical Review E, 53(5), 5461-5468.

See Also

genlac for the generalized lacunarity spectrum.

Examples

x <- rbinom(1000, 1, 0.85)
lac(x)

Moment generating function of the box masses

Description

Internal helper that computes the q-th moment Z(q) = \sum_m m^q\, Q(m) of a box-mass frequency distribution, where Q(m) is the relative frequency of boxes carrying mass m.

Usage

zqs(mat, q)

Arguments

mat

a two-column table with the distinct masses x and their frequencies freq.

q

the moment order.

Value

The q-th moment of the box-mass distribution.