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)
Numerical covariates of class matrix
.
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.
Quantile for Trim transform, only needed for trim.
Assumed confounding dimension, only needed for pca.
If TRUE
, the calculations are performed on the GPU.
If it is properly set up.
Whether X should be scaled before calculating the spectral transformation.
Q of class matrix
, the spectral transformation matrix.