This is a program package to estimate the model used in
Sylvia Frühwirth-Schnatter and Sylvia Kaufmann,
"How do changes in monetary policy affect bank lending? An analysis of
Austrian bank data"
Model
y_it = alpha*X^1_it + beta^G_S(i)*X^2_it + beta^R_S(i)*X^3_it*(I_t-1) + e_it
S(i)=1,2,...,K; e_it ~ N(0,sigma^2_i), sigma^2_(i)=sigma^2/lambda_i
i=1,...,N; t=1,...,T
ESTIMATION
start_model
script file to run estimation
set K (number of groups)
set index0 (default is empty matrix, otherwise it is used if some
parameters are set zero, not implemented in this version)
set gr_fix (default is zero, (1) is used when groups are formed a priori
-- adjust ev. run_model_lagzins lines 123-127 and/or program group_fix)
set not_switch (default is zero, (1) if a non-switching specification is
to be estimated)
set true (default is zero, (1) is used to read-in true parameters when
testing the program)
set lag_dir (number of lagged exogenous variables)
set lag_dlo (number of lagged endogenous variables)
set eta_different (default is zero, (1) is used when there are
group-specific state indicators with different transition
probability matrices --- use another routine in runmcmc3mixture_neu2.m)
set unit_spec_var ( (1) is used to estimate unit-specific variances)
set prm, prior mean of group-specific parameter if I_t==1;
set scale of prior information (if scale lower, then lower information,
hence more diffuse prior
change the name of the file to which MCMC output is saved
calls run_model_lagzins
calls run_lcm_MS
run_model_lagzins
script file to read in data and design the explanatory matrices
defines which banks to include and how to treat outliers (as missing
values or not, i.e. to exclude banks with outliers)
indexb vector containing the units included in the analysis
indexn vector containing the effective estimation sample (accounts for
autocorrelation of endogenous/exogenous variables)
y TxN contains the dependent variable
Z_dlolag TxUxN contains the U lagged endogenous variables (set with
lag_dlo)
Zvar TxUxN contains the U variables with group-specific effects
Z TxUxN contains in the first 'ill' (later defined as dd) columns the
variables with group-specific effects (the matrix Zvar), then the lagged
endogenous variables (Z_dlolag), the variables with fixed effects
(additional variables in Zwirt, dummy variables in Zdum and the
constant c).
Z = [Zvar,Z_dlolag,Zwirt,Zdum,c]
ZMS TxUxN contains the U variables with state-specific effects
IMS 1x(T+1) starting value for I_t
S 1xN defining S_i
calls daten_read_b
script file to read in data and construct an outlier matrix
dlo_out TxN matrix containing a 1 where there is an outlier (due
to merger or statistics)
Zbasis TxUxN (each column u contains a variable with group- and/or
state-specific effect)
BLZ Nx1 unit identifier
Zdum TxUxN (each column contains a dummy variable, e.g. seasonals,
break identifier etc.)
c Tx1xN constant
Zwirt TxUxN (each column contains a macro variable included in the
regression, e.g. inflation GDP growth etc.)
calls exclude_ind
script file to exclude specific banks
run_lcm_MS
script file to design the prior distribution, to set the starting values
and to call the estimation program
prseps inverse Gamma for error variance
pralm prior mean of parameter vector
pralinf prior information matrix
e0 1xK vector of prior's hyperparameter for group probabilities
e0MS 2x2 prior parameter for the transition probabilities
seps0 starting value for error variance
alpha0 starting value for the parameter vector [beta^G_1,...,beta^G_K,
lagged endogenous,fixed effects,beta^R_1,...,beta^R_K]
eta0 starting value for the group probabilities
eta0MS starting value for the transition probabilities
set M number of iterations
set it0 number of burn-in iterations
set it0cov number of retained posterior moments (for Bayes factor
evaluation, not implemented for the present specification)
set it0b number of retained I^T and S^N (default is set to 100).
set perm=100 to use random permutation sampler
set perm=0 to use restricted permutation sampler (set the appropriate
restriction in the procedure 'mixture3mcmc_samIt.m' (line 357)
calls runmcmc3mixture_neu2
script to call the estimation procedure 'mixture3mcmc_samIt.m'
EVALUATION/IDENTIFICATION
load first the file with the saved MCMC output (load *****.mat)
run run_model_lagzins to read in relevant data and index definitions (note:
ev. adjust daten_Read.m for the right exogenous variable)
set ifig=1 (index to number the figures) on the command line
run plotgroupR_ranperm, displays scatter plots of the elements of beta^R_k
against each other and against persistence of 1st state
decide with which element in beta^R_k to identify the states
set group= 0 (no group-specific sorting) on the command line
set eta_restr= (default is 0, (1) is used to identify the states by means of
the state persistence) on the command line
run a first time Permut_MS
set indexMSsort=[1] set with which element in beta^R_k to identify
the state (relevant if eta_restr=0)
set indexMIXsort=[1] set with which element to identify the groups
(not relevant in the first permutation round)
run plotgroupalpha, displays scatter plots of the elements of beta^G_k
against each other
decide with which element in beta^G_k (or in beta^R_k) to identify the groups
set group= 1 (group-specific sorting according to an element in beta^G_k)
2 (group-specific sorting according to an element in beta^R_k)
on the command line
run a second time Permut_MS
set indexMSsort=[1] set with which element in beta^R_k to identify
the state
set indexMIXsort=[1] set with which element to identify the groups
run plotprob
displays a graph for bank classification,
ev. a scatter plot of size against liquidity of specific bank groups
(adjust lines 77-98)
and a plot of the state indicator (adjust procedure plotprob_MS.m, ev.
for the end date on line 13 and for the variable dyr and Zbasis)
a group indicator for each bank is found in the matrix class
(1st group ... last group excluded banks); [BLZ class] relates the
indicators to the units
run plotrd
displays marginal posterior distribution of the group-specific parameters
when I_t=1 (beta^G_k) and when I_t=0 (beta^G_k-beta^R_k),
of the state-specific parameter beta^R_k, of the fixed parameters, of the
group and the transition probabilities.
the command
plot(mean(sepsmc(:,ones(1,size(lambmc,2)))./lambmc,1)')
displays the unit-specific estimated variances
the procedure
boxlamb.m
displays boxplots of selected lambda's
define file='filename.txt' on the command line
output_rel_parms (output_rel_parms_ns) writes a table in latex-format
with mean and shortest confidence interval for group- and
state-specific parameters, tabulates some group characteristics
of interest (see lines 93-116), and mean and confidence interval
of state persistence parameters.
to view the estimated missing data
run first run_model_lagzins
run daten_view_miss
FORECAST EVALUATION
run start_prognose.m
loads the MCMC file
calls run_model_lagzins_prognose (reads in data with daten_read_prognose)
calls prognose_applecon.m to compute the forecasts
the results are stored in matrix biasall and mseall, both of dimension
imodel x forecast horizon x 3
imodel = 1 (a priori grouping), 2,3,4 (K=2,3,4)
forecast horizon=12
3: first matrix: unweighed errors, second: weighted with lamdba_i,
third: weighted with size
run plotmse.m to obtain the numbers of table 4, and the graphs of figure 7.