HMM Procedure
PRIOR Statement
PRIOR distribution <, …, distribution>;
The PRIOR statement specifies the initial hyperparameter values in the prior distributions of the parameters when the maximum a posteriori method is applied to the estimation of the HMM (that is, when METHOD=MAP in the MODEL statement). If you specify the maximum likelihood (ML) method (METHOD=ML), the PRIOR statement is ignored. You can specify only one PRIOR statement. If you specify more than one distribution, separate them with commas.
If you specify the NSTATE= option or the YLAG=
option (or both) in the MODEL statement to estimate multiple models, the PRIOR statement is applied to the first model that corresponds to the specification of NSTATE=
or YLAG=
(or that corresponds to both NSTATE=
and YLAG=
if both options are specified).
To use the PRIOR statement, you need to know the type of the model: different sets of prior distributions are available for different types of HMMs.
The distribution is in the following format:
You can specify the following parameter-names:
- CPM
indicates the category probability matrix in the finite HMM. The prior distribution must be the Dirichlet distribution.
- ISPV
indicates the initial state probability vector. The prior distribution must be the Dirichlet distribution.
- LAMBDA
indicates the mean vector in the Poisson HMM. The prior distribution must be the gamma distribution.
- MCP
indicates the mixture component probabilities in the Gaussian mixture HMM (GM HMM). The prior distribution must be the Dirichlet distribution.
- MUSIGMA
indicates the mean and covariance parameters for the observation distributions. For the Gaussian HMM, regime-switching regression model, or regime-switching autoregression model, the prior distribution of the mean and covariance parameters for each state must be the normal-inverse-Wishart (NIW) distribution. For the GM HMM, the prior distribution of the mean and covariance parameters for each component at each state must be the normal-inverse-Wishart (NIW) distribution.
- TPM
indicates the transition probability matrix. The prior distribution must be the Dirichlet distribution.
You can specify the following distribution-functions:
- DIR
specifies the Dirichlet distribution. There is one argument for the Dirichlet distribution, and it must be a valid matrix expression of the proper size. For example, if the Dirichlet distribution is the prior distribution of the ISPV, MCP, CPM or TPM, the size of the argument must be the same as the size of the ISPV, MCP, CPM or TPM. All elements of the argument should be positive. If you specify any nonpositive element in the argument, the nonpositive element is changed to the machine precision. For information about how to define the matrix expressions, see the section Matrix Expression. For more information about the Dirichlet distribution, see the section Maximum a Posteriori (MAP) Method.
- GAMMA
specifies the gamma distribution. There are two arguments (
) for the gamma distribution, and they must be a valid matrix expression of the proper size. The size of the arguments must be a
matrix. All elements of the arguments should be positive. If you specify any nonpositive element in the argument, the nonpositive element is changed to the machine precision. For information about how to define the matrix expressions, see the section Matrix Expression. For more information about the gamma distribution, see the section Maximum a Posteriori (MAP) Method.
- NIW
-
specifies the normal-inverse-Wishart (NIW) distribution. There are four arguments for the NIW distribution (
, and
), and they must be valid matrix expressions of the proper size. If the NIW distribution is the prior distribution of the MUSIGMA for Gaussian HMM, then the following statements are true:
If the NIW distribution is the prior distribution of the MUSIGMA for GM HMM, then the following statements are true:
If the NIW distribution is the prior distribution of the MUSIGMA for regime-switching regression or regime-switching autoregression, then the following statements are true:
is a
matrix, where K is the number of states,
is the number of dependent variables, and
is the number of regressors in each equation. (For more information about how to calculate
, see the sections Regime-Switching Regression Model and Regime-Switching Autoregression Model.)
For information about how to define the matrix expressions, see the section Matrix Expression. For more information about the normal-inverse-Wishart (NIW) distribution, see the section Maximum a Posteriori (MAP) Method.
The following statements specify the PRIOR statement for the ISPV, TPM, and MUSIGMA in a bivariate three-state Gaussian HMM:
proc hmm data=mylib.One;
id time=t;
model x y / type=gaussian nstate=3 estispv method=map;
prior ISPV ~ dir(J(3,1,1)),
TPM ~ dir(I(3)*100+J(3,3,1)),
MUSIGMA ~ niw(J(1,2,-1) // J(1,2,0) // J(1,2,1),
J(3,1,1)@(I(2)*10),
5*J(3,1,1),
10*J(3,1,1));
run;