Package {NeuralSTATIS}


Type: Package
Title: Neural Network Enhanced STATIS Methodology for Three-Way Data Analysis
Version: 0.1.0
Description: Combines Autoencoders with the STATIS (Structuring Three-way Arrays in Statistics) methodology for dimensional reduction and visualization of multi-way data (tables x individuals x variables). Methods are based on L'Hermier des Plantes (1976) and Carrera Buri & Galindo-Villardón (2026) https://www.mdpi.com/1999-4893/19/8/637/pdf.
License: GPL-3
Encoding: UTF-8
Imports: dplyr, ggplot2, ggrepel, grid, gridExtra, reticulate, stats
Suggests: gganimate, gifski, testthat (≥ 3.0.0)
URL: https://github.com/fcarrer/NeuralSTATIS
BugReports: https://github.com/fcarrer/NeuralSTATIS/issues
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-09-01 23:20:34 UTC; user
Author: Felix Miguel Carrera Buri [aut, cre]
Maintainer: Felix Miguel Carrera Buri <felix.carrera@xperty.com>
Repository: CRAN
Date/Publication: 2026-09-12 12:30:15 UTC

Construccion de la arquitectura del Autoencoder

Description

Construccion de la arquitectura del Autoencoder

Usage

build_ae_model(p, q, hidden, keras_module)

Matriz de centrado

Description

Matriz de centrado

Usage

center_H(n)

Helper: Algoritmo STATIS Compromiso

Description

Helper: Algoritmo STATIS Compromiso

Cálculo del Compromiso y la Interestructura STATIS

Usage

compute_statis_compromise(Z_list, units_ord, r_axes = 2)

compute_statis_compromise(Z_list, units_ord, r_axes = 2)

Extraccion Latente vía Autoencoder o PCA

Description

Extraccion Latente vía Autoencoder o PCA

Helper: Ajustar Encoder (Keras o Fallback a PCA)

Usage

fit_neural_encoder(
  X_list,
  modo,
  q_latent,
  hidden_units,
  epochs,
  batch_size,
  usar_keras,
  units_ord
)

fit_neural_encoder(
  X_list,
  modo,
  q_latent,
  hidden_units,
  epochs,
  batch_size,
  usar_keras,
  units_ord
)

Matriz Gram

Description

Matriz Gram

Usage

gram(Z)

Neural STATIS: Multivariate Analysis via Autoencoders for Three-Way Data

Description

Neural STATIS: Multivariate Analysis via Autoencoders for Three-Way Data

Usage

neural_statis(
  data,
  col_tablas,
  col_individuos,
  col_variables = NULL,
  usar_keras = TRUE,
  q_latent = 5,
  hidden_units = c(16),
  epochs = 200,
  batch_size = 32,
  seed = 123
)

Arguments

data

A data frame containing multi-way data.

col_tablas

Character. Column name defining the K tables/time points.

col_individuos

Character. Column name defining the N individuals.

col_variables

Character vector (optional). Selected numerical variables.

usar_keras

Logical. Whether to use Keras autoencoder (TRUE) or fall back to PCA (FALSE).

q_latent

Integer. Number of latent dimensions.

hidden_units

Numeric vector. Architecture of hidden layers.

epochs

Integer. Training epochs for the autoencoder.

batch_size

Integer. Batch size for training.

seed

Integer. Random seed for reproducibility.

Value

An object of class neural_statis.

Examples

set.seed(123)
df_test <- data.frame(
  tabla = rep(paste0("T", 1:3), each = 20),
  ind = rep(paste0("I", 1:10), times = 6),
  var1 = rnorm(60),
  var2 = rnorm(60)
)

res <- neural_statis(
  data = df_test,
  col_tablas = "tabla",
  col_individuos = "ind",
  usar_keras = FALSE,
  q_latent = 2
)

Orientación de vectores propios para consistencia de signos

Description

Orientación de vectores propios para consistencia de signos

Usage

orient(v)

Plot Method for Neural STATIS

Description

Draws an integrated diagnostic and analytical dashboard for a fitted neural_statis object, including the autoencoder architecture, training loss curve, compromise eigenvalues, interstructure factor map, correlation circle, and latent macro-trajectories.

Usage

## S3 method for class 'neural_statis'
plot(x, n_clusters = 4, ...)

Arguments

x

An object of class neural_statis.

n_clusters

Integer. Number of clusters for macro-trajectories (default = 4).

...

Additional graphical parameters passed to lower-level plotting functions.

Value

An object of class gtable (or arrangelist) invisibly, representing the combined 2x3 grid dashboard layout. Called primarily for its side effect of drawing the integrated dashboard plot.

Examples

set.seed(123)
df_test <- data.frame(
  tabla = rep(paste0("T", 1:3), each = 20),
  ind = rep(paste0("I", 1:10), times = 6),
  var1 = rnorm(60),
  var2 = rnorm(60)
)

res <- neural_statis(
  data = df_test,
  col_tablas = "tabla",
  col_individuos = "ind",
  usar_keras = FALSE,
  q_latent = 2
)

plot(res)

Helper: Dibujar la Arquitectura del Autoencoder

Description

Helper: Dibujar la Arquitectura del Autoencoder

Usage

plot_ae_architecture(p, hidden, q)

Coeficiente RV (Coseno vectorial entre matrices)

Description

Coeficiente RV (Coseno vectorial entre matrices)

Usage

rv_cos(A, B)