\hypertarget{classARX}{
\section{ARX Class Reference}
\label{classARX}\index{ARX@{ARX}}
}
Linear Autoregressive model with Gaussian noise.  


{\tt \#include $<$arx.h$>$}

Inheritance diagram for ARX:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=43pt]{classARX__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for ARX:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=96pt]{classARX__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classARX_545e269bf7852c81484cf361b54d9917}{
\hyperlink{classARX_545e269bf7852c81484cf361b54d9917}{ARX} (const \hyperlink{classRV}{RV} \&\hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}, const mat \&V0, const double \&nu0, const double frg0=1.0)}
\label{classARX_545e269bf7852c81484cf361b54d9917}

\begin{CompactList}\small\item\em Full constructor. \item\end{CompactList}\item 
\hypertarget{classARX_a5358883a49b52f50755ad8770c2bbdb}{
\hyperlink{classARX_a5358883a49b52f50755ad8770c2bbdb}{ARX} (const \hyperlink{classARX}{ARX} \&A0)}
\label{classARX_a5358883a49b52f50755ad8770c2bbdb}

\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
\hypertarget{classARX_d2751057811c6fb8f4ff86e1648bcddc}{
\hyperlink{classBM}{BM} $\ast$ \hyperlink{classARX_d2751057811c6fb8f4ff86e1648bcddc}{\_\-copy\_\-} (bool changerv=false)}
\label{classARX_d2751057811c6fb8f4ff86e1648bcddc}

\begin{CompactList}\small\item\em Auxiliary function. \item\end{CompactList}\item 
\hypertarget{classARX_bc8c36399e82b2fc504baed845ed2007}{
void \hyperlink{classARX_bc8c36399e82b2fc504baed845ed2007}{set\_\-parameters} (const \hyperlink{classldmat}{ldmat} \&V0, const double \&nu0)}
\label{classARX_bc8c36399e82b2fc504baed845ed2007}

\begin{CompactList}\small\item\em Set sufficient statistics. \item\end{CompactList}\item 
\hypertarget{classARX_26925d66dfc366815c497d67b62ee49c}{
void \hyperlink{classARX_26925d66dfc366815c497d67b62ee49c}{set\_\-statistics} (const \hyperlink{classBMEF}{BMEF} $\ast$BM0)}
\label{classARX_26925d66dfc366815c497d67b62ee49c}

\begin{CompactList}\small\item\em get statistics from another model \item\end{CompactList}\item 
\hypertarget{classARX_29f55b43b8b6f5c4a55f6176aa85c494}{
void \hyperlink{classARX_29f55b43b8b6f5c4a55f6176aa85c494}{get\_\-parameters} (mat \&V0, double \&nu0)}
\label{classARX_29f55b43b8b6f5c4a55f6176aa85c494}

\begin{CompactList}\small\item\em Returns sufficient statistics. \item\end{CompactList}\item 
\hypertarget{classARX_14d62abfe355275ea3b8d0c5d40f01a0}{
void \hyperlink{classARX_14d62abfe355275ea3b8d0c5d40f01a0}{bayes} (const vec \&dt, const double w)}
\label{classARX_14d62abfe355275ea3b8d0c5d40f01a0}

\begin{CompactList}\small\item\em Here $dt = [y_t psi_t] $. \item\end{CompactList}\item 
void \hyperlink{classARX_ba82c956ca893826811aefe1e4af465d}{bayes} (const vec \&dt)
\begin{CompactList}\small\item\em Incremental Bayes rule. \item\end{CompactList}\item 
\hypertarget{classARX_c13df43e0af87697fda6b457d56a6d45}{
const \hyperlink{classepdf}{epdf} \& \hyperlink{classARX_c13df43e0af87697fda6b457d56a6d45}{\_\-epdf} () const }
\label{classARX_c13df43e0af87697fda6b457d56a6d45}

\begin{CompactList}\small\item\em Returns a pointer to the \hyperlink{classepdf}{epdf} representing posterior density on parameters. Use with care! \item\end{CompactList}\item 
double \hyperlink{classARX_e7f9e7823aec9bf7ddc3b42d9b3304c4}{logpred} (const vec \&dt) const 
\item 
\hypertarget{classARX_365092d4fd1ab769fcf62bf28f364fab}{
void \hyperlink{classARX_365092d4fd1ab769fcf62bf28f364fab}{flatten} (\hyperlink{classBMEF}{BMEF} $\ast$B)}
\label{classARX_365092d4fd1ab769fcf62bf28f364fab}

\begin{CompactList}\small\item\em Flatten the posterior. \item\end{CompactList}\item 
ivec \hyperlink{classARX_130bb7336aac681ce14b027b8f1409fa}{structure\_\-est} (\hyperlink{classegiw}{egiw} Eg0)
\begin{CompactList}\small\item\em Brute force structure estimation. \item\end{CompactList}\item 
\hypertarget{classBM_0186270f75189677f390fe088a9947e9}{
virtual void \hyperlink{classBM_0186270f75189677f390fe088a9947e9}{bayesB} (const mat \&Dt)}
\label{classBM_0186270f75189677f390fe088a9947e9}

\begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item 
\hypertarget{classBM_126bd2595c48e311fc2a7ab72876092a}{
const \hyperlink{classRV}{RV} \& \hyperlink{classBM_126bd2595c48e311fc2a7ab72876092a}{\_\-rv} () const }
\label{classBM_126bd2595c48e311fc2a7ab72876092a}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classBM_87f4a547d2c29180be88175e5eab9c88}{
double \hyperlink{classBM_87f4a547d2c29180be88175e5eab9c88}{\_\-ll} () const }
\label{classBM_87f4a547d2c29180be88175e5eab9c88}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classBM_1ffa9f23669aabecc3760c06c6987522}{
void \hyperlink{classBM_1ffa9f23669aabecc3760c06c6987522}{set\_\-evalll} (bool evl0)}
\label{classBM_1ffa9f23669aabecc3760c06c6987522}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\hypertarget{classARX_691d023662beffa1dda611b416c0e27e}{
\hyperlink{classegiw}{egiw} \hyperlink{classARX_691d023662beffa1dda611b416c0e27e}{est}}
\label{classARX_691d023662beffa1dda611b416c0e27e}

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

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

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

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

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

\begin{CompactList}\small\item\em Random variable of the posterior. \item\end{CompactList}\item 
\hypertarget{classBM_5623fef6572a08c2b53b8c87b82dc979}{
double \hyperlink{classBM_5623fef6572a08c2b53b8c87b82dc979}{ll}}
\label{classBM_5623fef6572a08c2b53b8c87b82dc979}

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

\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{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). \]

Extension for time-variant parameters $\theta_t,r_t$ may be achived using exponential forgetting (Kulhavy and Zarrop, 1993). In such a case, the forgetting factor {\tt frg} $\in <0,1>$ should be given in the constructor. Time-invariant parameters are estimated for {\tt frg} = 1. 

\subsection{Member Function Documentation}
\hypertarget{classARX_ba82c956ca893826811aefe1e4af465d}{
\index{ARX@{ARX}!bayes@{bayes}}
\index{bayes@{bayes}!ARX@{ARX}}
\subsubsection[bayes]{\setlength{\rightskip}{0pt plus 5cm}void ARX::bayes (const vec \& {\em dt})\hspace{0.3cm}{\tt  \mbox{[}inline, virtual\mbox{]}}}}
\label{classARX_ba82c956ca893826811aefe1e4af465d}


Incremental Bayes rule. 

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


Reimplemented from \hyperlink{classBMEF_52b7719312d545215cca1ff87722a35a}{BMEF}.

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


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

Reimplemented from \hyperlink{classBM_8a8ce6df431689964c41cc6c849cfd06}{BM}.

References egiw::\_\-nu(), egiw::\_\-V(), est, BM::evalll, BMEF::frg, BMEF::last\_\-lognc, egiw::lognc(), nu, ldmat::opupdt(), egiw::pow(), and V.\hypertarget{classARX_130bb7336aac681ce14b027b8f1409fa}{
\index{ARX@{ARX}!structure\_\-est@{structure\_\-est}}
\index{structure\_\-est@{structure\_\-est}!ARX@{ARX}}
\subsubsection[structure\_\-est]{\setlength{\rightskip}{0pt plus 5cm}ivec ARX::structure\_\-est ({\bf egiw} {\em Eg0})}}
\label{classARX_130bb7336aac681ce14b027b8f1409fa}


Brute force structure estimation. 

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


References RV::count(), est, egiw::lognc(), and BM::rv.

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