Designing probability outside the model
Posted: Tue Apr 30, 2013 4:22 pm
Hello,
I come across something that looks pretty strange. I have a model with news-shocks. What I do mainly is to compare the case where shocks are pure surprises to the case where shocks are known one period in advance. In order to do so, I treat news as a parametre. The way I program it is that, at the very very begining of my mod file (i.e. before the var or the parametres block) I set:
Then, my shock process writes:
Thus, when I set "@#define q = 0" I have the case of traditional, unexpected disturbances and when "@#define q = 1" is the case of news-shocks. So I compare the two cases. What I want to try next is how my results change when news arrive with some probability. For example, some statistics move from a value X when q=0 to a value Y when q=1. These are the two extreme cases where news either arrive or not. Now I want to check if news arrive 1/10, 2/10, 3/10,... times whether my statistic will move (monotonically or otherwise) from X-->Y.
To implement this I thought of simulations. My idea is to simulate the model 500 times (or more) and at each time, before a model is run, I make a random draw over the unit interval and I check if this draw is < prob; where prob is the probability of news. Thus, to implement that, again at the VERY beginning of my code and before the var block, I do:
In the above case the probability is 5/10=1/2. The problem is that even though q does change, and in the end of the 500 simulations the empirical probability is close to the theoretical one (thats why I use this NewsCount thing, to count the number of times q=1 and then compute the REALISED probability out of the experiment) the results do not change. That is, the results will concern the case q=0 or q=1, depending which was done first. After a lot of struggle, I realise that q does not ACTUALLY change when I allowed q to be chosen as above and I solved the asymptotic case. What happens is that even though the value of q does change from what I can see on my screen, I guess it does not change in the matlab files dynare creates. Thus, whatever the resulting value of q (again, the one I can see on the screen), the results are unchanged (since it concerns the asymptotic case) corresponding to q=0 or q=1, depending on which case was run in the very beginning when the model was solved without the probability thing, but as in the very first part above.
now, this is strange no? I don't understand why when I program the thing as in the first case above it works, but when I pick up the value of q as in the latter case it does not. Anyone has an idea? In general, how I could implement this?
Hope this is clear enough, albeit quite long.
Kyriacos
I come across something that looks pretty strange. I have a model with news-shocks. What I do mainly is to compare the case where shocks are pure surprises to the case where shocks are known one period in advance. In order to do so, I treat news as a parametre. The way I program it is that, at the very very begining of my mod file (i.e. before the var or the parametres block) I set:
- Code: Select all
@#define q = 0
q= @{q}
Then, my shock process writes:
- Code: Select all
zT1 = autoregressive terms + eT1(-@{q}) ;
zT2 = autoregressive terms + eT2(-@{q}) ;
Thus, when I set "@#define q = 0" I have the case of traditional, unexpected disturbances and when "@#define q = 1" is the case of news-shocks. So I compare the two cases. What I want to try next is how my results change when news arrive with some probability. For example, some statistics move from a value X when q=0 to a value Y when q=1. These are the two extreme cases where news either arrive or not. Now I want to check if news arrive 1/10, 2/10, 3/10,... times whether my statistic will move (monotonically or otherwise) from X-->Y.
To implement this I thought of simulations. My idea is to simulate the model 500 times (or more) and at each time, before a model is run, I make a random draw over the unit interval and I check if this draw is < prob; where prob is the probability of news. Thus, to implement that, again at the VERY beginning of my code and before the var block, I do:
- Code: Select all
jj = 5 ;
NewsCount=0;
I = 10000 ; % insert the number of desired simulations
for i = 1:I ;
xx0 = rand([1,1]);
prob = jj/10 ;
if xx0 <= prob
xx01(1, i) = xx0;
xx01(2,i) = 1 ;
eval(['NewsCount', ' = NewsCount', ' + 1 ;']);
@#define countries = [ "1", "2" ]
% Number of lags for which news shocks as in play
@#define q = 1
q= @{q}
else
xx01(1, i) = xx0;
xx01(2,i) = 0;
@#define countries = [ "1", "2" ]
% Number of lags for which news shocks as in play
@#define q = 0
q= @{q}
end
In the above case the probability is 5/10=1/2. The problem is that even though q does change, and in the end of the 500 simulations the empirical probability is close to the theoretical one (thats why I use this NewsCount thing, to count the number of times q=1 and then compute the REALISED probability out of the experiment) the results do not change. That is, the results will concern the case q=0 or q=1, depending which was done first. After a lot of struggle, I realise that q does not ACTUALLY change when I allowed q to be chosen as above and I solved the asymptotic case. What happens is that even though the value of q does change from what I can see on my screen, I guess it does not change in the matlab files dynare creates. Thus, whatever the resulting value of q (again, the one I can see on the screen), the results are unchanged (since it concerns the asymptotic case) corresponding to q=0 or q=1, depending on which case was run in the very beginning when the model was solved without the probability thing, but as in the very first part above.
now, this is strange no? I don't understand why when I program the thing as in the first case above it works, but when I pick up the value of q as in the latter case it does not. Anyone has an idea? In general, how I could implement this?
Hope this is clear enough, albeit quite long.
Kyriacos