pca_weight: PCA-Based Weighting Method for Indicator Scoring

View source: R/pca_weight.R

pca_weightR Documentation

PCA-Based Weighting Method for Indicator Scoring

Description

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.

Usage

pca_weight(X, index = NULL, nfs = NULL)

Arguments

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 "+" for positive indicators (higher is better), "-" for negative indicators (lower is better). If not provided, all indicators are assumed to be positive.

Value

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.

Examples

# Example: Using PCA to compute indicator weights
ind = c("+","+","-","-")
pca_weight(iris[1:10, 1:4], ind, nfs = 2)

zhjx19/mathmodels documentation built on June 2, 2025, 12:18 a.m.