# Example of ARX model estimation

Here, we use the `ARX` class to estimate parameters and structure. ARX model is defined as follows:

where is the system output, is vector of unknown parameters, is an vector of data-dependent regressors, and noise is assumed to be Normal distributed .

Special cases include:...

## Mathematical background:

This particular model belongs to the exponential family, hence it has conjugate distribution of the Gauss-inverse-Wishart form (class egiw). See, [reference] for details.

For this model, structure estimation is a form of model selection procedure. Specifically, we compare hypotheses that the data were generated by the full model with hypotheses that some regressors in vector are redundant. The number of possible hypotheses is then the number of all possible combinations of all regressors.

## Software implementation:

Estimation with this class of model is perfromed by class ARX which is derived from class BMEF (estimation of exponential family). The posterior density ( ARX::_epdf() ) is class egiw, which represents Gauss-inverse-Wishart density.

Structure estimation is implemented in method ARX::structure_est() which uses brute force tree search approach.

## Examples of Use:

There are many ways how to use the object.

- Pure C++, see below, or unit testing file of class ARX, arx_test.cpp.
- C++ application `estimator` with UI configuration file, Running experiment `estimator` with ARX data fields.
- Matlab .mex file `estimator` with UI configuration file, Running experiment `estimator` with ARX data fields.

The easiest way how to use class ARX is:

    #include <estim/arx.h>
    using namespace bdm;

    // estimation of AR(0) model
    int main() {
            //prior
            mat V0 = 0.00001*eye(2); V0(0,0)= 0.1; //
            ARX Ar;
            Ar.set_statistics(1, V0); //nu is default (set to have finite moments)
                                                              // forgetting is default: 1.0
            mat Data = concat_vertical( randn(1,100), ones(1,100) );
            Ar.bayesB( Data);

            cout << "Expected value of Theta is: " << Ar.posterior().mean() <<endl;
    }

Here, it is assumed that