get_Q: Estimation of spectral transformation

View source: R/transformations.R

get_QR Documentation

Estimation of spectral transformation

Description

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

Usage

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 \insertCiteCevid2020SpectralModelsSDModels as implemented in the Doubly debiased lasso \insertCiteGuo2022DoublyConfoundingSDModels, 'pca' to the PCA transformation\insertCitePaul2008PreconditioningProblemsSDModels 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.

Author(s)

Markus Ulmer

References

\insertAllCited

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')

SDModels documentation built on April 11, 2025, 5:50 p.m.