Estimates the spectral transformation Q for spectral deconfounding by shrinking the leading singular values of the covariates.

get_Q(X, type, trim_quantile = 0.5, q_hat = 0, gpu = FALSE, scaling = TRUE)

Arguments

X

Numerical covariates of class matrix.

type

Type of deconfounding, one of 'trim', 'pca', 'no_deconfounding'. 'trim' corresponds to the Trim transform Cevid2020SpectralModelsSDModels as implemented in the Doubly debiased lasso Guo2022DoublyConfoundingSDModels, 'pca' to the PCA transformationPaul2008PreconditioningProblemsSDModels and 'no_deconfounding' to the Identity.

trim_quantile

Quantile for Trim transform, only needed for trim.

q_hat

Assumed confounding dimension, only needed for pca.

gpu

If TRUE, the calculations are performed on the GPU. If it is properly set up.

scaling

Whether X should be scaled before calculating the spectral transformation.

Value

Q of class matrix, the spectral transformation matrix.

References

Author

Markus Ulmer

Examples

set.seed(1)
X <- matrix(rnorm(50 * 20), nrow = 50)
Q_trim <- get_Q(X, 'trim')
Q_pca <- get_Q(X, 'pca', q_hat = 5)
Q_plain <- get_Q(X, 'no_deconfounding')