Commit 8730d284 authored by Houtan Bastani's avatar Houtan Bastani
Browse files

add non-simplified NILE example (from Alessandro)

parent efaf014e
This is an example of input file for DMM.exe
It implements the nile river flow exercise
G.Fiorentini, C.Planas and A.Rossi - Jan 2012
Model: y(t) = mu(t)+c(t)
c(t) = [(S(1t)-1)*delta^(1/2)+(2-S(1t))]*Ve^(1/2)*e(t)
mu(t) = mu(t-1)+[S(2t)-1]*Veps^(1/2)*eps(t)
State-space rep:
x(t) = (mu(t),c(t))
u(t) = (e(t),eps(t))
Paramaeters:
Ve = theta(1)
Veps = theta(2)
delta = theta(3)
State-space format: y(t) = c(t)z(t) + H(t)x(t) + G(t)u(t)
x(t) = a(t) + F(t)x(t-1) + R(t)u(t)
y(t) (ny x 1) ny = # of endogenous series
z(t) (nz x 1) nz = # of exogenous series
x(t) (nx x 1) nx = # of continous states
u(t) (nu x 1) nu = # of shocks
c(t) (ny x nz x ns1)
H(t) (ny x nx x ns2)
G(t) (ny x nu x ns3)
a(t) (nx x ns4)
F(t) (nx x nx x ns5)
R(t) (nx x nu x ns6)
Namelist ssm contains:
nx = number of continuous states
nu = number of shocks
d(1) = order of integration of the system
d(2) = number of non-stationary continuous state variables
nv = number of discrete S variables (<=6)
Dllname = path and name of the dll or the Matlab file
check = to debug the system matrices c, H, G, a, F, and R
dllname=H:\arossi\dmm\nile\nile32.dll 32 bit
dllname=H:\arossi\dmm\nile\nile64.dll 64 bit
dllname=H:\arossi\dmm\nile\NILE.m Matlab
&ssm
nx=2 nu=2 d=1 1 nv=1 check=n estimation=BA dllname=H:\arossi\dmm\nile\NILE.m
&end
Namelist Sj describes discrete latent variables Sj, j = 1,...,nv:
dynSj = time series dynamics for Sj (I=Independent,M=Markov)
nSj = number of states for Sj
hypSj = hyperparameters of Dirichlet(alpha1,...,alphak)
prior pdf for the transition probability parameters
of dimension k ordered by columns
matSj = matrices impacted by Sj (one or more of c H G a F R)
&S1 dynS1=I nS1=4 hypS1(1,1)= 8 4 4 1 matS1=R &end
Namelist prior describes priors pdf of model parameters (except transition probs):
nt = number of theta parameters
pdftheta = prior distribution (NT=Truncated Normal; BE=Beta; IG=Inverse Gamma)
hyptheta = hyperparameter of prior pdf (mean or hyp,sd or hyp,lower bound, upper bound)
Note: if thetahyp(3,j)=thetahyp(4,j) the parameter is not estimated and its
value is fixed at lb=ub
&prior nt = 3
pdftheta(1) = IG hyptheta(1,1) = 6000 6 0 500000
pdftheta(2) = IG hyptheta(1,2) = 6000 6 0 500000
pdftheta(3) = BE hyptheta(1,3) = 2 4 1 20
&end
Namelist mcmc contains the Markov Chain Monte Carlo options:
seed = seed of random number generator (0-999; 0 default)
thin = thinning
burnin = burn-in period
simulrec = number of recorded samples
hbl = block length discrete latent variable (1:GCK, >1: AMH)
&mcmc
seed=0 thin=1 burnin=1000 simulrec=5000 hbl=1 MargLik=n
&end
Namelist dataset provides data:
nobs = number of observations
ny = number of endogenous series
nz = number of exogenous series
nf = number of forecasts
datasim = simulate the data {Y,N}
obs = a matrix of dimension nobs x ny if nz = 0
and (nobs+nf) x (ny+nz) if nz > 0.
any value is allowed for the endogenous vars out-of-sample
Note: use can be made of -99999 to assign missing values to the endogenous variables
&dataset T=100 ny=1 nz=0 nf=10 datasim=n obs=
1120
1160
963
1210
1160
1160
813
1230
1370
1140
995
935
1110
994
1020
960
1180
799
958
1140
1100
1210
1150
1250
1260
1220
1030
1100
774
840
874
694
940
833
701
916
692
1020
1050
969
831
726
456
824
702
1120
1100
832
764
821
768
845
864
862
698
845
744
796
1040
759
781
865
845
944
984
897
822
1010
771
676
649
846
812
742
801
1040
860
874
848
890
744
749
838
1050
918
986
797
923
975
815
1020
906
901
1170
912
746
919
718
714
740
&end
% --------------------------------------------------------------------
% State-spa%e format: y(t) = C(t)z(t) + H(t)x(t) + G(t)u(t)
% x(t) = A(t) + F(t)x(t-1) + R(t)u(t)
%
% y(t) (ny x 1) ny = # of endogenous series
% z(t) (nz x 1) nz = # of exogenous series
% x(t) (nx x 1) nx = # of %ontinous states
% u(t) (nu x 1) nu = # of sho%ks
% C(t) (ny x nz x ns1) ns1 = # of states for %(t)
% H(t) (ny x nx x ns2) ns2 = # of states for H(t)
% G(t) (ny x nu x ns3) ns3 = # of states for G(t)
% A(t) (nx x ns4) ns4 = # of states for a(t)
% F(t) (nx x nx x ns5) ns5 = # of states for F(t)
% R(t) (nx x nu x ns6) ns6 = # of states for R(t)
%
% Model:
% y(t) = mu(t)+c(t)
% c(t) = [S(1t)*delta^(1/2)+(1-S(1t))]*Ve^(1/2)*e(t)
% mu(t) = mu(t-1)+S(2t)*Vepsilon^(1/2)*epsilon(t)
%
% State-space representation:
% x(t) = (mu(t),c(t))
% u(t) = (e(t),epsilon(t))
%
% Paramaeters:
% Ve = theta(1)
% Vmu = theta(2)
% delta = theta(3)
% ---------------------------------------------------------------------
function [ C,H,G,A,F,R ] = NILE( ny,nz,nx,nu,ns,theta )
% *** The following declaration are fixed ***
C = zeros(ny,max(1,nz),ns(1));
H = zeros(ny,nx,ns(2));
G = zeros(ny,nu,ns(3));
A = zeros(nx,ns(4));
F = zeros(nx,nx,ns(5));
R = zeros(nx,nu,ns(6));
% *** Do not change the lines above ***
% *** Set non-zero elements below ***
% C(t) (ny x max(1,nz) x ns1)
% H(t) (ny x nx x ns2)
H(1,1,1) = 1;
H(1,2,1) = 1;
% G(t) (ny x nu x ns3)
% A(t) (nx x ns4)
% F(t) (nx x nx x ns5)
F(1,1,1) = 1;
% R(t) (nx x nu x ns6)
R(1,2,[2 4]) = sqrt(theta(2));
R(2,1,[1 2]) = sqrt(theta(1));
R(2,1,[3 4]) = sqrt(theta(3)*theta(1));
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment