Description Usage Arguments Value Examples
PCA Trend Filtering. From: https://github.com/Lei-D/PCATF
1 2 3 4 5 6 7 8 9 10  | 
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 leverage images for outlying observations.  | 
K | 
 (Optional) The number of trend-filtered 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 0.5 . Can be NULL (lets algorithm decide).  | 
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?  | 
SVD The trend-filtered SVD decomposition of X (list with u, d, v).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  | set.seed(12345)
U = matrix(rnorm(100*3),ncol=3)
U[20:23,1] = U[20:23,1] + 3
U[40:43,2] = U[40:43,2] - 2
U = svd(U)$u
D = diag(c(10,5,1))
V = svd(matrix(rnorm(3*20),nrow=20))$u
X = U %*% D %*% t(V)
out3 = PCATF(X, K=3, lambda=.75)
matplot(out3$u, ty='l')
out3$d
plot(rowSums(out3$u^2), ty='l')
# Orthonormalized
out3_svd = svd(out3$u)
matplot(out3_svd$u, ty='l')
out3_svd$d
plot(rowSums(out3_svd$u^2), ty='l')
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.