32 | | <a name="l00045"></a><a class="code" href="classARX.html#e467144efb0a5acbc10dba4eff8638fe">00045</a> <span class="keywordtype">double</span> <a class="code" href="classARX.html#e467144efb0a5acbc10dba4eff8638fe" title="forgetting factor">frg</a>; |
33 | | <a name="l00047"></a><a class="code" href="classARX.html#6d0cd0f0734aa77cdc5e48f1cf6737ec">00047</a> <span class="keywordtype">double</span> <a class="code" href="classARX.html#6d0cd0f0734aa77cdc5e48f1cf6737ec" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>; |
34 | | <a name="l00049"></a><a class="code" href="classARX.html#64ea7c8ff48bf2548bac3e985e24da19">00049</a> <span class="keywordtype">double</span> <a class="code" href="classARX.html#64ea7c8ff48bf2548bac3e985e24da19" title="total likelihood">tll</a>; |
35 | | <a name="l00050"></a>00050 <span class="keyword">public</span>: |
36 | | <a name="l00052"></a><a class="code" href="classARX.html#5fc6c18e73dcc0f1135eef33f42db8be">00052</a> <a class="code" href="classARX.html#5fc6c18e73dcc0f1135eef33f42db8be" title="Full constructor.">ARX</a> (<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>, mat &V0, <span class="keywordtype">double</span> &nu0, <span class="keywordtype">double</span> frg0=1.0) : <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>(rv),<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>(rv,V0,nu0), <a class="code" href="classARX.html#2291297861dd74ca0175a01f910a0ef7" title="cached value of est.V">V</a>(<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._V()), <a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a>(<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._nu()), <a class="code" href="classARX.html#e467144efb0a5acbc10dba4eff8638fe" title="forgetting factor">frg</a>(frg0){<a class="code" href="classARX.html#6d0cd0f0734aa77cdc5e48f1cf6737ec" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a>();<a class="code" href="classARX.html#64ea7c8ff48bf2548bac3e985e24da19" title="total likelihood">tll</a>=0.0;}; |
37 | | <a name="l00054"></a><a class="code" href="classARX.html#3ccef8dc9dbed00ec74dddc949845d39">00054</a> <span class="keywordtype">void</span> <a class="code" href="classARX.html#3ccef8dc9dbed00ec74dddc949845d39" title="Set sufficient statistics.">set_parameters</a>(mat &V0, <span class="keywordtype">double</span> &nu0){<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>()=V0;<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>()=nu0;<a class="code" href="classARX.html#6d0cd0f0734aa77cdc5e48f1cf6737ec" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a>();<a class="code" href="classARX.html#64ea7c8ff48bf2548bac3e985e24da19" title="total likelihood">tll</a>=<a class="code" href="classARX.html#6d0cd0f0734aa77cdc5e48f1cf6737ec" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>;} |
38 | | <a name="l00056"></a><a class="code" href="classARX.html#29f55b43b8b6f5c4a55f6176aa85c494">00056</a> <span class="keywordtype">void</span> <a class="code" href="classARX.html#29f55b43b8b6f5c4a55f6176aa85c494" title="Returns sufficient statistics.">get_parameters</a>(mat &V0, <span class="keywordtype">double</span> &nu0){V0=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>().<a class="code" href="classldmat.html#5b0515da8dc2293d9e4360b74cc26c9e" title="Conversion to full matrix.">to_mat</a>(); nu0=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>();} |
39 | | <a name="l00058"></a>00058 <span class="keywordtype">void</span> <a class="code" href="classARX.html#ba82c956ca893826811aefe1e4af465d" title="Here .">bayes</a> ( <span class="keyword">const</span> vec &dt ); |
40 | | <a name="l00059"></a><a class="code" href="classARX.html#9d8eff7a9df81786191a4c55b27e5b8a">00059</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classARX.html#9d8eff7a9df81786191a4c55b27e5b8a" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>() {<span class="keywordflow">return</span> <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>;} |
41 | | <a name="l00061"></a>00061 ivec <a class="code" href="classARX.html#130bb7336aac681ce14b027b8f1409fa" title="Brute force structure estimation.">structure_est</a>(<a class="code" href="classegiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> Eg0); |
42 | | <a name="l00063"></a><a class="code" href="classARX.html#b8827048ceec8999849e2ed15400cae7">00063</a> <span class="keywordtype">double</span> <a class="code" href="classARX.html#b8827048ceec8999849e2ed15400cae7" title="access function">_tll</a>(){<span class="keywordflow">return</span> <a class="code" href="classARX.html#64ea7c8ff48bf2548bac3e985e24da19" title="total likelihood">tll</a>;} |
43 | | <a name="l00064"></a>00064 }; |
44 | | <a name="l00065"></a>00065 |
45 | | <a name="l00066"></a>00066 |
46 | | <a name="l00067"></a>00067 <span class="preprocessor">#endif // AR_H</span> |
47 | | <a name="l00068"></a>00068 <span class="preprocessor"></span> |
48 | | <a name="l00069"></a>00069 |
| 32 | <a name="l00044"></a>00044 <span class="keyword">public</span>: |
| 33 | <a name="l00046"></a><a class="code" href="classARX.html#545e269bf7852c81484cf361b54d9917">00046</a> <a class="code" href="classARX.html#545e269bf7852c81484cf361b54d9917" title="Full constructor.">ARX</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>, <span class="keyword">const</span> mat &V0, <span class="keyword">const</span> <span class="keywordtype">double</span> &nu0, <span class="keyword">const</span> <span class="keywordtype">double</span> frg0=1.0 ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( rv,frg0 ),<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a> ( rv,V0,nu0 ), <a class="code" href="classARX.html#2291297861dd74ca0175a01f910a0ef7" title="cached value of est.V">V</a> ( <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a> ( <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._nu() ) |
| 34 | <a name="l00047"></a>00047 {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a>();}; |
| 35 | <a name="l00048"></a>00048 |
| 36 | <a name="l00050"></a><a class="code" href="classARX.html#a5358883a49b52f50755ad8770c2bbdb">00050</a> <a class="code" href="classARX.html#545e269bf7852c81484cf361b54d9917" title="Full constructor.">ARX</a> ( <span class="keyword">const</span> <a class="code" href="classARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a> &A0 ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( A0),<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a> ( <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>,A0.<a class="code" href="classARX.html#2291297861dd74ca0175a01f910a0ef7" title="cached value of est.V">V</a>,A0.<a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a> ), <a class="code" href="classARX.html#2291297861dd74ca0175a01f910a0ef7" title="cached value of est.V">V</a> ( <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._V() ), <a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a> ( <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>._nu() ) {}; |
| 37 | <a name="l00051"></a>00051 |
| 38 | <a name="l00053"></a>00053 <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* <a class="code" href="classARX.html#d2751057811c6fb8f4ff86e1648bcddc" title="Auxiliary function.">_copy_</a>(<span class="keywordtype">bool</span> changerv=<span class="keyword">false</span>); |
| 39 | <a name="l00054"></a>00054 |
| 40 | <a name="l00055"></a>00055 <span class="comment">// //! Set parameters given by moments, \c mu (mean of theta), \c R (mean of R) and \c C (variance of theta)</span> |
| 41 | <a name="l00056"></a>00056 <span class="comment">// void set_parameters ( const vec &mu, const mat &R, const mat &C, double dfm){};</span> |
| 42 | <a name="l00058"></a><a class="code" href="classARX.html#bc8c36399e82b2fc504baed845ed2007">00058</a> <span class="comment"></span> <span class="keywordtype">void</span> <a class="code" href="classARX.html#bc8c36399e82b2fc504baed845ed2007" title="Set sufficient statistics.">set_parameters</a> ( <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (typically known as UD).">ldmat</a> &V0, <span class="keyword">const</span> <span class="keywordtype">double</span> &nu0 ) |
| 43 | <a name="l00059"></a>00059 {<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>() =V0;<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>() =nu0;<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a>();} |
| 44 | <a name="l00060"></a>00060 <span class="keywordtype">void</span> <a class="code" href="classARX.html#26925d66dfc366815c497d67b62ee49c" title="get statistics from another model">set_statistics</a> ( <span class="keyword">const</span> <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a>* BM0 ); |
| 45 | <a name="l00062"></a><a class="code" href="classARX.html#29f55b43b8b6f5c4a55f6176aa85c494">00062</a> <span class="keywordtype">void</span> <a class="code" href="classARX.html#29f55b43b8b6f5c4a55f6176aa85c494" title="Returns sufficient statistics.">get_parameters</a> ( mat &V0, <span class="keywordtype">double</span> &nu0 ) {V0=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>().<a class="code" href="classldmat.html#2c1ebc071de4bafbba55b80afd8a7e8e" title="Conversion to full matrix.">to_mat</a>(); nu0=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>();} |
| 46 | <a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="classARX.html#14d62abfe355275ea3b8d0c5d40f01a0" title="Here .">bayes</a> ( <span class="keyword">const</span> vec &dt, <span class="keyword">const</span> <span class="keywordtype">double</span> w ); |
| 47 | <a name="l00065"></a><a class="code" href="classARX.html#ba82c956ca893826811aefe1e4af465d">00065</a> <span class="keywordtype">void</span> <a class="code" href="classARX.html#14d62abfe355275ea3b8d0c5d40f01a0" title="Here .">bayes</a> ( <span class="keyword">const</span> vec &dt ) {<a class="code" href="classARX.html#14d62abfe355275ea3b8d0c5d40f01a0" title="Here .">bayes</a> ( dt,1.0 );}; |
| 48 | <a name="l00066"></a><a class="code" href="classARX.html#c13df43e0af87697fda6b457d56a6d45">00066</a> <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>& <a class="code" href="classARX.html#c13df43e0af87697fda6b457d56a6d45" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_epdf</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>;} |
| 49 | <a name="l00067"></a>00067 <span class="keywordtype">double</span> <a class="code" href="classARX.html#e7f9e7823aec9bf7ddc3b42d9b3304c4">logpred</a> ( <span class="keyword">const</span> vec &dt ) <span class="keyword">const</span>; |
| 50 | <a name="l00068"></a><a class="code" href="classARX.html#365092d4fd1ab769fcf62bf28f364fab">00068</a> <span class="keywordtype">void</span> <a class="code" href="classARX.html#365092d4fd1ab769fcf62bf28f364fab" title="Flatten the posterior.">flatten</a> (<a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a>* B ) { |
| 51 | <a name="l00069"></a>00069 <a class="code" href="classARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>* A=<span class="keyword">dynamic_cast<</span><a class="code" href="classARX.html" title="Linear Autoregressive model with Gaussian noise.">ARX</a>*<span class="keyword">></span>(B); |
| 52 | <a name="l00070"></a>00070 <span class="comment">// nu should be equal to B.nu</span> |
| 53 | <a name="l00071"></a>00071 <a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#036306322a90a9977834baac07460816" title="Power of the density, used e.g. to flatten the density.">pow</a> ( A-><a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a>/<a class="code" href="classARX.html#a4182c281098b2d86b62518a7493d9be" title="cached value of est.nu">nu</a>); |
| 54 | <a name="l00072"></a>00072 <span class="keywordflow">if</span>(<a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>){<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classARX.html#691d023662beffa1dda611b416c0e27e" title="Posterior estimate of in the form of Normal-inverse Wishart density.">est</a>.<a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a>();} |
| 55 | <a name="l00073"></a>00073 } |
| 56 | <a name="l00074"></a>00074 |
| 57 | <a name="l00076"></a>00076 ivec <a class="code" href="classARX.html#130bb7336aac681ce14b027b8f1409fa" title="Brute force structure estimation.">structure_est</a> ( <a class="code" href="classegiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> Eg0 ); |
| 58 | <a name="l00077"></a>00077 }; |
| 59 | <a name="l00078"></a>00078 |
| 60 | <a name="l00079"></a>00079 |
| 61 | <a name="l00080"></a>00080 <span class="preprocessor">#endif // AR_H</span> |
| 62 | <a name="l00081"></a>00081 <span class="preprocessor"></span> |
| 63 | <a name="l00082"></a>00082 |