Tcl Library Source Code

Bounty program for improvements to Tcl and certain Tcl packages.

[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]


math::PCA - Package for Principal Component Analysis

Table Of Contents


package require Tcl ?8.6?
package require math::linearalgebra 1.0

::math::PCA::createPCA data ?args?
$pca using ?number?|?-minproportion value?
$pca eigenvectors ?option?
$pca eigenvalues ?option?
$pca proportions ?option?
$pca approximate observation
$pca approximatOriginal
$pca scores observation
$pca distance observation
$pca qstatistic observation ?option?


The PCA package provides a means to perform principal components analysis in Tcl, using an object-oriented technique as facilitated by TclOO. It actually defines a single public method, ::math::PCA::createPCA, which constructs an object based on the data that are passed to perform the actual analysis.

The methods of the PCA objects that are created with this command allow one to examine the principal components, to approximate (new) observations using all or a selected number of components only and to examine the properties of the components and the statistics of the approximations.

The package has been modelled after the PCA example provided by the original linear algebra package by Ed Hume.


The math::PCA package provides one public command:

The PCA object that is created has the following methods:


TODO: NIST example

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category PCA of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.


PCA, math, statistics, tcl