pls_pb | R Documentation |
Function calculating a set of (D-1) principal balances based on PLS.
pls_pb(Xcoda, ycoda, version = "cov")
Xcoda |
a matrix of raw compositional data with "n" rows and "D" columns/components |
ycoda |
a response variable; can be continuous (PLS regression) or binary (PLS-DA) |
version |
a parameter determining whether the balances are ordered according to max. covariance (default) or max. correlation |
The function creates a set of (D-1) principal balances based on PLS. The procedure builds on the method building principal balances based on PCA, introduced in Martin-Fernandez et al. (2018) For detailed information regarding PLS principal balances, see Nesrstová et al. (2023).
A list with the following components:
bal
A matrix of (D-1) principal balances.
cov
Covariance of each balance with the response variable.
Viktorie Nesrstová
J. A. Martín-Fernández, V. Pawlowsky-Glahn, J. J. Egozcue, and R. Tolosona-Delgado. Advances in principal balances for compositional data. Mathematical Geosciences, 50(3):273–298, 2018. Available at: https://link.springer.com/article/10.1007/s11004-017-9712-z DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/s11004-017-9712-z")}
Nesrstová, V, Wilms, I, Palarea-Albaladejo, J, et al. Principal balances of compositional data for regression and classification using partial least squares. Journal of Chemometrics. 2023; 37(12):e3518.. Available at: https://analyticalsciencejournals.onlinelibrary.wiley.com/doi/full/10.1002/cem.3518 DOI: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1002/cem.3518")}
## Not run:
if (requireNamespace("MASS", quietly = TRUE)) {
# 1. Generate sample data ------------------------------------------------------
n <- 100 # observations
D <- 15 # parts/variables
Sig <- diag(D-1) # positive-definite symmetric matrix -> covariance matrix
mu <- c(rep(0, D-1)) # means of variables
set.seed(123)
# ilr coordinates
Z <- MASS::mvrnorm(n,mu,Sigma = Sig)
# Z -> CoDa X
V <- compositions::ilrBase(D = D) # ilrBase() in library(compositions)
X <- as.matrix(as.data.frame(acomp(exp(Z%*%t(V)))))
# Response y:
beta <- runif(D-1,0.1,1)
eps <- rnorm(n)
y <- Z%*%beta+eps
# 2. Calculate PLS PBs
PLS_balances <- fBalChip_PLS(X,y,version = "cov") # version = "cov" -> max. covariance
balances <- PLS_balances$bal
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.