1 | /*! |
---|
2 | \file |
---|
3 | \brief Bayesian Filtering for generalized autoregressive (ARX) model |
---|
4 | \author Vaclav Smidl. |
---|
5 | |
---|
6 | ----------------------------------- |
---|
7 | BDM++ - C++ library for Bayesian Decision Making under Uncertainty |
---|
8 | |
---|
9 | Using IT++ for numerical operations |
---|
10 | ----------------------------------- |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef AR_H |
---|
14 | #define AR_H |
---|
15 | |
---|
16 | #include <itpp/itbase.h> |
---|
17 | #include "../stat/libFN.h" |
---|
18 | #include "../stat/libEF.h" |
---|
19 | |
---|
20 | using namespace itpp; |
---|
21 | |
---|
22 | /*! |
---|
23 | * \brief Linear Autoregressive model with Gaussian noise |
---|
24 | |
---|
25 | Regression of the following kind: |
---|
26 | \f[ |
---|
27 | y_t = \theta_1 \psi_1 + \theta_2 + \psi_2 +\ldots + \theta_n \psi_n + r e_t |
---|
28 | \f] |
---|
29 | where unknown parameters \c rv are \f$[\theta r]\f$, regression vector \f$\psi=\psi(y_{1:t},u_{1:t})\f$ is a known function of past outputs and exogeneous variables \f$u_t\f$. Distrubances \f$e_t\f$ are supposed to be normally distributed: |
---|
30 | \f[ |
---|
31 | e_t \sim \mathcal{N}(0,1). |
---|
32 | \f] |
---|
33 | |
---|
34 | Extension for time-variant parameters \f$\theta_t,r_t\f$ may be achived using exponential forgetting (Kulhavy and Zarrop, 1993). In such a case, the forgetting factor \c frg \f$\in <0,1>\f$ should be given in the constructor. Time-invariant parameters are estimated for \c frg = 1. |
---|
35 | */ |
---|
36 | class ARX: public BM { |
---|
37 | protected: |
---|
38 | //! Posterior estimate of \f$\theta,r\f$ in the form of Normal-inverse Wishart density |
---|
39 | egiw est; |
---|
40 | //! cached value of est.V |
---|
41 | ldmat &V; |
---|
42 | //! cached value of est.nu |
---|
43 | double ν |
---|
44 | //! forgetting factor |
---|
45 | double frg; |
---|
46 | //! cached value of lognc() in the previous step (used in evaluation of \c ll ) |
---|
47 | double last_lognc; |
---|
48 | public: |
---|
49 | //! Full constructor |
---|
50 | ARX (RV &rv, mat &V0, double &nu0, double frg0=1.0) : BM(rv),est(rv,V0,nu0), V(est._V()), nu(est._nu()), frg(frg0){last_lognc=est.lognc();}; |
---|
51 | //! Here \f$dt = [y_t psi_t] \f$. |
---|
52 | void bayes ( const vec &dt ); |
---|
53 | epdf& _epdf() {return est;} |
---|
54 | //! Brute force structure estimation.\return indeces of accepted regressors. |
---|
55 | ivec structure_est(egiw Eg0); |
---|
56 | }; |
---|
57 | |
---|
58 | |
---|
59 | #endif // AR_H |
---|
60 | |
---|