rgcca_transform: Reduce dimensionality using RGCCA

View source: R/rgcca_transform.R

rgcca_transformR Documentation

Reduce dimensionality using RGCCA

Description

This function projects testing blocks using the block weight vectors of a fitted RGCCA object.

Usage

rgcca_transform(rgcca_res, blocks_test = rgcca_res$call$blocks)

Arguments

rgcca_res

A fitted RGCCA object (see rgcca).

blocks_test

A list of blocks (data.frame or matrix) to be projected.

Value

A list of matrices containing the projections of the test blocks using the block weight vectors of a fitted RGCCA object.

Examples

data("Russett")
blocks <- list(
  agriculture = Russett[, 1:3],
  industry = Russett[, 4:5],
  politic = Russett[, 6:11])

Xtrain <- lapply(blocks, function(x) x[1:32, ])
Xtest <- lapply(blocks, function(x) x[33:47, ])
fit_rgcca <- rgcca(Xtrain, ncomp = 2)
projection <- rgcca_transform(fit_rgcca, Xtest)

RGCCA documentation built on Oct. 9, 2023, 5:09 p.m.