% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/apca.R
\name{apca}
\alias{apca}
\title{Advanced Principal Component Analysis (APCA)}
\usage{
apca(data, n_components = 2, method = "svd", center = TRUE, scale = FALSE)
}
\arguments{
\item{data}{A numeric matrix or data frame.}

\item{n_components}{Integer. Number of principal components to extract.}

\item{method}{Character. The algorithm to use: "svd", "power", "qr", "nipals",
"jacobi", "arnoldi", "als", "ppca", or "gha".}

\item{center}{Logical. Whether to mean-center the data. Default is TRUE.}

\item{scale}{Logical. Whether to scale variables to unit variance. Default is FALSE.}
}
\value{
An object of class "apca" containing scores, loadings, and variance metrics.
}
\description{
Performs PCA using one of nine different computational algorithms.
This is the main wrapper function for the apca package.
}
\examples{
# Run PCA using the classical SVD algorithm
data(mtcars)
res_svd <- apca(mtcars, n_components = 2, method = "svd", scale = TRUE)

# Print basic information
print(res_svd)

# ---------------------------------------------------------
# Extracting specific mathematical components
# ---------------------------------------------------------
# 1. Extract the PCA scores (useful for clustering/regression)
my_scores <- res_svd$scores
head(my_scores)

# 2. Extract the loadings matrix (variable weights)
my_loadings <- res_svd$loadings
print(my_loadings)

# 3. Extract the eigenvalues
my_eigen <- res_svd$eigenvalues
print(my_eigen)

# Run PCA using the NIPALS algorithm
res_nipals <- apca(mtcars, n_components = 2, method = "nipals", scale = TRUE)
}
