Debian Codegraph @

dwtools/Covariance.h

raw symbols SCIP
1 #cxx . . $ `<file>/dwtools/Covariance.h`/ifndef _Covariance_h_
2 #define _Covariance_h_cxx . . $ `dwtools/Covariance.h:2:9`!
3 /* Covariance.h
4 *
5 * Copyright (C) 1993-2021 David Weenink
6 *
7 * This code is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at
10 * your option) any later version.
11 *
12 * This code is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this work. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "CCA.h"cxx . . $ `<file>/dwtools/CCA.h`/
22 #include "PCA.h"cxx . . $ `<file>/dwtools/PCA.h`/
23 #include "SSCP.h"cxx . . $ `<file>/dwtools/SSCP.h`/
24 #include "TableOfReal_extensions.h"cxx . . $ `<file>/dwtools/TableOfReal_extensions.h`/
25
26 Thing_definecxx . . $ ClassInfo# (Covariance, SSCP) {
27 };
28
29 Collection_definecxx . . $ `sys/Collection.h:786:9`! (CovarianceList, OrderedOf, Covariance) {
30 SSCPListcxx . . $ SSCPList# asSSCPListcxx . . $ structCovarianceList#asSSCPList(dceb440e36dd3f3). () {
31 return reinterpret_cast <SSCPListcxx . . $ SSCPList#> (this);
32 }
33 };
34
35 autoTableOfRealcxx . . $ autoTableOfReal# Covariance_TableOfReal_extractDistanceQuantileRangecxx . . $ Covariance_TableOfReal_extractDistanceQuantileRange(cf73752ab84b1832). (Covariancecxx . . $ Covariance# me, TableOfRealcxx . . $ TableOfReal# thee, double qlow, double qhigh);
36 /*
37 Select from a TableOfReal the rows whose Mahalanobis distance to the centroid
38 (from the SSCP) is in the quantile [qlow, qhigh].
39 */
40
41 autoTableOfRealcxx . . $ autoTableOfReal# Covariance_TableOfReal_mahalanobiscxx . . $ Covariance_TableOfReal_mahalanobis(bf87fb867ef00418). (Covariancecxx . . $ Covariance# me, TableOfRealcxx . . $ TableOfReal# thee, bool useTableCentroid);
42 /*
43 Calculate the Mahalanobis distance: sqrt ((x-m)'S**-1 (x-m))
44 use the m-vector (centroid) from the covariance unless useTableColumnMeans is true.
45 */
46 autoTableOfRealcxx . . $ autoTableOfReal# Covariance_TableOfReal_scaledResidualscxx . . $ Covariance_TableOfReal_scaledResiduals(bf87fb867ef00418). (Covariancecxx . . $ Covariance# me, TableOfRealcxx . . $ TableOfReal# thee, bool useTableCentroid);
47
48 autoCovariancecxx . . $ autoCovariance# TableOfReal_to_Covariancecxx . . $ TableOfReal_to_Covariance(3e7df3a959f2f2b3). (TableOfRealcxx . . $ TableOfReal# me);
49
50 autoTableOfRealcxx . . $ autoTableOfReal# Covariance_to_TableOfReal_randomSamplingcxx . . $ Covariance_to_TableOfReal_randomSampling(aaff9786ae7eb815). (Covariancecxx . . $ Covariance# me, integercxx . . $ integer# numberOfData);
51 /* Generate a table with data based on the covariance matrix */
52
53 void Covariance_PCA_generateOneVector_inlinecxx . . $ Covariance_PCA_generateOneVector_inline(8fd3da726b298de8). (Covariancecxx . . $ Covariance# me, PCAcxx . . $ PCA# thee, VECVUcxx . . $ VECVU# vec, VECcxx . . $ VEC# buf);
54 /*
55 A convenience function to avoid the calculation of the PCA each time we want to generate a random vector
56 The PCA must be the result of a previous SSCP_to_PCA call !
57 The covariance matrix must not be singular or diagonal!
58 Returns the random sampled vector in vec (which should be of size my numberOfColumns).
59 Preconditions:
60 1. Covariance may not be in diagonal representation (1 row)
61 2. Dimensions of me and PCA agree
62 3. vec is of length my numberOfColumns
63 4. buf, a vector of length my numberOfColumns, is needed so the routine cannot fail
64 */
65
66 autoCovariancecxx . . $ autoCovariance# Covariance_createcxx . . $ Covariance_create(49f8ab4cf76ab9e9). (integercxx . . $ integer# dimension);
67
68 autoCovariancecxx . . $ autoCovariance# Covariance_createSimplecxx . . $ Covariance_createSimple(fb415e43f99f04d0). (constVECVUcxx . . $ constVECVU# const& covariances, constVECVUcxx . . $ constVECVU# const& centroid, integercxx . . $ integer# numberOfObservations);
69
70 autoCovariancecxx . . $ autoCovariance# Covariance_create_reduceStoragecxx . . $ Covariance_create_reduceStorage(205004f52690bd11). (integercxx . . $ integer# dimension, kSSCPstoragecxx . . $ kSSCPstorage# storage);
71 /*
72 storage full: complete matrix
73 storage diagonal: only diagonal
74
75 See also SSCP_expand () for usage.
76 */
77
78 /* Precondition ||vector|| = 1 */
79 void Covariance_getMarginalDensityParameterscxx . . $ Covariance_getMarginalDensityParameters(212e9081be60dafa). (Covariancecxx . . $ Covariance# me, constVECVUcxx . . $ constVECVU# const& vector, double *out_mean, double *out_stdev);
80
81 double Covariance_getMarginalProbabilityAtPositioncxx . . $ Covariance_getMarginalProbabilityAtPosition(add1dc726be0e071). (Covariancecxx . . $ Covariance# me, constVECVUcxx . . $ constVECVU# const& vector, double x);
82
83 double Covariance_getProbabilityAtPosition_stringcxx . . $ Covariance_getProbabilityAtPosition_string(6f6eaca3dda299c9). (Covariancecxx . . $ Covariance# me, conststring32cxx . . $ conststring32# xpos);
84
85 double Covariance_getProbabilityAtPositioncxx . . $ Covariance_getProbabilityAtPosition(9672a574a0a205d1). (Covariancecxx . . $ Covariance# me, constVECcxx . . $ constVEC# x);
86 /* evaluate the pdf(x,mu,Sigma) at x */
87
88 autoCovariancecxx . . $ autoCovariance# SSCP_to_Covariancecxx . . $ SSCP_to_Covariance(872697cc608a64ad). (SSCPcxx . . $ SSCP# me, integercxx . . $ integer# numberOfConstraints);
89
90 autoSSCPcxx . . $ autoSSCP# Covariance_to_SSCPcxx . . $ Covariance_to_SSCP(76e37184877b64dd). (Covariancecxx . . $ Covariance# me);
91
92 void Covariance_differencecxx . . $ Covariance_difference(5a55ec33ac584ef2). (Covariancecxx . . $ Covariance# me, Covariancecxx . . $ Covariance# thee, double *out_prob, double *out_chisq, double *out_df);
93
94 void Covariance_getSignificanceOfOneMeancxx . . $ Covariance_getSignificanceOfOneMean(9321ff4128b9e8f5). (Covariancecxx . . $ Covariance# me, integercxx . . $ integer# index, double mu, double *out_probability, double *out_t, double *out_df);
95
96 void Covariance_getSignificanceOfMeansDifferencecxx . . $ Covariance_getSignificanceOfMeansDifference(870744d08ab6bf0). (Covariancecxx . . $ Covariance# me, integercxx . . $ integer# index1, integercxx . . $ integer# index2, double mu, int paired, int equalVariances, double *out_probability, double *out_t, double *out_ndf);
97
98 void Covariance_getSignificanceOfOneVariancecxx . . $ Covariance_getSignificanceOfOneVariance(9321ff4128b9e8f5). (Covariancecxx . . $ Covariance# me, integercxx . . $ integer# index, double sigmasq, double *out_probability, double *out_chisq, double *out_ndf);
99
100 void Covariance_getSignificanceOfVariancesRatiocxx . . $ Covariance_getSignificanceOfVariancesRatio(675793c557b0208f). (Covariancecxx . . $ Covariance# me, integercxx . . $ integer# index1, integercxx . . $ integer# index2, double ratio, double *out_probability, double *out_f, double *out_df);
101
102 double Covariances_getMultivariateCentroidDifferencecxx . . $ Covariances_getMultivariateCentroidDifference(5c136fcd726efc4c). (Covariancecxx . . $ Covariance# me, Covariancecxx . . $ Covariance# thee, int equalCovariances, double *out_prob, double *out_fisher, double *out_df1, double *out_df2);
103 /* Are the centroids of me and thee different?
104 Assumption: the two covariances are equal. (we pool me and thee, dimension p).
105 Two sample test of Morrison (1990), page 141:
106 T^2 = n1*n2/(n1+n2) (m1-m2)'S^-1(m1-m2) # weighted Mahalanobis distance
107 f = T^2 * (n1+n2-p-1)/((n1+n2-2)*p)
108 f has Fisher distribution with p and n1+n2-p-1 degrees of freedom.
109 */
110
111 void Covariances_equalitycxx . . $ Covariances_equality(d66b820064d82689). (CovarianceListcxx . . $ CovarianceList# me, int method, double *out_prob, double *out_chisq, double *out_df);
112 /*
113 Equality of covariance.
114 method = 1 : Bartlett (Morrison, 1990)
115 method = 2 : Wald (Schott, 2001)
116 */
117
118 double Covariance_TableOfReal_normalityTest_BHEPcxx . . $ Covariance_TableOfReal_normalityTest_BHEP(19ee1367b729c2b3). (Covariancecxx . . $ Covariance# me, TableOfRealcxx . . $ TableOfReal# data, constVECcxx . . $ constVEC# const& responsibilities, double *inout_beta, double *out_tnb, double *out_lnmu, double *out_lnvar, bool *out_covarianceIsSingular);
119 /*
120 Multivariate normality test of nxp data matrix according to the method described in
121 Henze & Wagner (1997), A new approach to the BHEP tests for multivariate normality,
122 Journal of Multivariate Analysis 62, 1-23.
123 The test statistic is returned in tnb, together with the lognormal mean 'lnmu' and the lognormal variance 'lnvar'.
124 */
125
126 autoCovariancecxx . . $ autoCovariance# CovarianceList_to_Covariance_poolcxx . . $ CovarianceList_to_Covariance_pool(56bfcf47216a02f2). (CovarianceListcxx . . $ CovarianceList# me);
127 autoCovariancecxx . . $ autoCovariance# CovarianceList_to_Covariance_betweencxx . . $ CovarianceList_to_Covariance_between(56bfcf47216a02f2). (CovarianceListcxx . . $ CovarianceList# me);
128 autoCovariancecxx . . $ autoCovariance# CovarianceList_to_Covariance_withincxx . . $ CovarianceList_to_Covariance_within(56bfcf47216a02f2). (CovarianceListcxx . . $ CovarianceList# me);
129
130 #endif // _Covariance_h_