22 cout <<
"*************************************************" << endl;
23 cout <<
"* Principal Component Analysis *" << endl;
24 cout <<
"* *" << endl;
25 cout <<
"* Number of variables: " << setw(4) <<
n 27 cout <<
"* Number of data points: " << setw(8) <<
m 29 cout <<
"* Number of dependent variables: " << setw(4) << c
31 cout <<
"* *" << endl;
32 cout <<
"*************************************************" << endl;
48 for (
Int_t i = 0; i <
m; i++) {
52 for (
Int_t j = 0; j <
n -
c; j++) {
53 if (j % 3 == 0) data[j] = randumNum->
Gaus(5,1);
54 else if (j % 3 == 1) data[j] = randumNum->
Poisson(8);
55 else data[j] = randumNum->
Exp(2);
59 for (
Int_t j = 0 ; j <
c; j++) {
61 for (
Int_t k = 0; k <
n - c - j; k++) data[
n - c + j] += data[k];
Principal Components Analysis (PCA)
virtual void Print(Option_t *opt="MSE") const
Print the statistics Options are.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
void Test(Option_t *option="")
Test the PCA, bye calculating the sum square of residuals (see method SumOfSquareResiduals), and display the histogram.
This is the base class for the ROOT Random number generators.
virtual void MakeHistograms(const char *name="pca", Option_t *option="epsdx")
Make histograms of the result of the analysis.
Using a TBrowser one can browse all ROOT objects.
virtual void AddRow(const Double_t *x)
Add a data point and update the covariance matrix.
virtual void MakePrincipals()
Perform the principal components analysis.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual void MakeCode(const char *filename="pca", Option_t *option="")
Generates the file <filename>, with .C appended if it does argument doesn't end in ...
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
virtual Double_t Exp(Double_t tau)
Returns an exponential deviate.