Two-way (cross) projection to latent components
cross_projector.RdA projector that reduces two blocks of data, X and Y, yielding a pair of weights for each component. This structure can be used, for example, to store weights derived from canonical correlation analysis.
Details
This class extends projector and therefore basic operations such as project, shape, reprocess,
and coef work, but by default, it is assumed that the X block is primary. To access Y block operations, an
additional argument source must be supplied to the relevant functions, e.g., coef(fit, source = "Y")
Examples
# Create two scaled matrices X and Y
X <- scale(matrix(rnorm(10 * 5), 10, 5))
Y <- scale(matrix(rnorm(10 * 5), 10, 5))
# Perform canonical correlation analysis on X and Y
cres <- cancor(X, Y)
sx <- X %*% cres$xcoef
sy <- Y %*% cres$ycoef
# Create a cross_projector object using the canonical correlation analysis results
canfit <- cross_projector(cres$xcoef, cres$ycoef, cor = cres$cor,
sx = sx, sy = sy, classes = "cancor")