gEconpy.model.statespace.DSGEStateSpace.make_symbolic_graph#
- DSGEStateSpace.make_symbolic_graph()#
The purpose of the make_symbolic_graph function is to hide tedious parameter allocations from the user. In statespace models, it is extremely rare for an entire matrix to be defined by a single prior distribution. Instead, users expect to place priors over single entries of the matrix. The purpose of this function is to meet that expectation.
Every statespace model needs to implement this function.
ho_1` and :math:` ho_2`), 2 MA parameters (:math:` heta_1` and \(theta_2\)),
and a single innovation covariance (\(\sigma\)). A common way of writing this statespace is:
..math:
egin{align} T &= egin{bmatrix}ho_1 & 1 & 0
- ho_2 & 0 & 1
0 & 0 & 0
end{bmatrix}
R & = egin{bmatrix} 1 heta_1 heta_2 end{bmatrix} Q &= egin{bmatrix} sigma end{bmatrix}
end{align}
To implement this model, we begin by creating the required matrices, and fill in the “fixed” values – the ones at position (0, 1) and (0, 2) in the T matrix, and at position (0, 0) in the R matrix. These are then saved to the class’s PytensorRepresentation – called
ssm.T = np.eye(2, k=1) R = np.concatenate([np.ones(1,1), np.zeros((2, 1))], axis=0) self.ssm['transition'] = T self.ssm['selection'] = R
Next, placeholders need to be inserted for the random variables rho_1, rho_2, theta_1, theta_2, and sigma. This can be done many ways: we could define two vectors, rho and theta, and a scalar for sigma, or five scalars. Whatever is chosen, the choice needs to be consistent with the
param_namesproperty.Suppose the
param_namesare[rho, theta, sigma], then we make one placeholder for each, and insert it into the correctssmmatrix, at the correct location. To create placeholders, use themake_and_register_variablehelper method, which will maintain an internal registry of variables.