PVS: Principal Variable Selection (PVS)

View source: R/PVS_PVR.R

PVSR Documentation

Principal Variable Selection (PVS)

Description

Greedy algorithm for extracting the most dominant (principal) variables (X-columns) with respect to explained X-variance.

Usage

PVS(X, nvar, ncomp = NULL)

Arguments

X

numeric predictor matrix.

nvar

integer, the required number of selected variables.

ncomp

integer, number of principal components included in the voting (default = all PCs).

Value

A list containing:

Q

Orthonormal scores (associated with the selected variables).

R

Corresponding loadings. NOTE: R[,vperm] is upper triangular.

ids

Indices arranged in the order of the nvar selected variables.

vperm

Indices arranged in the order of the nvar selected and all non-selected variables. NOTE: R[,vperm] is upper triangular.

ssEX

The variances explained by the selected variables.

ni

The norms of the (residual) selected variables before the score-normalization (Q).

U

The normalized PCA-scores.

s

Singular values of the mean centered X.

Author(s)

Ulf Indahl, Kristian Hovde Liland.

References

Joakim Skogholt, Kristian Hovde Liland, Tormod Næs, Age K. Smilde, Ulf Geir Indahl, Selection of principal variables through a modified Gram–Schmidt process with and without supervision, Journal of Chemometrics, Volume 37, Issue 10, Pages e3510 (2023), https://doi.org/10.1002/cem.3510

See Also

PVR, VIP, filterPLSR, shaving, stpls, truncation, bve_pls, ga_pls, ipw_pls, mcuve_pls, rep_pls, spa_pls.

Examples

library(pls)
data(gasoline, package = "pls")

# PVS: Select 10 variables using all PCs in voting
pvs_result <- PVS(gasoline$NIR, nvar = 10)

# Compare with PCA using pcr() (octane is unused in PCA)
pca_result <- pcr(octane ~ NIR, ncomp = 10, data = gasoline, scale = FALSE)

# Plot cumulative variance explained
plot(cumsum(pvs_result$ssEX), type = "b", col = "blue", 
     xlab = "Number of Variables/Components", 
     ylab = "Cumulative % Variance Explained",
     main = "PVS vs PCA", ylim = c(0, 100))
pca_var <- 100 * cumsum(pca_result$Xvar) / pca_result$Xtotvar
lines(seq_along(pca_var), pca_var, type = "b", col = "red")
legend("bottomright", legend = c("PVS (10 variables)", "PCA (10 components)"),
       col = c("blue", "red"), lty = 1, pch = 1)


plsVarSel documentation built on Feb. 13, 2026, 9:07 a.m.