| spca_est | R Documentation |
Implements scaled principal component analysis (sPCA): predictors are first standardized, then each standardized predictor is scaled by its univariate predictive slope on the target, and finally principal components are extracted from the scaled predictors.
spca_est(target, X, nfac, winsorize = FALSE, winsor_probs = c(0, 99))
target |
A numeric vector of length |
X |
A numeric matrix or data frame with |
nfac |
A positive integer giving the number of factors to extract. |
winsorize |
Logical; if |
winsor_probs |
Numeric vector of length 2 giving winsorization
percentiles. Used only when |
The function follows the MATLAB implementation of Huang, Jiang, Li, Tong, and Zhou (2022).
An object of class "sdim_spca" with components:
A T x nfac matrix of extracted sPCA factors.
A numeric vector of predictor-specific predictive slopes.
A numeric vector of scaling coefficients actually used.
Column means of X (used by predict).
Column standard deviations of X (used by predict).
The standardized predictor matrix.
The scaled standardized predictor matrix.
The estimated loading matrix.
Residual matrix from the PCA reconstruction step.
Average squared residual by row.
Singular values from the decomposition of scaleXs %*% t(scaleXs).
The matched function call.
Huang, D., Jiang, F., Li, K., Tong, G., and Zhou, G. (2022). Scaled PCA: A New Approach to Dimension Reduction. Management Science, 68(3), 1678–1695. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1287/mnsc.2021.4020")}
set.seed(123)
X <- matrix(rnorm(200 * 10), nrow = 200, ncol = 10)
y <- rnorm(200)
fit <- spca_est(target = y, X = X, nfac = 3)
dim(fit$factors)
head(fit$beta)
# Predictive alignment: target has fewer rows than X
fit2 <- spca_est(target = y[1:199], X = X, nfac = 3)
dim(fit2$factors) # 200 x 3 (factors for all T rows)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.