1 | | Here, we use the {\tt ARX} class to estimate parameters and structure. ARX model is defined as follows: \[ y_t = \theta' \psi_t + \rho e_t \] where $y_t$ is the system output, $[\theta,\rho]$ is vector of unknown parameters, $\psi_t$ is an vector of data-dependent regressors, and noise $e_t$ is assumed to be Normal distributed $\mathcal{N}(0,1)$. |
| 1 | \hypertarget{arx_ui}{}\subsection{Running experiment $\backslash$c estimator with ARX data fields}\label{arx_ui} |
| 2 | The experiment estimator::cpp can be run either on command line, or as a mex file in Matlab.\hypertarget{arx_ui_cmd}{}\section{Command-line usage}\label{arx_ui_cmd} |
| 3 | In order to use it for estimation of an ARX model, we can define the following \hyperlink{ui}{User Infos and their use} structure: |
3 | | Special cases include:...\hypertarget{arx_math}{}\section{Mathematical background:}\label{arx_math} |
4 | | This particular model belongs to the exponential family, hence it has conjugate distribution of the Gauss-inverse-Wishart form (class egiw). See, \mbox{[}reference\mbox{]} for details. |
| 5 | \begin{DocInclude}\begin{verbatim}//Data generating system |
| 6 | system = { |
| 7 | type = "ArxDS"; |
| 8 | y = {type="rv"; names=["y", "u"];}; |
| 9 | u = {type="rv"; names=[]; }; |
| 10 | rgr = {type="rv"; |
| 11 | names = ["y","y","y","u"]; |
| 12 | times = [-1, -2, -3, -1]; |
| 13 | }; |
| 14 | //AR parameters |
| 15 | theta = [0.8, -0.3, 0.4, 1.0, |
| 16 | 0.0, 0.0, 0.0, 0.0]; |
| 17 | // offset |
| 18 | offset = [0.0, 0.0]; |
| 19 | //variance |
| 20 | r = [0.1, 0.0, |
| 21 | 0.0, 1.0]; |
| 22 | // log also theta |
| 23 | opt="L_theta"; |
| 24 | }; |
9 | | Structure estimation is implemented in method ARX::structure\_\-est() which uses brute force tree search approach.\hypertarget{arx_exa}{}\section{Examples of Use:}\label{arx_exa} |
10 | | There are many ways how to use the object.\begin{itemize} |
11 | | \item Pure C++, as it is used in unit testing of the class arx, \hyperlink{arx__test_8cpp}{arx\_\-test.cpp}\item C++ application with UI configuration file, arx\_\-test\_\-ui\item Matlab interface, arx\_\-matlab \end{itemize} |
| 33 | //estimation |
| 34 | estimator = { |
| 35 | type = "ARXest"; |
| 36 | y = {type="rv"; names=["y"]; }; |
| 37 | rgr = {type="rv"; |
| 38 | names = ["y","y","y","u"]; |
| 39 | times = [-1, -2, -3, -1]; |
| 40 | }; |
| 41 | |
| 42 | //optional fields |
| 43 | dV0 = [1e-3, 1e-5, 1e-5, 1e-5, 1e-5]; //default: 1e-3 for y, 1e-5 for rgr |
| 44 | nu0 = 8.; //default: rgrlen + 2 |
| 45 | frg = 1.0; // forgetting, default frg=1.0 |
| 46 | }; |
| 47 | |
| 48 | //experiment description |
| 49 | experiment:{ |
| 50 | ndat = 9000; |
| 51 | }; |
| 52 | \end{verbatim} |
| 53 | \end{DocInclude} |
| 54 | \hypertarget{arx_ui}{}\subsection{Running experiment $\backslash$c estimator with ARX data fields}\label{arx_ui} |
| 55 | The experiment estimator::cpp can be run either on command line, or as a mex file in Matlab.\hypertarget{arx_ui_cmd}{}\section{Command-line usage}\label{arx_ui_cmd} |
| 56 | In order to use it for estimation of an ARX model, we can define the following \hyperlink{ui}{User Infos and their use} structure: |
| 57 | |
| 58 | \begin{DocInclude}\begin{verbatim}//Data generating system |
| 59 | system = { |
| 60 | type = "ArxDS"; |
| 61 | y = {type="rv"; names=["y", "u"];}; |
| 62 | u = {type="rv"; names=[]; }; |
| 63 | rgr = {type="rv"; |
| 64 | names = ["y","y","y","u"]; |
| 65 | times = [-1, -2, -3, -1]; |
| 66 | }; |
| 67 | //AR parameters |
| 68 | theta = [0.8, -0.3, 0.4, 1.0, |
| 69 | 0.0, 0.0, 0.0, 0.0]; |
| 70 | // offset |
| 71 | offset = [0.0, 0.0]; |
| 72 | //variance |
| 73 | r = [0.1, 0.0, |
| 74 | 0.0, 1.0]; |
| 75 | // log also theta |
| 76 | opt="L_theta"; |
| 77 | }; |
| 78 | |
| 79 | //store results |
| 80 | logger = { |
| 81 | type= "dirfilelog"; |
| 82 | dirname = "exp/arx_ui"; |
| 83 | maxlen = 1000; // |
| 84 | }; |
| 85 | |
| 86 | //estimation |
| 87 | estimator = { |
| 88 | type = "ARXest"; |
| 89 | y = {type="rv"; names=["y"]; }; |
| 90 | rgr = {type="rv"; |
| 91 | names = ["y","y","y","u"]; |
| 92 | times = [-1, -2, -3, -1]; |
| 93 | }; |
| 94 | |
| 95 | //optional fields |
| 96 | dV0 = [1e-3, 1e-5, 1e-5, 1e-5, 1e-5]; //default: 1e-3 for y, 1e-5 for rgr |
| 97 | nu0 = 8.; //default: rgrlen + 2 |
| 98 | frg = 1.0; // forgetting, default frg=1.0 |
| 99 | }; |
| 100 | |
| 101 | //experiment description |
| 102 | experiment:{ |
| 103 | ndat = 9000; |
| 104 | }; |
| 105 | \end{verbatim} |
| 106 | \end{DocInclude} |
| 107 | |