%% Implicitly Create Diffuse State-Space Model Containing Regression Component
%%
% This example shows how to implicitly create a diffuse state-space model
% that contains a regression component in the observation equation. The
% state model contains an ARMA(1,1) state and random walk.
%%
% Write a function that specifies how the parameters in |params| map to the
% state-space model matrices, to the initial state values, and to the type of
% state. Specify the regression component by deflating the observations
% within the function. Symbolically, the model is:
%
% $$\begin{array}{l}
% \left[ {\begin{array}{*{20}{c}}
% {{x_{1,t}}}\\
% {{x_{2,t}}}\\
% x_{3,t}
% \end{array}} \right] = \left[ {\begin{array}{*{20}{c}}
% {{\phi _1}}&{{\theta _1}}&0\\
% 0&0&0\\
% 0&0&1
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {{x_{1,t - 1}}}\\
% {{x_{2,t - 1}}}\\
% x_{3,t - 1}
% \end{array}} \right] + \left[ {\begin{array}{*{20}{c}}
% {{\sigma _1}}& 0\\
% 1 & 0\\
% 0 & \sigma_3
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {u_{1,t}}\\
% {u_{3,t}}
% \end{array}} \right]\\
% {y_t} - \beta {z_t} = a_1{x_{1,t}} + a_2x_{3,t}  + {\sigma_2}{\varepsilon _t}.
% \end{array}$$
%
% <include>diffuseRegressionParamMap.m</include>
%%
% Save this code as a file named |diffuseRegressionParamMap.m| to a folder
% on your MATLAB(R) path.
%%
% Create the diffuse state-space model by passing |diffuseRegressionParamMap|
% as a function handle to |dssm|.

% Copyright 2015 The MathWorks, Inc.

Mdl = dssm(@(params)diffuseRegressionParamMap(params,y,z));
%%
% |dssm| implicitly creates the diffuse state-space model. Usually, you
% cannot verify implicitly defined state-space models.
%%
% Before creating the model, ensure that the variables |y| and |z| exist in
% your workspace.
