STK++ 0.9.13
tutoStatCovariance.cpp File Reference
#include "STKpp.h"
Include dependency graph for tutoStatCovariance.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 4 of file tutoStatCovariance.cpp.

5{
6 // create coovariance matrix and its Cholesky decomposition
7 CArraySquare<Real, 3> s; s << 2.0, 0.8, 0.36,
8 0.8, 2.0, 0.8,
9 0.36,0.8, 1.0;
11 cholesky(s, D, L);
12 // create correlated data set
14 a = a.randGauss() * D.sqrt() * L.transpose() + 1;
15 stk_cout << "True sigma=\n" << s;
16 stk_cout << "Estimated sigma=\n" << Stat::covariance(a);
17 return 0;
18}
#define stk_cout
Standard stk output stream.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
bool cholesky(ExprBase< Lhs > const &A, Array2DDiagonal< typename Lhs::Type > &D, Array2DLowerTriangular< typename Lhs::Type > &L)
Compute the Cholesky decomposition of a symmetric matrix.
Real covariance(ExprBase< XArray > const &X, ExprBase< YArray > const &Y, bool unbiased=false)
Compute the covariance of the variables X and Y.

References STK::cholesky(), STK::Stat::covariance(), STK::ArrayBase< Derived >::randGauss(), STK::ExprBase< Derived >::sqrt(), stk_cout, and STK::ArrayBase< Derived >::transpose().