# bdm::ARXfrg Class Reference

## Detailed Description

ARX model conditined by knowledge of the forgetting factor

`#include <arx.h>`

List of all members.

## Public Member Functions
| ARXfrg (const ARXfrg &A0)
ARXfrg * | _copy_ () const
void | condition (const vec &val)
| Substitute `val` for `rvc`.
void | set_statistics (const BMEF *BM0)
| Set sufficient statistics.
virtual void | set_statistics (const BMEF *BM0)
| get statistics from another model
virtual void | flatten (const BMEF *B)
| Flatten the posterior according to the given BMEF (of the same type!).
void | from_setting (const Setting &set)
void | validate ()
| This method TODO.
virtual string | to_string ()
| This method returns a basic info about the current instance.
virtual void | to_setting (Setting &set) const
| This method save all the instance properties into the Setting structure.
Constructors
void | set_parameters (double frg0)
void | set_statistics (int dimx0, const ldmat V0, double nu0=-1.0)
Mathematical operations
void | bayes (const vec &dt, const double w)
| Weighted Bayes .
void | bayes (const vec &dt)
| Incremental Bayes rule.
double | logpred (const vec &dt) const
void | flatten (const BMEF *B)
enorm< ldmat > * | epredictor (const vec &rgr) const
| Conditioned version of the predictor.
enorm< ldmat > * | epredictor () const
| Predictor for empty regressor.
mlnorm< ldmat > * | predictor () const
| conditional version of the predictor
mlstudent * | predictor_student () const
ivec | structure_est (egiw Eg0)
| Brute force structure estimation.
ivec | structure_est_LT (egiw Eg0)
| Smarter structure estimation by Ludvik Tesar.
Access attributes
const egiw & | posterior () const
Connection
void | set_rv (const RV &yrv0, const RV &rgrrv0)
RV & | get_yrv ()
Access to attributes
void | set_rv (const RV &rv)
const RV & | _drv () const
void | set_drv (const RV &rv)
double | _ll () const
void | set_evalll (bool evl0)
Mathematical operations
virtual void | bayesB (const mat &Dt)
| Batch Bayes rule (columns of Dt are observations).
vec | logpred_m (const mat &dt) const
| Matrix version of logpred.
## Protected Attributes
int | dimx
| size of output variable (needed in regressors)
RV | _yrv
RV | rgrrv
| rv of regressor
egiw | est
| Posterior estimate of in the form of Normal-inverse Wishart density.
ldmat & | V
| cached value of est.V
double & | nu
| cached value of est.nu
bool | have_constant
| switch if constant is modelled or not
vec | _dt
| cached value of data vector for have_constant =true
egiw | alter_est
| Alternative estimate of parameters, used in stabilized forgetting, see [Kulhavy].
double | frg
| forgetting factor
double | last_lognc
| cached value of lognc() in the previous step (used in evaluation of `ll` )
RV | drv
| Random variable of the data (optional).
double | ll
| Logarithm of marginalized data likelihood.
bool | evalll
| If true, the filter will compute likelihood of the data record and store it in `ll` . Set to false if you want to save computational time.
## Extension to conditional BM
This extension is useful e.g. in Marginalized Particle Filter (bdm::MPF). Alternatively, it can be used for automated connection to DS when the condition is observed
const RV & | _rvc () const
| access function
RV | rvc
| Name of extension variable.
## Logging of results
virtual void | set_options (const string &opt)
| Set boolean options from a string, recognized are: "logbounds,logll".
virtual void | log_add (logger &L, const string &name="")
| Add all logged variables to a logger.
virtual void | logit (logger &L)
ivec | LIDs
| IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].
ivec | LFlags
| Flags for logging - same size as LIDs, each entry correspond to the same in LIDs.

## Member Function Documentation

ARXfrg* bdm::ARXfrg::_copy_ | ( |  | ) | const`[inline, virtual]`

Copy function required in vectors, Arrays of BM etc. Have to be DELETED manually! Prototype:

     BM* _copy_() const {return new BM(*this);}

Reimplemented from bdm::ARX.

void bdm::ARX::bayes | ( | const vec & | dt | ) | `[inline, virtual, inherited]`

Incremental Bayes rule.

Parameters:

  | dt | vector of input data

Reimplemented from bdm::BMEF.

References bdm::ARX::bayes().

void bdm::ARX::from_setting | ( | const Setting & | set | ) | `[virtual, inherited]`

UI for ARX estimator

            class = 'ARX';
            rv    = RV({names_of_dt} )                 // description of output variables
            rgr   = RV({names_of_regressors}, [-1,-2]} // description of regressor variables
            constant = 1;                              // 0/1 switch if the constant term is modelled or not

            --- optional ---
            V0  = [1 0;0 1];                           // Initial value of information matrix V
              --- OR ---
            dV0 = [1e-3, 1e-5, 1e-5, 1e-5];            // Initial value of diagonal of information matrix V
                                                                                               // default: 1e-3 for rv, 1e-5 for rgr
            nu0 = 6;                                                   // initial value of nu, default: rgrlen + 2
            frg = 1.0;                                 // forgetting, default frg=1.0

            rv_param   = RV({names_of_parameters}}     // description of parametetr names
                                                                                               // default: ["theta_i" and "r_i"]

Reimplemented from bdm::BM.

References bdm::ARX::_dt, bdm::ARX::est, bdm::BMEF::frg, bdm::UI::get(), bdm::ARX::have_constant, bdm::BM::set_options(), bdm::epdf::set_rv(), and bdm::ARX::validate().

double bdm::ARX::logpred | ( | const vec & | dt | ) | const`[virtual, inherited]`

Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out.

Reimplemented from bdm::BM.

References bdm::ARX::est, bdm::BM::evalll, bdm::BMEF::frg, bdm::BMEF::last_lognc, bdm::egiw::lognc(), bdm::ARX::nu, bdm::ldmat::opupdt(), bdm::egiw::pow(), and bdm::ARX::V.

ivec bdm::ARX::structure_est | ( | egiw | Eg0 | ) | `[inherited]`

Brute force structure estimation.

Returns:
  indeces of accepted regressors.

References bdm::epdf::dimension(), bdm::ARX::est, and bdm::egiw::lognc().

ivec bdm::ARX::structure_est_LT | ( | egiw | Eg0 | ) | `[inherited]`

Smarter structure estimation by Ludvik Tesar.

Returns:
  indeces of accepted regressors.

## Member Data Documentation

RV bdm::ARX::_yrv`[protected, inherited]`

description of modelled data in the likelihood function Do NOT access directly, only via `get_yrv()`.

Referenced by bdm::ARX::validate().

The documentation for this class was generated from the following file:

- arx.h