forked from jsphLim/ARIMA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ARMAModel.h
44 lines (34 loc) · 900 Bytes
/
ARMAModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// Created by yue on 18-3-16.
//
#ifndef ARMAMODEL_H
#define ARMAMODEL_H
#include <vector>
#include "ARMAMath.h"
class ARMAModel{
private:
std::vector<double> data;
int p;
int q;
public:
ARMAModel(std::vector<double> data, int p,int q){
this->data=data;
this->p=p;
this->q=q;
}
std::vector<std::vector<double>> solveCoeOfARMA(){
std::vector<std::vector<double>> vec;
ARMAMath ar_math;
std::vector<double> armaCoe(ar_math.computeARMACoe(this->data,p,q));
std::vector<double> arCoe(this->p+1);
for(int i=0;i<arCoe.size();i++) arCoe[i]=armaCoe[i];
std::vector<double> maCoe(this->q+1);
for(int i=0;i<maCoe.size();i++) {
maCoe[i] = armaCoe[i+this->p+1];
}
vec.push_back(arCoe);
vec.push_back(maCoe);
return vec;
}
};
#endif //ARMAMODEL_H