additiveMatrix: Generate an additive approximation of a data matrix

View source: R/additiveMatrix.R

additiveMatrixR Documentation

Generate an additive approximation of a data matrix

Description

Constructs a matrix with an additive structure based on the row means, column means, and the grand mean of the original matrix.

Usage

additiveMatrix(mat)

Arguments

mat

A numeric matrix or data frame with numeric entries.

Details

The result is an approximation A of the original matrix, where:

A[i,j] = rowMean[i] + colMean[j] - grandMean

This model captures main additive effects of rows and columns, commonly used in exploratory data analysis or baseline modeling.

Value

A numeric matrix of the same dimension as mat, approximating it using an additive model.

Examples

m <- matrix(c(1, 2, 3, 4), nrow = 2)
additiveMatrix(m)


SIMPLICA documentation built on Sept. 11, 2025, 1:08 a.m.