1math::PCA(n)             Principal Components Analysis            math::PCA(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       math::PCA - Package for Principal Component Analysis
9

SYNOPSIS

11       package require Tcl  ?8.6?
12
13       package require math::linearalgebra  1.0
14
15       ::math::PCA::createPCA data ?args?
16
17       $pca using ?number?|?-minproportion value?
18
19       $pca eigenvectors ?option?
20
21       $pca eigenvalues ?option?
22
23       $pca proportions ?option?
24
25       $pca approximate observation
26
27       $pca approximatOriginal
28
29       $pca scores observation
30
31       $pca distance observation
32
33       $pca qstatistic observation ?option?
34
35______________________________________________________________________________
36

DESCRIPTION

38       The PCA package provides a means to perform principal components analy‐
39       sis in Tcl, using an object-oriented technique as facilitated by TclOO.
40       It  actually  defines  a  single public method, ::math::PCA::createPCA,
41       which constructs an object based on the data that are passed to perform
42       the actual analysis.
43
44       The methods of the PCA objects that are created with this command allow
45       one to examine the principal components, to approximate (new)  observa‐
46       tions  using all or a selected number of components only and to examine
47       the properties of the components and the statistics of  the  approxima‐
48       tions.
49
50       The  package  has  been  modelled after the PCA example provided by the
51       original linear algebra package by Ed Hume.
52

COMMANDS

54       The math::PCA package provides one public command:
55
56       ::math::PCA::createPCA data ?args?
57              Create a new object, based on the data that are passed  via  the
58              data  argument.  The principal components may be based on either
59              correlations or covariances.   All  observations  will  be  nor‐
60              malised  according  to  the  mean  and standard deviation of the
61              original data.
62
63              list data
64                     - A list of observations (see the example below).
65
66              list args
67                     - A list of key-value pairs defining  the  options.  Cur‐
68                     rently  there  is  only one key: -covariances. This indi‐
69                     cates if covariances are to be used (if the value  is  1)
70                     or  instead  correlations (value is 0). The default is to
71                     use correlations.
72
73       The PCA object that is created has the following methods:
74
75       $pca using ?number?|?-minproportion value?
76              Set the number of components to be used  in  the  analysis  (the
77              number  of  retained  components).  Returns the number of compo‐
78              nents, also if no argument is given.
79
80              int number
81                     - The number of components to be retained
82
83              double value
84                     - Select the number of components based  on  the  minimum
85                     proportion  of variation that is retained by them. Should
86                     be a value between 0 and 1.
87
88       $pca eigenvectors ?option?
89              Return the eigenvectors as a list of lists.
90
91              string option
92                     - By default only the retained components  are  returned.
93                     If all eigenvectors are required, use the option -all.
94
95       $pca eigenvalues ?option?
96              Return the eigenvalues as a list of lists.
97
98              string option
99                     -  By default only the eigenvalues of the retained compo‐
100                     nents are returned.  If all eigenvalues are required, use
101                     the option -all.
102
103       $pca proportions ?option?
104              Return  the  proportions for all components, that is, the amount
105              of variations that each components can explain.
106
107       $pca approximate observation
108              Return an approximation of the observation based on the retained
109              components
110
111              list observation
112                     - The values for the observation.
113
114       $pca approximatOriginal
115              Return an approximation of the original data, using the retained
116              components. It is a convenience method that works  on  the  com‐
117              plete set of original data.
118
119       $pca scores observation
120              Return  the scores per retained component for the given observa‐
121              tion.
122
123              list observation
124                     - The values for the observation.
125
126       $pca distance observation
127              Return the distance between the given observation  and  its  ap‐
128              proximation.  (Note:  this  distance  is based on the normalised
129              vectors.)
130
131              list observation
132                     - The values for the observation.
133
134       $pca qstatistic observation ?option?
135              Return the Q statistic, basically the square  of  the  distance,
136              for the given observation.
137
138              list observation
139                     - The values for the observation.
140
141              string option
142                     -  If  the  observation is part of the original data, you
143                     may want to  use  the  corrected  Q  statistic.  This  is
144                     achieved with the option "-original".
145

EXAMPLE

147       TODO: NIST example
148

BUGS, IDEAS, FEEDBACK

150       This  document,  and the package it describes, will undoubtedly contain
151       bugs and other problems.  Please report such in the category PCA of the
152       Tcllib  Trackers  [http://core.tcl.tk/tcllib/reportlist].   Please also
153       report any ideas for enhancements  you  may  have  for  either  package
154       and/or documentation.
155
156       When proposing code changes, please provide unified diffs, i.e the out‐
157       put of diff -u.
158
159       Note further that  attachments  are  strongly  preferred  over  inlined
160       patches.  Attachments  can  be  made  by  going to the Edit form of the
161       ticket immediately after its creation, and  then  using  the  left-most
162       button in the secondary navigation bar.
163

KEYWORDS

165       PCA, math, statistics, tcl
166

CATEGORY

168       Mathematics
169
170
171
172tcllib                                1.0                         math::PCA(n)
Impressum