\hypertarget{classbdm_1_1ARX}{
\section{bdm::ARX Class Reference}
\label{classbdm_1_1ARX}\index{bdm::ARX@{bdm::ARX}}
}
{\tt \#include $<$arx.h$>$}

Inheritance diagram for bdm::ARX::\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=4cm]{classbdm_1_1ARX}
\end{center}
\end{figure}


\subsection{Detailed Description}
Linear Autoregressive model with Gaussian noise. 

Regression of the following kind: \[ y_t = \theta_1 \psi_1 + \theta_2 + \psi_2 +\ldots + \theta_n \psi_n + r e_t \] where unknown parameters {\tt rv} are $[\theta r]$, regression vector $\psi=\psi(y_{1:t},u_{1:t})$ is a known function of past outputs and exogeneous variables $u_t$. Distrubances $e_t$ are supposed to be normally distributed: \[ e_t \sim \mathcal{N}(0,1). \]

See \hyperlink{tut_arx}{Theory of ARX model estimation} for mathematical treatment.

The easiest way how to use the class is: 

\begin{DocInclude}\begin{verbatim}#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;
}
\end{verbatim}
\end{DocInclude}
 \subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_539f9d0127423c94b912708d390e67b8}{
void \hyperlink{classbdm_1_1ARX_539f9d0127423c94b912708d390e67b8}{set\_\-statistics} (const \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$BM0)}
\label{classbdm_1_1ARX_539f9d0127423c94b912708d390e67b8}

\begin{CompactList}\small\item\em Set sufficient statistics. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}{
\hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$ \hyperlink{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}{\_\-copy\_\-} (bool changerv=false)}
\label{classbdm_1_1BMEF_5912dbcf28ae711e30b08c2fa766a3e6}

\begin{CompactList}\small\item\em Flatten the posterior as if to keep nu0 data. \item\end{CompactList}\end{CompactItemize}
\begin{Indent}{\bf Constructors}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_43ed6114f04a3a8756fe2b42eaa35f98}{
\textbf{ARX} (const double frg0=1.0)}
\label{classbdm_1_1ARX_43ed6114f04a3a8756fe2b42eaa35f98}

\item 
\hypertarget{classbdm_1_1ARX_73a55a3d66bfbeeee4df6c2ae40920ed}{
\textbf{ARX} (const \hyperlink{classbdm_1_1ARX}{ARX} \&A0)}
\label{classbdm_1_1ARX_73a55a3d66bfbeeee4df6c2ae40920ed}

\item 
\hyperlink{classbdm_1_1ARX}{ARX} $\ast$ \hyperlink{classbdm_1_1ARX_60c40b5c6abc4c7e464b4ccae64a5a61}{\_\-copy\_\-} ()
\item 
\hypertarget{classbdm_1_1ARX_7aef6fe827f15427d534e6fb2c220e04}{
void \textbf{set\_\-parameters} (double frg0)}
\label{classbdm_1_1ARX_7aef6fe827f15427d534e6fb2c220e04}

\item 
\hypertarget{classbdm_1_1ARX_f859f53eab269845a9064bbd92f841af}{
void \textbf{set\_\-statistics} (int dimx0, const \hyperlink{classldmat}{ldmat} V0, double nu0=-1.0)}
\label{classbdm_1_1ARX_f859f53eab269845a9064bbd92f841af}

\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Mathematical operations}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_17e7fe14654ab3c449846c3f43e66169}{
void \hyperlink{classbdm_1_1ARX_17e7fe14654ab3c449846c3f43e66169}{bayes} (const vec \&dt, const double w)}
\label{classbdm_1_1ARX_17e7fe14654ab3c449846c3f43e66169}

\begin{CompactList}\small\item\em Weighted Bayes $ dt = [y_t psi_t] $. \item\end{CompactList}\item 
void \hyperlink{classbdm_1_1ARX_8bdf2974052e8ce74eb0d4f3791c58a3}{bayes} (const vec \&dt)
\begin{CompactList}\small\item\em Incremental Bayes rule. \item\end{CompactList}\item 
double \hyperlink{classbdm_1_1ARX_080a7e531e3aa06694112863b15bc6a4}{logpred} (const vec \&dt) const 
\item 
\hypertarget{classbdm_1_1ARX_e86ab499b116b837d3163ec852961eca}{
void \hyperlink{classbdm_1_1ARX_e86ab499b116b837d3163ec852961eca}{flatten} (const \hyperlink{classbdm_1_1BMEF}{BMEF} $\ast$B)}
\label{classbdm_1_1ARX_e86ab499b116b837d3163ec852961eca}

\begin{CompactList}\small\item\em Flatten the posterior according to the given \hyperlink{classbdm_1_1BMEF}{BMEF} (of the same type!). \item\end{CompactList}\item 
\hypertarget{classbdm_1_1ARX_749827323c034f11bec61b6e2fc3d42a}{
\hyperlink{classbdm_1_1enorm}{enorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \hyperlink{classbdm_1_1ARX_749827323c034f11bec61b6e2fc3d42a}{epredictor} (const vec \&rgr) const }
\label{classbdm_1_1ARX_749827323c034f11bec61b6e2fc3d42a}

\begin{CompactList}\small\item\em Conditioned version of the predictor. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1ARX_4cdf5e2a7d3480ec31f6247ed4289b15}{
\hyperlink{classbdm_1_1enorm}{enorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \hyperlink{classbdm_1_1ARX_4cdf5e2a7d3480ec31f6247ed4289b15}{epredictor} () const }
\label{classbdm_1_1ARX_4cdf5e2a7d3480ec31f6247ed4289b15}

\begin{CompactList}\small\item\em Predictor for empty regressor. \item\end{CompactList}\item 
\hyperlink{classbdm_1_1mlnorm}{mlnorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \hyperlink{classbdm_1_1ARX_74fe8ae2d88bee8639510fd0eaf73513}{predictor} () const 
\begin{CompactList}\small\item\em conditional version of the predictor \item\end{CompactList}\item 
\hypertarget{classbdm_1_1ARX_c6a2428a46407fe45b4c7a99069c0801}{
\hyperlink{classbdm_1_1mlstudent}{mlstudent} $\ast$ \textbf{predictor\_\-student} () const }
\label{classbdm_1_1ARX_c6a2428a46407fe45b4c7a99069c0801}

\item 
ivec \hyperlink{classbdm_1_1ARX_16b02ae03316751664c22d59d90c1e34}{structure\_\-est} (\hyperlink{classbdm_1_1egiw}{egiw} Eg0)
\begin{CompactList}\small\item\em Brute force structure estimation. \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Access attributes}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_ab2c55205a324e9d698fbd8ac229ad4f}{
const \hyperlink{classbdm_1_1egiw}{egiw} $\ast$ \textbf{\_\-e} () const }
\label{classbdm_1_1ARX_ab2c55205a324e9d698fbd8ac229ad4f}

\item 
\hypertarget{classbdm_1_1ARX_5a96a50d212648f049122a31d9553618}{
const \hyperlink{classbdm_1_1egiw}{egiw} \& \textbf{posterior} () const }
\label{classbdm_1_1ARX_5a96a50d212648f049122a31d9553618}

\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Connection}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_df3dc1b90efc0cc54a3a6e5e858542d1}{
void \textbf{set\_\-drv} (const \hyperlink{classbdm_1_1RV}{RV} \&drv0)}
\label{classbdm_1_1ARX_df3dc1b90efc0cc54a3a6e5e858542d1}

\item 
\hypertarget{classbdm_1_1ARX_7b96872783ab72e135b7b9ee26ef0577}{
\hyperlink{classbdm_1_1RV}{RV} \& \textbf{get\_\-yrv} ()}
\label{classbdm_1_1ARX_7b96872783ab72e135b7b9ee26ef0577}

\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Mathematical operations}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}{
virtual void \hyperlink{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}{bayesB} (const mat \&Dt)}
\label{classbdm_1_1BM_1dee3fddaf021e62d925289660a707dc}

\begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}{
vec \hyperlink{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}{logpred\_\-m} (const mat \&dt) const }
\label{classbdm_1_1BM_0e8ebe61fb14990abe1254bd3dda5fae}

\begin{CompactList}\small\item\em Matrix version of logpred. \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Access to attributes}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1BM_ff2d8755ba0b3def927d31305c03b09c}{
const \hyperlink{classbdm_1_1RV}{RV} \& \textbf{\_\-drv} () const }
\label{classbdm_1_1BM_ff2d8755ba0b3def927d31305c03b09c}

\item 
\hypertarget{classbdm_1_1BM_b38d92f17620813ad872d86e01a26e5e}{
void \textbf{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv)}
\label{classbdm_1_1BM_b38d92f17620813ad872d86e01a26e5e}

\item 
\hypertarget{classbdm_1_1BM_5be65d37dedfe33a3671e7065f523a70}{
double \textbf{\_\-ll} () const }
\label{classbdm_1_1BM_5be65d37dedfe33a3671e7065f523a70}

\item 
\hypertarget{classbdm_1_1BM_236b3abbcc93594fc97cd86d82c1a83f}{
void \textbf{set\_\-evalll} (bool evl0)}
\label{classbdm_1_1BM_236b3abbcc93594fc97cd86d82c1a83f}

\end{CompactItemize}
\end{Indent}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1ARX_8e68db2a218d54b09304cad6c0a897d9}{
int \hyperlink{classbdm_1_1ARX_8e68db2a218d54b09304cad6c0a897d9}{dimx}}
\label{classbdm_1_1ARX_8e68db2a218d54b09304cad6c0a897d9}

\begin{CompactList}\small\item\em size of output variable (needed in regressors) \item\end{CompactList}\item 
\hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1ARX_363aaa55b2ab3eec602510cdf53e84ef}{\_\-yrv}
\item 
\hypertarget{classbdm_1_1ARX_11474a627367f81b76830cb8477cf026}{
\hyperlink{classbdm_1_1egiw}{egiw} \hyperlink{classbdm_1_1ARX_11474a627367f81b76830cb8477cf026}{est}}
\label{classbdm_1_1ARX_11474a627367f81b76830cb8477cf026}

\begin{CompactList}\small\item\em Posterior estimate of $\theta,r$ in the form of Normal-inverse Wishart density. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1ARX_de5b7d83ff5d3f5af2f80068db0abdfd}{
\hyperlink{classldmat}{ldmat} \& \hyperlink{classbdm_1_1ARX_de5b7d83ff5d3f5af2f80068db0abdfd}{V}}
\label{classbdm_1_1ARX_de5b7d83ff5d3f5af2f80068db0abdfd}

\begin{CompactList}\small\item\em cached value of est.V \item\end{CompactList}\item 
\hypertarget{classbdm_1_1ARX_740b0582f180ba13cae91d66e9bdb67f}{
double \& \hyperlink{classbdm_1_1ARX_740b0582f180ba13cae91d66e9bdb67f}{nu}}
\label{classbdm_1_1ARX_740b0582f180ba13cae91d66e9bdb67f}

\begin{CompactList}\small\item\em cached value of est.nu \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}{
double \hyperlink{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}{frg}}
\label{classbdm_1_1BMEF_1331865e10fb1ccef65bb4c47fa3be64}

\begin{CompactList}\small\item\em forgetting factor \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}{
double \hyperlink{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}{last\_\-lognc}}
\label{classbdm_1_1BMEF_06e7b3ac03e10017d4288c76888e2865}

\begin{CompactList}\small\item\em cached value of lognc() in the previous step (used in evaluation of {\tt ll} ) \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}{
\hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}{drv}}
\label{classbdm_1_1BM_c400357e37d27a4834b2b1d9211009ed}

\begin{CompactList}\small\item\em Random variable of the data (optional). \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}{
double \hyperlink{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}{ll}}
\label{classbdm_1_1BM_4064b6559d962633e4372b12f4cd204a}

\begin{CompactList}\small\item\em Logarithm of marginalized data likelihood. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}{
bool \hyperlink{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}{evalll}}
\label{classbdm_1_1BM_faff0ad12556fe7dc0e2807d4fd938ee}

\begin{CompactList}\small\item\em If true, the filter will compute likelihood of the data record and store it in {\tt ll} . Set to false if you want to save computational time. \item\end{CompactList}\end{CompactItemize}


\subsection{Member Function Documentation}
\hypertarget{classbdm_1_1ARX_60c40b5c6abc4c7e464b4ccae64a5a61}{
\index{bdm::ARX@{bdm::ARX}!\_\-copy\_\-@{\_\-copy\_\-}}
\index{\_\-copy\_\-@{\_\-copy\_\-}!bdm::ARX@{bdm::ARX}}
\subsubsection[\_\-copy\_\-]{\setlength{\rightskip}{0pt plus 5cm}{\bf ARX} $\ast$ bdm::ARX::\_\-copy\_\- ()\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
\label{classbdm_1_1ARX_60c40b5c6abc4c7e464b4ccae64a5a61}


Copy function required in vectors, Arrays of \hyperlink{classbdm_1_1BM}{BM} etc. Have to be DELETED manually! Prototype: 

\begin{Code}\begin{verbatim} BM* _copy_(){return new BM(*this);} 
\end{verbatim}
\end{Code}

 

Reimplemented from \hyperlink{classbdm_1_1BM_c0f027ff91d8459937c6f60ff8e553ff}{bdm::BM}.\hypertarget{classbdm_1_1ARX_8bdf2974052e8ce74eb0d4f3791c58a3}{
\index{bdm::ARX@{bdm::ARX}!bayes@{bayes}}
\index{bayes@{bayes}!bdm::ARX@{bdm::ARX}}
\subsubsection[bayes]{\setlength{\rightskip}{0pt plus 5cm}void bdm::ARX::bayes (const vec \& {\em dt})\hspace{0.3cm}{\tt  \mbox{[}inline, virtual\mbox{]}}}}
\label{classbdm_1_1ARX_8bdf2974052e8ce74eb0d4f3791c58a3}


Incremental Bayes rule. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dt}]vector of input data \end{description}
\end{Desc}


Reimplemented from \hyperlink{classbdm_1_1BMEF_c287f4c0c1ea31b91572ec45351838f1}{bdm::BMEF}.

References bayes().\hypertarget{classbdm_1_1ARX_080a7e531e3aa06694112863b15bc6a4}{
\index{bdm::ARX@{bdm::ARX}!logpred@{logpred}}
\index{logpred@{logpred}!bdm::ARX@{bdm::ARX}}
\subsubsection[logpred]{\setlength{\rightskip}{0pt plus 5cm}double bdm::ARX::logpred (const vec \& {\em dt}) const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
\label{classbdm_1_1ARX_080a7e531e3aa06694112863b15bc6a4}


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

Reimplemented from \hyperlink{classbdm_1_1BM_50257e0c1e5b5c73153ea6e716ad8ae0}{bdm::BM}.

References bdm::egiw::\_\-nu(), bdm::egiw::\_\-V(), est, bdm::BM::evalll, bdm::BMEF::frg, bdm::BMEF::last\_\-lognc, bdm::egiw::lognc(), nu, ldmat::opupdt(), bdm::egiw::pow(), and V.\hypertarget{classbdm_1_1ARX_74fe8ae2d88bee8639510fd0eaf73513}{
\index{bdm::ARX@{bdm::ARX}!predictor@{predictor}}
\index{predictor@{predictor}!bdm::ARX@{bdm::ARX}}
\subsubsection[predictor]{\setlength{\rightskip}{0pt plus 5cm}{\bf mlnorm}$<$ {\bf ldmat} $>$ $\ast$ bdm::ARX::predictor () const\hspace{0.3cm}{\tt  \mbox{[}virtual\mbox{]}}}}
\label{classbdm_1_1ARX_74fe8ae2d88bee8639510fd0eaf73513}


conditional version of the predictor 



$<$----------- TODO 

Reimplemented from \hyperlink{classbdm_1_1BM_598b25e3f3d96a5bc00a5faeb5b3c912}{bdm::BM}.

References bdm::epdf::dimension(), est, bdm::egiw::mean\_\-mat(), ldmat::rows(), bdm::mlnorm$<$ sq\_\-T $>$::set\_\-parameters(), and V.\hypertarget{classbdm_1_1ARX_16b02ae03316751664c22d59d90c1e34}{
\index{bdm::ARX@{bdm::ARX}!structure\_\-est@{structure\_\-est}}
\index{structure\_\-est@{structure\_\-est}!bdm::ARX@{bdm::ARX}}
\subsubsection[structure\_\-est]{\setlength{\rightskip}{0pt plus 5cm}ivec bdm::ARX::structure\_\-est ({\bf egiw} {\em Eg0})}}
\label{classbdm_1_1ARX_16b02ae03316751664c22d59d90c1e34}


Brute force structure estimation. 

\begin{Desc}
\item[Returns:]indeces of accepted regressors. \end{Desc}


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

\subsection{Member Data Documentation}
\hypertarget{classbdm_1_1ARX_363aaa55b2ab3eec602510cdf53e84ef}{
\index{bdm::ARX@{bdm::ARX}!\_\-yrv@{\_\-yrv}}
\index{\_\-yrv@{\_\-yrv}!bdm::ARX@{bdm::ARX}}
\subsubsection[\_\-yrv]{\setlength{\rightskip}{0pt plus 5cm}{\bf RV} {\bf bdm::ARX::\_\-yrv}\hspace{0.3cm}{\tt  \mbox{[}protected\mbox{]}}}}
\label{classbdm_1_1ARX_363aaa55b2ab3eec602510cdf53e84ef}


description of modelled data $ y_t $ in the likelihood function Do NOT access directly, only via {\tt get\_\-yrv()}. 

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
\hyperlink{arx_8h}{arx.h}\item 
bdm/estim/arx.cpp\end{CompactItemize}
