bnlssm
Description
bnlssm
creates a bnlssm
object, representing a
Bayesian nonlinear non-Gaussian state-space
model, from a specified nonlinear mapping function, which defines the state-space
model structure, and the log prior distribution function of the parameters. The state-space
model can be time-invariant or time-varying (see Decide on Model Structure), and the state or observation
variables, xt or
yt, respectively, can be multivariate series.
State disturbances are Gaussian random variables, and the observation innovations have a
custom distribution.
In general, a bnlssm
object specifies the joint prior distribution
and characteristics of the state-space model only. That is, the model object is a template
intended for further use.
Alternative state-space models include:
Creation
Syntax
Description
creates the Bayesian nonlinear non-Gaussian
state-space model object PriorMdl
= bnlssm(ParamMap
,ParamDistribution
)PriorMdl
.
ParamMap
is a function of the collection of state-space model
parameters Θ that characterizes the nonlinear state dynamics (transition of states
xt from time t – 1 to
t) and nonlinear state measurements (observations)
yt. ParamDistribution
is the log prior density of Θ. The state model has additive linear Gaussian disturbances
ut; the observation model can have additive
linear Gaussian innovations εt or
yt can have a custom density.
PriorMdl
is a template that specifies the joint prior distribution
of Θ and the structure of the nonlinear state-space model.
sets properties using name-value
arguments. For example,
PriorMdl
= bnlssm(ParamMap
,ParamDistribution
,Name=Value
)bnlssm(ParamMap,ParamDistribution,ObservationForm="distribution")
specifies that the observation log density
log(p(yt|xt))
is custom and defined in ParamMap
.
Input Arguments
Properties
Object Functions
estimate | Estimate posterior distribution of Bayesian nonlinear non-Gaussian state-space model parameters |
filter | Forward recursion of Bayesian nonlinear non-Gaussian state-space model |
smooth | Backward recursion of Bayesian nonlinear non-Gaussian state-space model |
simsmooth | Bayesian nonlinear non-Gaussian state-space model simulation smoother |
simulate | Simulate posterior draws of Bayesian nonlinear non-Gaussian state-space model parameters |
tune | Tune Bayesian nonlinear non-Gaussian state-space model posterior sampler |
Examples
More About
Tips
Load the data to the MATLAB workspace before creating the model.
Create the parameter-to-matrix mapping function and log prior distribution function each as their own file.
The equation-form model is a special case of the distribution-form model, with
LogY
=@(y,x) log(mvnpdf(y,C(x),D*D'))
.Avoid an arbitrary choice of the initial state distribution.
bnlssm
functions generate the initial particles from the specified initial state distribution, which impacts the performance of the nonlinear filter. If the initial state specification is bad enough, importance weights concentrate on a small number of particles in the first SMC iteration, which might produce unreasonable filtering results. This vulnerability of the nonlinear model behavior contrasts with the stability of the Kalman filter for the linear model, in which the initial state distribution usually has little impact on the filter because the prior is washed out as it processes data.
Algorithms
When At is a coefficient matrix, For each state variable
, default values ofj
Mean0
andCov0
depend onStateType(
:j
)If
StateType(
(stationary state),j
) = 0bnlssm
generates the initial value using the stationary distribution. If you provide all values in the coefficient matrices (that is, your model has no unknown parameters),bnlssm
generates the initial values. Otherwise, the software generates the initial values during estimation.If
StateType(
(constant state),j
) = 1Mean0(
isj
)1
andCov0(
isj
)0
.If
StateType(
(nonstationary or diffuse state),j
) = 2Mean0(
is 0 andj
)Cov0(
isj
)1e7
.
For static states that do not equal 1 throughout the sample, the software cannot assign a value to the degenerate, initial state distribution. Therefore, set the
StateType
of static states to2
. Consequently, the software treats static states as nonstationary and assigns the static state a diffuse initial distribution.bnlssm
models do not store observed responses or predictor data. Supply the data wherever necessary using the appropriate input or name-value pair arguments.DeflateY
is the deflated-observation data, which accommodates a regression component in the observation equation. For example, in this function, which has a linear regression component,Y
is the vector of observed responses andZ
is the vector of predictor data.function [A,B,C,D,Mean0,Cov0,StateType,DeflateY] = ParamFun(theta,Y,Z) ... DeflateY = Y - params(9) - params(10)*Z; ... end
References
Version History
Introduced in R2023b