From: https://github.com/Lei-D/PCATF and https://github.com/glmgen/glmgen/blob/master/c_lib/glmgen/src/tf/tf_dp.c .

fusedPCA(
  X,
  X.svd = NULL,
  solve_directions = TRUE,
  K = NULL,
  lambda = 5,
  niter_max = 1000,
  TOL = 1e-08,
  verbose = FALSE
)

Arguments

X

A numerical data matrix (observations x variables).

X.svd

(Optional) The svd decomposition of X. Save time by providing this argument if the svd has already been computed. Default NULL.

solve_directions

Should the principal directions be solved for? These will be needed to display the artifact images for outlying observations.

K

(Optional) The number of fused PCs to solve for. If not provided, it will be set to the number of regular PCs with variance above the mean, up to 100 PCs.

lambda

The trend filtering parameter; roughly, the filtering intensity. Default is 5.

niter_max

The number of iterations to use for approximating the PC.

TOL

The maximum 2-norm between iterations to accept as convergence.

verbose

Print statements about convergence?

Value

SVD The fused SVD decomposition of X (list with u, d, v).

Details

Inheriting from glmgen, this code is under the GNU Lesser General Public License: http://www.gnu.org/licenses/ .

References

  • Kim, S.-J., Koh, K., Boyd, S. & Gorinevsky, D. \$\ell_1\$ Trend Filtering. SIAM Rev. 51, 339-360 (2009).

  • Pham, D., McDonald, D., Ding, L., Nebel, M. B. & Mejia, A. Projection scrubbing: a more effective, data-driven fMRI denoising method. (2021).

  • Tibshirani, R. J. Adaptive piecewise polynomial estimation via trend filtering. The Annals of Statistics 42, 285-323 (2014).