pca_weight | R Documentation |
Computes indicator weights using Principal Component Analysis (PCA). The method extracts principal components and uses their variance contribution to derive objective weights for indicators. Optionally handles positive/negative directions of indicators.
pca_weight(X, index = NULL, nfs = NULL)
X |
A numeric data frame or matrix where rows represent samples and columns represent indicators. |
index |
A character vector indicating the direction of each indicator.
Use |
A list containing:
w |
Numeric vector of normalized weights for each indicator. |
s |
Numeric vector of scores for each sample, scaled by 100. |
lambda |
Eigenvalues (explained variance) of principal components. |
B |
Loading matrix scaled by square root of eigenvalues. |
beta |
Weight contributions from loadings and variance explained. |
# Example: Using PCA to compute indicator weights
ind = c("+","+","-","-")
pca_weight(iris[1:10, 1:4], ind, nfs = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.