Skip to contents

This function projects the predictor matrix X and response vector y onto the orthogonal complement of the intercept (constant) vector. This removes any component of the data explained by the intercept, effectively centering the data in the sense of removing the mean direction.

Usage

get_Xy_centered(X, y)

Arguments

X

A numeric matrix of predictors with dimensions (n x p).

y

A numeric response vector of length n.

Value

A list containing:

X

The predictor matrix after projection (dimensions: (n - 1) x p).

y

The response vector after projection (length: n - 1).

Details

This function uses the singular value decomposition (SVD) of the intercept vector to construct an orthonormal basis for the space orthogonal to the intercept. It then projects X and y onto that space, effectively removing any contribution from the intercept.

Examples

X <- matrix(rnorm(100), nrow = 10)
y <- rnorm(10)
centered_data <- lmFScreen:::get_Xy_centered(X, y)
X_centered <- centered_data$X
y_centered <- centered_data$y