Definitions

The tabula package provides a set of S4 classes for archaeological data matrices that extend the basic matrix data type. These new classes represent different special types of matrix.

  • Numeric matrix:
    • CountMatrix represents count data,
    • FrequencyMatrix represents relative frequency data.
    • OccurrenceMatrix represents a co-occurrence matrix.
    • SimilarityMatrix represents a (dis)similarity matrix.
  • Logical matrix:
    • IncidenceMatrix represents presence/absence data.

It assumes that you keep your data tidy: each variable (taxon/type) must be saved in its own column and each observation (assemblage/sample/case) must be saved in its own row. Note that missing values are not allowed.

Methods for a variety of functions applied to objects from these classes provide tools for analysis, seriation and dating of archaeological assemblages. See help(methods) to list all available methods for these classes.

The internal structure of S4 classes implemented in tabula is depicted in the UML class diagram in the following figure.

UML class diagram of the S4 classes structure.

UML class diagram of the S4 classes structure.

Numeric matrix

Count matrix

We denote the \(m \times p\) count matrix by \(A = \left[ a_{ij} \right] ~\forall i \in \left[ 1,m \right], j \in \left[ 1,p \right]\) with row and column sums:

Frequency matrix

A frequency matrix represents relative abundances.

We denote the \(m \times p\) frequency matrix by \(B = \left[ b_{ij} \right] ~\forall i \in \left[ 1,m \right], j \in \left[ 1,p \right]\) with row and column sums:

Co-occurrence matrix

A co-occurrence matrix is a symmetric matrix with zeros on its main diagonal, which works out how many times (expressed in percent) each pairs of taxa occur together in at least one sample.

The \(p \times p\) co-occurrence matrix \(D = \left[ d_{i,j} \right] ~\forall i,j \in \left[ 1,p \right]\) is defined over an \(m \times p\) abundance matrix \(A = \left[ a_{x,y} \right] ~\forall x \in \left[ 1,m \right], y \in \left[ 1,p \right]\) as:

\[ d_{i,j} = \sum_{x = 1}^{m} \bigcap_{y = i}^{j} a_{xy} \]

with row and column sums:

Logical matrix

Incidence matrix

We denote the \(m \times p\) incidence matrix by \(C = \left[ c_{ij} \right] ~\forall i \in \left[ 1,m \right], j \in \left[ 1,p \right]\) with row and column sums:

Usage

# Load packages
library(tabula)
library(magrittr)

Create

These new classes are of simple use, on the same way as the base matrix:

Note that a FrequencyMatrix can only be created by coercion (see below).

Visualization

Several types of graphs are available in tabula which uses ggplot2 for plotting informations. This makes it easy to customize diagrams (e.g. using themes and scales).

Spot plot

Spot matrix allows direct examination of data (above/below some threshold):

Spot plot

Spot plot

Spot plot of co-occurrence

Spot plot of co-occurrence

Heatmap

Abundance matrix can be displayed as a heatmap of relative abundances (frequency), or as percentages of the independence value (in french, “pourcentages de valeur d’indépendance”, PVI).

Heatmap

Heatmap

PVI is calculated for each cell as the percentage to the column theoretical independence value: PVI greater than \(1\) represent positive deviations from the independence, whereas PVI smaller than \(1\) represent negative deviations (Desachy 2004). The PVI matrix allows to explore deviations from independence (an intuitive graphical approach to \(\chi^2\)), in such a way that a high-contrast matrix has quite significant deviations, with a low risk of being due to randomness (Desachy 2004).

Matrigraphe

Matrigraphe

Bar plot

Bertin (1977) or Ford (1962) (battleship curve) diagrams can also be plotted, with statistic threshold.

Bertin diagram

Bertin diagram

Ford diagram

Ford diagram

References

Bertin, Jacques. 1977. La graphique et le traitement graphique de l’information. Nouvelle Bibliothèque Scientifique. Paris: Flammarion.

Desachy, Bruno. 2004. “Le sériographe EPPM : un outil informatisé de sériation graphique pour tableaux de comptages.” Revue archéologique de Picardie 3 (1): 39–56. https://doi.org/10.3406/pica.2004.2396.

Ford, J. A. 1962. A Quantitative Method for Deriving Cultural Chronology. Technical Manual 1. Washington, DC: Pan American Union.