96 lines
2.8 KiB
C
96 lines
2.8 KiB
C
|
#ifndef TRANSFORMATION_H
|
|||
|
#define TRANSFORMATION_H
|
|||
|
#include <vector>
|
|||
|
|
|||
|
using namespace std;
|
|||
|
|
|||
|
class Transformation
|
|||
|
{
|
|||
|
private:
|
|||
|
vector <double> SeasonalIndex;
|
|||
|
double GeometricAverage;
|
|||
|
double valueMean;
|
|||
|
double valueSd;
|
|||
|
int tsSizeValue;
|
|||
|
|
|||
|
public:
|
|||
|
vector <double> TimeSeries;
|
|||
|
double INFINITY;
|
|||
|
Transformation(vector<double>);
|
|||
|
~Transformation();
|
|||
|
|
|||
|
// период сезонности для использования в Deseasonalization
|
|||
|
int seasonalPeriod;
|
|||
|
|
|||
|
// параметр трансформации
|
|||
|
double lambda;
|
|||
|
// параметр сдвига значений вектора при наличии в нем отрицательных значений
|
|||
|
double tsShiftValue;
|
|||
|
|
|||
|
// обрабатываемый временной ряд
|
|||
|
void setTimeSeries(vector<double>);
|
|||
|
|
|||
|
int sign(double);
|
|||
|
// auto lambda estimation
|
|||
|
void lambdaEstimation();
|
|||
|
|
|||
|
//Guerrero(1993)
|
|||
|
//Time-series analysis supported by Power Transformations
|
|||
|
double lambdaEstimationGuerrero(double);
|
|||
|
|
|||
|
//Box-Cox(1964)
|
|||
|
vector<double> BoxCox();
|
|||
|
vector<double> invBoxCox();
|
|||
|
|
|||
|
//Manly(1976)
|
|||
|
// -- Negative y’s could be allowed
|
|||
|
// -- The transformation was reported to be successful in transform
|
|||
|
// unimodal skewed distribution into normal distribution, but is
|
|||
|
// not quite useful for bimodal or U - shaped distribution
|
|||
|
vector<double> ExponentialTransformation();
|
|||
|
vector<double> invExponentialTransformation();
|
|||
|
|
|||
|
//John and Draper(1980)
|
|||
|
// -- Negative y’s could be allowed.
|
|||
|
// -- It works best at those distribution that is somewhat symmetric.
|
|||
|
// A power transformation on a symmetric distribution is likel
|
|||
|
// y going to introduce some degree of skewness.
|
|||
|
vector<double> ModulusTransformation();
|
|||
|
vector<double> invModulusTransformation();
|
|||
|
|
|||
|
//Bickel and Doksum(1981)
|
|||
|
// --Negative y’s could be allowed.
|
|||
|
vector<double> AsymptoticBoxCox();
|
|||
|
vector<double> invAsymptoticBoxCox();
|
|||
|
|
|||
|
//Yeo and Johnson (2000)
|
|||
|
// --Negative y’s could be allowed.
|
|||
|
// --When estimating the transformation parameter, found the value of
|
|||
|
// λ that minimizes the Kullback - Leibler distance between
|
|||
|
// the normal distribution and the transformed distribution.
|
|||
|
vector<double> ModifiedBoxCox();
|
|||
|
vector<double> invModifiedBoxCox();
|
|||
|
|
|||
|
// Atkinson(1973)
|
|||
|
// --Negative y’s could be allowed.
|
|||
|
vector<double> NormalizedBoxCox();
|
|||
|
vector<double> invNormalizedBoxCox();
|
|||
|
|
|||
|
// очистка вектора TimeSeries от сезонности
|
|||
|
vector<double> Deseasonalization(int);
|
|||
|
vector<double> invDeseasonalization();
|
|||
|
|
|||
|
// получение средних сезоональных индексов
|
|||
|
vector<double> getSeasonalIndex();
|
|||
|
|
|||
|
// Aggregation time series
|
|||
|
vector <double> Aggregation(int);
|
|||
|
vector <double> invAggregation();
|
|||
|
|
|||
|
// Normalization time series: mean = 0, Sd (Standard deviation) = 1
|
|||
|
vector <double> Normalization();
|
|||
|
vector <double> invNormalization();
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif
|