STK++ 0.9.13
tutoStatTransform.cpp
Go to the documentation of this file.
1#include "STKpp.h"
2using namespace STK;
3int main(int argc, char** argv)
4{
7 Law::Normal law(1,2);
8 A.rand(law);
9 stk_cout << "mean(A)=\n" << (mu=Stat::mean(A));
10 stk_cout << "variance(A)=\n"
11 << Stat::varianceWithFixedMean(A, mu, false)<<"\n";
12 // standardize using empirical mean and standard deviation (std is computed during)
13 Stat::standardize(A, mu, std);
14 stk_cout << "mean(A)=\n" << (mean=Stat::mean(A));
15 stk_cout << "variance(A)=\n"
16 << Stat::varianceWithFixedMean(A, mean, false)<<"\n";
17 // undo standardization
18 Stat::unstandardize(A, mu, std);
19 stk_cout << "mean(A)=\n" << (mean=Stat::mean(A));
20 stk_cout << "variance(A)=\n"
22
23 return 0;
24}
#define stk_cout
Standard stk output stream.
This file include all the header files of the STK++ project.
Derived & rand(Law::IUnivLaw< Type > const &law)
set random values to this using a distribution law given by the user.
declaration of the point case.
A CArray is a two dimensional array with a continuous storage like a C-array.
Definition STK_CArray.h:130
Normal distribution law.
hidden::SliceVisitorSelector< Derived, hidden::MeanVisitor, Arrays::by_col_ >::type_result mean(Derived const &A)
If A is a row-vector or a column-vector then the function will return the usual mean value of the vec...
hidden::FunctorTraits< Derived, VarianceWithFixedMeanOp >::Row varianceWithFixedMean(Derived const &A, MeanType const &mean, bool unbiased)
Compute the VarianceWithFixedMean(s) value(s) of A.
void unstandardize(Array &m, RowVector const &std)
undo the standardization by columns of the standardized variable m.
hidden::FunctorTraits< Derived, MeanOp >::Row mean(Derived const &A)
Compute the mean(s) value(s) of A.
void standardize(Array &m, RowVector &mean, RowVector &std, bool unbiased=false)
Compute the mean and the standard deviation by columns of the variable m and standardize it.
The namespace STK is the main domain space of the Statistical ToolKit project.
int main(int argc, char **argv)