Skip to contents

Computes a dimensional reduction from a matrix of ENA points such that the first dimension best represents the contribution of a target variable after controlling for covariates via Lasso. An optional second GMR axis can be computed for y_var; remaining dimensions are filled by SVD of the doubly-deflated space. Delegates to generalized_means_rotation.

Usage

ena.rotate.by.generalized(enaset, params)

Arguments

enaset

An ENAset or compatible list with model$points.for.projection (or points.normed.centered), line.weights, and rotation$codes.

params

A list with the following named elements:

x_var

Required. A data.frame (or character vector of column names in enaset$meta.data) whose first column is the target variable. Additional columns are treated as covariates and penalized via Lasso.

y_var

Optional. Same format as x_var. When provided a second GMR axis is computed.

select_2_groups

Optional length-2 list/vector of group labels. When given, the GMR fit for the x axis uses only rows whose target value is in these two groups. The group mean difference for x1 (the secondary axis that keeps group means on the x-axis) is always computed from the full data.

interactions

Logical; if TRUE (default) pairwise interaction terms are added to the model matrix when covariates are present. Set FALSE for main-effects-only Lasso.

Value

A list with rotation (q x q matrix, column names GMR1, GMR2|SVD2, SVD3, …), codes, eigenvalues, and node.positions = NULL, suitable for use inside rotate().