S = prior(S,Expr,PriorFunc,...)
S = prior(S,Expr,[],...)
S
[ systempriors ] - System priors object.
Expr
[ char ] - Expression that defines a value for which a prior density will be defined; see Description for system properties that can be referred to in the expression.
PriorFunc
[ function_handle | empty ] - Function handle returning the log of prior density; empty prior function, []
, means a uniform prior.
S
[ systempriors ] - The system priors object with the new prior added.'lowerBound='
[ numeric | -Inf
] - Lower bound for the prior.
'upperBound='
[ numeric | Inf
] - Upper bound for the prior.
Expr
srf[VarName,ShockName,T]
- Plain shock response function of variables VarName
to shock ShockName
in period T
. Mind the square brackets.
ffrf[VarName,MVarName,Freq]
- Filter frequency response function of transition variables TVarName
to measurement variable MVarName
at frequency Freq
. Mind the square brackets.
corr[VarName1,VarName2,Lag]
- Correlation between variable VarName1
and variables VarName2
lagged by Lag
periods.
spd[VarName1,VarName2,Freq]
- Spectral density between variables VarName1
and VarName2
at frequency Freq
.
If a variable is declared as a log variable
, it must be referred to as log(VarName)
in the above expressions, and the log of that variables is returned, e.g. srf[log(VarName),ShockName,T]
. or ffrf[log(TVarName),MVarName,T]
.
Model parameter names can be referred to in Expr
preceded by a dot (period), e.g. .alpha^2 + .beta^2
defines a prior on the sum of squares of the two parameters (alpha
and beta
).
Create a new empty systemprios object based on an existing model.
s = systempriors(m);
Add a prior on minus the shock response function of variable ygap
to shock eps_pie
in period 4. The prior density is lognormal with mean 0.3 and std deviation 0.05;
s = prior(s,'-srf[ygap,eps_pie,4]',logdist.lognormal(0.3,0.05));
Add a prior on the gain of the frequency response function of transition variable ygap
to measurement variable 'y' at frequency 2*pi/40
. The prior density is normal with mean 0.5 and std deviation 0.01. This prior says that we wish to keep the cut-off periodicity for trend-cycle decomposition close to 40 periods.
s = prior(s,'abs(ffrf[ygap,y,2*pi/40])',logdist.normal(0.5,0.01));
Add a prior on the sum of parameters alpha1
and alpha2
. The prior is normal with mean 0.9 and std deviation 0.1, but the sum is forced to be between 0 and 1 by imposing lower and upper bounds.
s = prior(s,'alpha1+alpha2',logdist.normal(0.9,0.1), ...
'lowerBound=',0,'upperBound=',1);