-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeta.h
54 lines (41 loc) · 887 Bytes
/
beta.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
45
46
47
48
49
50
51
52
53
54
#ifndef __BETA_H
#define __BETA_H
#include <iostream>
#include <vector>
#include <eigen/Eigen/Dense>
using namespace std;
using namespace Eigen;
class Beta {
private:
VectorXf time_series_1;
VectorXf time_series_2;
VectorXf residuals;
VectorXf coefficients;
int d;
public:
double beta;
vector<bool> significant;
// Constructor
Beta(VectorXf& ts1, VectorXf ts2);
// Virtual Destructor
virtual ~Beta();
// Train
void train(const bool& predict_ts1 = true);
void regression(
const MatrixXf& X,
const VectorXf& y,
VectorXf& resid,
VectorXf& coeffs);
void _train_recur(
VectorXf& ts_x,
VectorXf& ts_y,
VectorXf& resid,
VectorXf& coeffs,
int& _d);
MatrixXf transform_X(const VectorXf& ts) const;
// Test
bool test_residual_autocorrelation(const int& lag) const;
// Predict
VectorXf predict(const VectorXf& ts1, const VectorXf& ts2);
};
#endif