[172] | 1 | \hypertarget{classARX}{ |
---|
[99] | 2 | \section{ARX Class Reference} |
---|
| 3 | \label{classARX}\index{ARX@{ARX}} |
---|
[172] | 4 | } |
---|
[99] | 5 | Linear Autoregressive model with Gaussian noise. |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | {\tt \#include $<$arx.h$>$} |
---|
| 9 | |
---|
| 10 | Inheritance diagram for ARX:\nopagebreak |
---|
| 11 | \begin{figure}[H] |
---|
| 12 | \begin{center} |
---|
| 13 | \leavevmode |
---|
[172] | 14 | \includegraphics[width=43pt]{classARX__inherit__graph} |
---|
[99] | 15 | \end{center} |
---|
| 16 | \end{figure} |
---|
| 17 | Collaboration diagram for ARX:\nopagebreak |
---|
| 18 | \begin{figure}[H] |
---|
| 19 | \begin{center} |
---|
| 20 | \leavevmode |
---|
[172] | 21 | \includegraphics[width=96pt]{classARX__coll__graph} |
---|
[99] | 22 | \end{center} |
---|
| 23 | \end{figure} |
---|
| 24 | \subsection*{Public Member Functions} |
---|
| 25 | \begin{CompactItemize} |
---|
| 26 | \item |
---|
[172] | 27 | \hypertarget{classARX_545e269bf7852c81484cf361b54d9917}{ |
---|
| 28 | \hyperlink{classARX_545e269bf7852c81484cf361b54d9917}{ARX} (const \hyperlink{classRV}{RV} \&\hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}, const mat \&V0, const double \&nu0, const double frg0=1.0)} |
---|
| 29 | \label{classARX_545e269bf7852c81484cf361b54d9917} |
---|
[99] | 30 | |
---|
| 31 | \begin{CompactList}\small\item\em Full constructor. \item\end{CompactList}\item |
---|
[172] | 32 | \hypertarget{classARX_a5358883a49b52f50755ad8770c2bbdb}{ |
---|
| 33 | \hyperlink{classARX_a5358883a49b52f50755ad8770c2bbdb}{ARX} (const \hyperlink{classARX}{ARX} \&A0)} |
---|
| 34 | \label{classARX_a5358883a49b52f50755ad8770c2bbdb} |
---|
[140] | 35 | |
---|
[172] | 36 | \begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item |
---|
[180] | 37 | \hypertarget{classARX_5de61fbd4f97fa3216760b1f733f5af0}{ |
---|
| 38 | \hyperlink{classARX}{ARX} $\ast$ \hyperlink{classARX_5de61fbd4f97fa3216760b1f733f5af0}{\_\-copy\_\-} (bool changerv=false)} |
---|
| 39 | \label{classARX_5de61fbd4f97fa3216760b1f733f5af0} |
---|
[172] | 40 | |
---|
| 41 | \begin{CompactList}\small\item\em Auxiliary function. \item\end{CompactList}\item |
---|
| 42 | \hypertarget{classARX_bc8c36399e82b2fc504baed845ed2007}{ |
---|
| 43 | void \hyperlink{classARX_bc8c36399e82b2fc504baed845ed2007}{set\_\-parameters} (const \hyperlink{classldmat}{ldmat} \&V0, const double \&nu0)} |
---|
| 44 | \label{classARX_bc8c36399e82b2fc504baed845ed2007} |
---|
| 45 | |
---|
[145] | 46 | \begin{CompactList}\small\item\em Set sufficient statistics. \item\end{CompactList}\item |
---|
[172] | 47 | \hypertarget{classARX_26925d66dfc366815c497d67b62ee49c}{ |
---|
| 48 | void \hyperlink{classARX_26925d66dfc366815c497d67b62ee49c}{set\_\-statistics} (const \hyperlink{classBMEF}{BMEF} $\ast$BM0)} |
---|
| 49 | \label{classARX_26925d66dfc366815c497d67b62ee49c} |
---|
[140] | 50 | |
---|
[172] | 51 | \begin{CompactList}\small\item\em get statistics from another model \item\end{CompactList}\item |
---|
| 52 | \hypertarget{classARX_29f55b43b8b6f5c4a55f6176aa85c494}{ |
---|
| 53 | void \hyperlink{classARX_29f55b43b8b6f5c4a55f6176aa85c494}{get\_\-parameters} (mat \&V0, double \&nu0)} |
---|
| 54 | \label{classARX_29f55b43b8b6f5c4a55f6176aa85c494} |
---|
| 55 | |
---|
[145] | 56 | \begin{CompactList}\small\item\em Returns sufficient statistics. \item\end{CompactList}\item |
---|
[172] | 57 | \hypertarget{classARX_14d62abfe355275ea3b8d0c5d40f01a0}{ |
---|
| 58 | void \hyperlink{classARX_14d62abfe355275ea3b8d0c5d40f01a0}{bayes} (const vec \&dt, const double w)} |
---|
| 59 | \label{classARX_14d62abfe355275ea3b8d0c5d40f01a0} |
---|
[99] | 60 | |
---|
| 61 | \begin{CompactList}\small\item\em Here $dt = [y_t psi_t] $. \item\end{CompactList}\item |
---|
[172] | 62 | void \hyperlink{classARX_ba82c956ca893826811aefe1e4af465d}{bayes} (const vec \&dt) |
---|
| 63 | \begin{CompactList}\small\item\em Incremental Bayes rule. \item\end{CompactList}\item |
---|
| 64 | \hypertarget{classARX_c13df43e0af87697fda6b457d56a6d45}{ |
---|
| 65 | const \hyperlink{classepdf}{epdf} \& \hyperlink{classARX_c13df43e0af87697fda6b457d56a6d45}{\_\-epdf} () const } |
---|
| 66 | \label{classARX_c13df43e0af87697fda6b457d56a6d45} |
---|
[99] | 67 | |
---|
[210] | 68 | \begin{CompactList}\small\item\em Returns a reference to the \hyperlink{classepdf}{epdf} representing posterior density on parameters. \item\end{CompactList}\item |
---|
[172] | 69 | double \hyperlink{classARX_e7f9e7823aec9bf7ddc3b42d9b3304c4}{logpred} (const vec \&dt) const |
---|
| 70 | \item |
---|
[181] | 71 | \hypertarget{classARX_d75fadb7f828bf134df30919b8baf6b2}{ |
---|
| 72 | void \hyperlink{classARX_d75fadb7f828bf134df30919b8baf6b2}{flatten} (const \hyperlink{classBMEF}{BMEF} $\ast$B)} |
---|
| 73 | \label{classARX_d75fadb7f828bf134df30919b8baf6b2} |
---|
[172] | 74 | |
---|
[181] | 75 | \begin{CompactList}\small\item\em Flatten the posterior according to the given \hyperlink{classBMEF}{BMEF} (of the same type!). \item\end{CompactList}\item |
---|
[210] | 76 | \hypertarget{classARX_f91dfaec69c6e10c57d86f0859f34ba5}{ |
---|
| 77 | \hyperlink{classenorm}{enorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \hyperlink{classARX_f91dfaec69c6e10c57d86f0859f34ba5}{predictor} (const \hyperlink{classRV}{RV} \&rv0, const vec \&rgr) const } |
---|
| 78 | \label{classARX_f91dfaec69c6e10c57d86f0859f34ba5} |
---|
[181] | 79 | |
---|
[210] | 80 | \begin{CompactList}\small\item\em Conditional version of the predictor. \item\end{CompactList}\item |
---|
| 81 | \hypertarget{classARX_4594754b45de9bde272f62b5a5194c2d}{ |
---|
| 82 | \hyperlink{classenorm}{enorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \hyperlink{classARX_4594754b45de9bde272f62b5a5194c2d}{predictor} (const \hyperlink{classRV}{RV} \&rv0) const } |
---|
| 83 | \label{classARX_4594754b45de9bde272f62b5a5194c2d} |
---|
| 84 | |
---|
[181] | 85 | \begin{CompactList}\small\item\em Constructs a predictive density (marginal density on data). \item\end{CompactList}\item |
---|
[210] | 86 | \hypertarget{classARX_cd346a34d06bb4e2751aa1d877131428}{ |
---|
| 87 | \hyperlink{classmlnorm}{mlnorm}$<$ \hyperlink{classldmat}{ldmat} $>$ $\ast$ \textbf{predictor} (const \hyperlink{classRV}{RV} \&rv0, const \hyperlink{classRV}{RV} \&rvc0) const } |
---|
| 88 | \label{classARX_cd346a34d06bb4e2751aa1d877131428} |
---|
| 89 | |
---|
| 90 | \item |
---|
| 91 | \hypertarget{classARX_4d5a97701b1896036de15a3d35ac7c08}{ |
---|
| 92 | \hyperlink{classmlstudent}{mlstudent} $\ast$ \textbf{predictor\_\-student} (const \hyperlink{classRV}{RV} \&rv0, const \hyperlink{classRV}{RV} \&rvc0) const } |
---|
| 93 | \label{classARX_4d5a97701b1896036de15a3d35ac7c08} |
---|
| 94 | |
---|
| 95 | \item |
---|
[172] | 96 | ivec \hyperlink{classARX_130bb7336aac681ce14b027b8f1409fa}{structure\_\-est} (\hyperlink{classegiw}{egiw} Eg0) |
---|
[99] | 97 | \begin{CompactList}\small\item\em Brute force structure estimation. \item\end{CompactList}\item |
---|
[210] | 98 | \hypertarget{classARX_17fa4c274741425cc385748fb97c4735}{ |
---|
| 99 | const \hyperlink{classegiw}{egiw} $\ast$ \hyperlink{classARX_17fa4c274741425cc385748fb97c4735}{\_\-e} () const } |
---|
| 100 | \label{classARX_17fa4c274741425cc385748fb97c4735} |
---|
[181] | 101 | |
---|
[210] | 102 | \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 |
---|
[172] | 103 | \hypertarget{classBM_0186270f75189677f390fe088a9947e9}{ |
---|
| 104 | virtual void \hyperlink{classBM_0186270f75189677f390fe088a9947e9}{bayesB} (const mat \&Dt)} |
---|
| 105 | \label{classBM_0186270f75189677f390fe088a9947e9} |
---|
[140] | 106 | |
---|
[99] | 107 | \begin{CompactList}\small\item\em Batch Bayes rule (columns of Dt are observations). \item\end{CompactList}\item |
---|
[180] | 108 | \hypertarget{classBM_cd0660f2a1a344b56ac39802708ff165}{ |
---|
| 109 | vec \hyperlink{classBM_cd0660f2a1a344b56ac39802708ff165}{logpred\_\-m} (const mat \&dt) const } |
---|
| 110 | \label{classBM_cd0660f2a1a344b56ac39802708ff165} |
---|
| 111 | |
---|
| 112 | \begin{CompactList}\small\item\em Matrix version of logpred. \item\end{CompactList}\item |
---|
[172] | 113 | \hypertarget{classBM_126bd2595c48e311fc2a7ab72876092a}{ |
---|
| 114 | const \hyperlink{classRV}{RV} \& \hyperlink{classBM_126bd2595c48e311fc2a7ab72876092a}{\_\-rv} () const } |
---|
| 115 | \label{classBM_126bd2595c48e311fc2a7ab72876092a} |
---|
[99] | 116 | |
---|
| 117 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
[172] | 118 | \hypertarget{classBM_87f4a547d2c29180be88175e5eab9c88}{ |
---|
| 119 | double \hyperlink{classBM_87f4a547d2c29180be88175e5eab9c88}{\_\-ll} () const } |
---|
| 120 | \label{classBM_87f4a547d2c29180be88175e5eab9c88} |
---|
[99] | 121 | |
---|
[172] | 122 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\item |
---|
| 123 | \hypertarget{classBM_1ffa9f23669aabecc3760c06c6987522}{ |
---|
| 124 | void \hyperlink{classBM_1ffa9f23669aabecc3760c06c6987522}{set\_\-evalll} (bool evl0)} |
---|
| 125 | \label{classBM_1ffa9f23669aabecc3760c06c6987522} |
---|
| 126 | |
---|
[99] | 127 | \begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize} |
---|
| 128 | \subsection*{Protected Attributes} |
---|
| 129 | \begin{CompactItemize} |
---|
| 130 | \item |
---|
[172] | 131 | \hypertarget{classARX_691d023662beffa1dda611b416c0e27e}{ |
---|
| 132 | \hyperlink{classegiw}{egiw} \hyperlink{classARX_691d023662beffa1dda611b416c0e27e}{est}} |
---|
| 133 | \label{classARX_691d023662beffa1dda611b416c0e27e} |
---|
[99] | 134 | |
---|
| 135 | \begin{CompactList}\small\item\em Posterior estimate of $\theta,r$ in the form of Normal-inverse Wishart density. \item\end{CompactList}\item |
---|
[172] | 136 | \hypertarget{classARX_2291297861dd74ca0175a01f910a0ef7}{ |
---|
| 137 | \hyperlink{classldmat}{ldmat} \& \hyperlink{classARX_2291297861dd74ca0175a01f910a0ef7}{V}} |
---|
| 138 | \label{classARX_2291297861dd74ca0175a01f910a0ef7} |
---|
[99] | 139 | |
---|
| 140 | \begin{CompactList}\small\item\em cached value of est.V \item\end{CompactList}\item |
---|
[172] | 141 | \hypertarget{classARX_a4182c281098b2d86b62518a7493d9be}{ |
---|
| 142 | double \& \hyperlink{classARX_a4182c281098b2d86b62518a7493d9be}{nu}} |
---|
| 143 | \label{classARX_a4182c281098b2d86b62518a7493d9be} |
---|
[99] | 144 | |
---|
| 145 | \begin{CompactList}\small\item\em cached value of est.nu \item\end{CompactList}\item |
---|
[172] | 146 | \hypertarget{classBMEF_538d632e59f9afa8daa1de74da12ce71}{ |
---|
| 147 | double \hyperlink{classBMEF_538d632e59f9afa8daa1de74da12ce71}{frg}} |
---|
| 148 | \label{classBMEF_538d632e59f9afa8daa1de74da12ce71} |
---|
[99] | 149 | |
---|
| 150 | \begin{CompactList}\small\item\em forgetting factor \item\end{CompactList}\item |
---|
[172] | 151 | \hypertarget{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02}{ |
---|
| 152 | double \hyperlink{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02}{last\_\-lognc}} |
---|
| 153 | \label{classBMEF_308cf5d4133cd471fdf1ecd5dfa09d02} |
---|
[99] | 154 | |
---|
[106] | 155 | \begin{CompactList}\small\item\em cached value of lognc() in the previous step (used in evaluation of {\tt ll} ) \item\end{CompactList}\item |
---|
[172] | 156 | \hypertarget{classBM_af00f0612fabe66241dd507188cdbf88}{ |
---|
| 157 | \hyperlink{classRV}{RV} \hyperlink{classBM_af00f0612fabe66241dd507188cdbf88}{rv}} |
---|
| 158 | \label{classBM_af00f0612fabe66241dd507188cdbf88} |
---|
[140] | 159 | |
---|
[99] | 160 | \begin{CompactList}\small\item\em Random variable of the posterior. \item\end{CompactList}\item |
---|
[172] | 161 | \hypertarget{classBM_5623fef6572a08c2b53b8c87b82dc979}{ |
---|
| 162 | double \hyperlink{classBM_5623fef6572a08c2b53b8c87b82dc979}{ll}} |
---|
| 163 | \label{classBM_5623fef6572a08c2b53b8c87b82dc979} |
---|
[99] | 164 | |
---|
| 165 | \begin{CompactList}\small\item\em Logarithm of marginalized data likelihood. \item\end{CompactList}\item |
---|
[172] | 166 | \hypertarget{classBM_bf6fb59b30141074f8ee1e2f43d03129}{ |
---|
| 167 | bool \hyperlink{classBM_bf6fb59b30141074f8ee1e2f43d03129}{evalll}} |
---|
| 168 | \label{classBM_bf6fb59b30141074f8ee1e2f43d03129} |
---|
[99] | 169 | |
---|
[172] | 170 | \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} |
---|
[99] | 171 | |
---|
| 172 | |
---|
| 173 | \subsection{Detailed Description} |
---|
| 174 | Linear Autoregressive model with Gaussian noise. |
---|
| 175 | |
---|
| 176 | 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). \] |
---|
| 177 | |
---|
| 178 | 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. |
---|
| 179 | |
---|
| 180 | \subsection{Member Function Documentation} |
---|
[172] | 181 | \hypertarget{classARX_ba82c956ca893826811aefe1e4af465d}{ |
---|
| 182 | \index{ARX@{ARX}!bayes@{bayes}} |
---|
| 183 | \index{bayes@{bayes}!ARX@{ARX}} |
---|
| 184 | \subsubsection[bayes]{\setlength{\rightskip}{0pt plus 5cm}void ARX::bayes (const vec \& {\em dt})\hspace{0.3cm}{\tt \mbox{[}inline, virtual\mbox{]}}}} |
---|
| 185 | \label{classARX_ba82c956ca893826811aefe1e4af465d} |
---|
| 186 | |
---|
| 187 | |
---|
| 188 | Incremental Bayes rule. |
---|
| 189 | |
---|
| 190 | \begin{Desc} |
---|
| 191 | \item[Parameters:] |
---|
| 192 | \begin{description} |
---|
| 193 | \item[{\em dt}]vector of input data \end{description} |
---|
| 194 | \end{Desc} |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | Reimplemented from \hyperlink{classBMEF_52b7719312d545215cca1ff87722a35a}{BMEF}. |
---|
| 198 | |
---|
| 199 | References bayes().\hypertarget{classARX_e7f9e7823aec9bf7ddc3b42d9b3304c4}{ |
---|
| 200 | \index{ARX@{ARX}!logpred@{logpred}} |
---|
| 201 | \index{logpred@{logpred}!ARX@{ARX}} |
---|
| 202 | \subsubsection[logpred]{\setlength{\rightskip}{0pt plus 5cm}double ARX::logpred (const vec \& {\em dt}) const\hspace{0.3cm}{\tt \mbox{[}virtual\mbox{]}}}} |
---|
| 203 | \label{classARX_e7f9e7823aec9bf7ddc3b42d9b3304c4} |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | Evaluates predictive log-likelihood of the given data record I.e. marginal likelihood of the data with the posterior integrated out. |
---|
| 207 | |
---|
| 208 | Reimplemented from \hyperlink{classBM_8a8ce6df431689964c41cc6c849cfd06}{BM}. |
---|
| 209 | |
---|
| 210 | 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}{ |
---|
[99] | 211 | \index{ARX@{ARX}!structure\_\-est@{structure\_\-est}} |
---|
| 212 | \index{structure\_\-est@{structure\_\-est}!ARX@{ARX}} |
---|
[172] | 213 | \subsubsection[structure\_\-est]{\setlength{\rightskip}{0pt plus 5cm}ivec ARX::structure\_\-est ({\bf egiw} {\em Eg0})}} |
---|
| 214 | \label{classARX_130bb7336aac681ce14b027b8f1409fa} |
---|
[99] | 215 | |
---|
| 216 | |
---|
| 217 | Brute force structure estimation. |
---|
| 218 | |
---|
| 219 | \begin{Desc} |
---|
| 220 | \item[Returns:]indeces of accepted regressors. \end{Desc} |
---|
| 221 | |
---|
| 222 | |
---|
[210] | 223 | References RV::count(), est, and egiw::lognc(). |
---|
[99] | 224 | |
---|
| 225 | The documentation for this class was generated from the following files:\begin{CompactItemize} |
---|
| 226 | \item |
---|
[172] | 227 | work/git/mixpp/bdm/estim/\hyperlink{arx_8h}{arx.h}\item |
---|
[145] | 228 | work/git/mixpp/bdm/estim/arx.cpp\end{CompactItemize} |
---|