Dew Stats Master .NET
TMtxPCA Component
Summary
Performs Principle Component Analysis (PCA).

Unit
StatTools

Hierarchy
TMtxPCA

Subclasses
None

Description
Principal Components Analysis - PCA - is a data analysis tool that is usually used to reduce the dimensionality (number of variables) of a large number of interrelated variables, while retaining as much of the information (variation) as possible. PCA calculates an uncorrelated set of variables (factors or PCs). These factors are ordered so that the first few retain most of the variation present in all of the original variables.

The PCA procedure is reduced to an eigenvalue-eigenvector problem. PCA routines perform a PCA on either a correlation or a covariance matrix. Data matrix can be either "raw" data or pre calculated correlation/covariance matrix.

How to use TMtxPCA component?
1) Drop a TMtxPCA component on the form.
2) Define the data matrix format by setting the DataFormat property. The following modes are supported : data is "raw" data (DataFormatRaw) or data is correlation/covariance matrix (DataFormatCorrCov).
3) By setting the PCAMode property define whether PCA will use correlation or covariance matrix to calculate PCA.
4) Define the actual Data (by changing Data matrix values)
5) Call the Recalc method to calculate PCA results.

Results:
1) EigValues - Data eigenvalues
2) PC - Data eigenvectors
3) TotalVarPct - the percentage of the total variation in the variables (columns)
4) ZScores - Z-Scores (eigenvectors in PC space)

Categories
Multivariate analysis routines

Example 1

Here is an example how to setup TMtxPCA component:
Uses StatTools, MtxVec, Statistics; procedure Example(MtxPCA1: TMtxPCA); begin // ... MtxPCA1.Data.SetIt(4,3,false,[1,2,3, 5,7,9, 1,11,13, 3,7,4]); MtxPCA1.PCAMode := PCACorrMat; // using correlation matrix to evaluate PCA MtxPCA1.DataFormat := DataFormatRaw; // raw data MtxPCA1.Recalc; // force recalculation // ... end;
#include "StatTools.hpp" #include "Statistics.hpp" void __fastcall Example (TMtxPCA* MtxPCA1) { // ... MtxPCA1->Data->SetIt(4,3,false,OPENARRAY(TSample, (1,2,3, 5,7,9, 1,11,13, 3,7,4))); MtxPCA1->PCAMode = PCACorrMat; // using correlation matrix to evaluate PCA MtxPCA1->DataFormat = DataFormatRaw; // raw data MtxPCA1->Recalc(); // force recalculation // ... }
using Dew.Stats; using Dew.Stats.Units; using Dew.Math; namespace Dew.Examples { private void Example(StatTools.TMtxPCA MtxPCA1) { // ... MtxPCA1.Data.SetIt(4,3,false,new double[] {1,2,3, 5,7,9, 1,11,13, 3,7,4}); MtxPCA1.PCAMode = StatTools.PCACorrMat; // using correlation matrix to evaluate PCA MtxPCA1.DataFormat = StatTools.DataFormatRaw; // raw data MtxPCA1.Recalc(); // force recalculation // ... } }

Properties

 Name  Summary 
AutoUpdate  
Data Defines the data to be analyzed by PCA. 
DataFormat Defines data format for Data matrix. 
Dirty  
EigValues Returns the eigenvalues. 
PC Returns the principal components (PC). 
PCAMode PCA type. 
TotalVarPct Returns the percentage of the total variation in the variables. 
ZScores Returns the Z-Scores. 

Methods

 Name  Summary 
Loaded  
Recalc Triggers PCA recalculation. 

Copyright 2008 Dew Research
http://www.dewresearch.com