I am performing a redundancy analysis using rms::redun() in R. My model includes an interaction between a binary treatment variable and a restricted cubic spline of a continuous variable: treatment * rcs(age).
The Problem: When I include rcs(age) as a main effect, redun() correctly treats the resulting basis columns (e.g., 3 columns for 4 knots) as a single "chunk" or set of variables. It calculates the R 2 for the whole set against the other predictors.
However, when I include the interaction treatment * rcs(age), redun() seems to "ungroup" the interaction terms. It treats the resulting interaction columns (e.g., treatment * age', treatment * age'') as separate, independent variables. Because these basis functions are naturally correlated, redun flags them as redundant with each other, rather than testing if the entire interaction effect is redundant with the rest of the dataset.
My Question: Is there a way to force redun (or a helper function in rms) to treat the columns generated by treatment * rcs(age) as a single block of degrees of freedom?
I know I can manually calculate the model matrix, perform PCA on the interaction columns to get a single score (PC1), and feed that into redun, but I am looking for a native rms solution or the correct formula syntax to keep the spline basis grouped during the interaction.