flipLoadings: Sign flip the loadings of many randomly initialized models to...

View source: R/utils.R

flipLoadingsR Documentation

Sign flip the loadings of many randomly initialized models to make consistent overview plots.

Description

Sign flip the loadings of many randomly initialized models to make consistent overview plots.

Usage

flipLoadings(models, X)

Arguments

models

Output of parafac.

X

Input dataset of parafac modelling procedure.

Value

models with sign flipped components where applicable.

Examples

A = array(rnorm(108*2), c(108,2))
B = array(rnorm(100*2), c(100,2))
C = array(rnorm(10*2), c(10,2))
X = reinflateTensor(A, B, C)
models = parafac(X, 2, nstart=10, output="all", sortComponents=TRUE)
flippedModels = flipLoadings(models, X)

parafac4microbiome documentation built on June 8, 2025, 11:40 a.m.