Learn R Programming

CoFM (version 1.1.4)

PPC_CoFM: Perform Projected PCA (PPC) Estimation for CoFM

Description

This function performs Projected Principal Component Analysis (PPC) on the input data to estimate factor loadings and uniquenesses. It is designed to work with data generated by the CoFM function and calculates error metrics (MSE and relative loss) by comparing estimates against true parameters. The method projects data onto a subspace (using a projection operator) before performing PCA.

Usage

PPC_CoFM(data, m, A, D)

Value

A list containing:

Ap2

Estimated factor loadings matrix (Projected).

Dp2

Estimated uniquenesses matrix (Projected).

MSESigmaA

Mean Squared Error for factor loadings.

MSESigmaD

Mean Squared Error for uniquenesses.

LSigmaA

Relative loss metric for factor loadings.

LSigmaD

Relative loss metric for uniquenesses.

Arguments

data

A matrix or data frame of input data (n x p). Usually the $data output from CoFM.

m

Integer. The number of principal components (factors) to retain.

A

Matrix. The true factor loadings matrix (p x m). Usually $True_Params$A from CoFM.

D

Matrix. The true uniquenesses matrix (p x p). Usually $True_Params$D from CoFM.

Examples

Run this code
# Examples should be fast and reproducible for CRAN checks
set.seed(123)

# 1. Generate toy data using CoFM
sim_result <- CoFM(n = 200, p = 6, m = 2, type = "Clayton", param = 2.0)

# 2. Extract true parameters and observed data
true_A <- sim_result$True_Params$A
true_D <- sim_result$True_Params$D
obs_data <- sim_result$data

# 3. Apply PPC method and compute errors
ppc_result <- PPC_CoFM(data = obs_data, m = 2, A = true_A, D = true_D)

# 4. Inspect results
ppc_result$MSESigmaA
ppc_result$MSESigmaD
head(ppc_result$Ap2)

Run the code above in your browser using DataLab