Learn R Programming

CoFM (version 1.1.4)

PPC_u: Projection-on-Complement PCA (Generalized)

Description

Projects the data onto the orthogonal complement of a given vector u, eliminating the effect of u, and then performs PCA on the projected data. This is useful for removing specific trends (e.g., time trends, common market factors) before analysis.

Usage

PPC_u(data, m, u)

Value

A list containing:

Apro

Estimated factor loading matrix (p x m).

Dpro

Estimated residual variances (p x p diagonal matrix).

Sigmahatpro

Covariance matrix of the projected data.

u

The normalized projection vector used.

Arguments

data

A matrix or data frame of input data (n x p).

m

Integer. Number of principal components to retain.

u

Numeric vector of length n. The projection direction to be removed from the data. Will be normalized internally.

Examples

Run this code
# Examples should be fast and reproducible for CRAN checks
set.seed(123)
dat <- matrix(stats::rnorm(200), ncol = 4)
u0 <- seq_len(nrow(dat))     # e.g., a linear trend to remove
res <- PPC_u(data = dat, m = 2, u = u0)
res$u
head(res$Apro)

Run the code above in your browser using DataLab