Closed KonstantinosTheodoridis closed 1 year ago
Hi Kostas,
Good to hear from you. I am currently teaching an intensive course and so I am a bit slow in responding.
[T,R,Qfunc,steady_state]=load_solution(model,'ov'); When the type is ov (order VAR), R is empty while T is of size solve_order x regimes_number. Basically, T is returned as Tz, Tzz, Tzzz, etc. where the rows that were originally in alphabetical order are put in the order of simulation/processing.
[T,R,Qfunc,steady_state]=load_solution(model,'iov'); When the type is iov (inverse order VAR), R corresponds to the shocks and T corresponds to the autoregressive elements and the matrices in T are square. The variables are ordered alphabetically.
With respect to the simulation under endogenous probabilities, the transition matrix has to be updated at each point in time using the past simulation. Suppose, say, you would like to simulate x{t} conditional on x{t-1} and r{t-1}, the past regime. The sequence is as follows.
Cheers,
J.
On Mon, Mar 13, 2023 at 10:50 PM KonstantinosTheodoridis < @.***> wrote:
Dear Junior, I trust you are well. I am sorry to bother you. I am facing two issues and would be grateful for your help/advice. I tried to use [T,R,Qfunc,steady_state]=load_solution(model,'ov'); to obtain the state space representation of the model, but R comes back empty. Another question is how you simulate the model with endogenous transition probabilities. It is clear to me how this can be done using exogenous probabilities i.e.
- simulate a path for regimes for (say) T periods
- use x_t-xss(rt)=A(x_t-xss(rt))+1+BE T periods
but what do you do when transition probabilities are functions of x_t? rise_files.zip https://github.com/jmaih/RISE_toolbox/files/10962199/rise_files.zip
Many in advance for your time and help. Kostas
— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBT7UAGZ5FUJIUYQHAHTW36JAXANCNFSM6AAAAAAVZUNT3A . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Hi Junior, This is brilliant! Always to the point! Could you please let me know what RISE function I could use to draw the regime (i.e. Step 3)? Many thanks again for your time and help. Kostas
Hi Junior, I am sorry to bother you again. I tried to implement the steps discussed above.
SimY=zeros(dy,NoPeriods); qrt(1)=1; for i = 2:NoPeriods Q=Qfun(SimY(:,i-1)); path=simul_regime(Q(qrt(i-1),:)'); qrt(i)=path; SimY(:,i)=T{qrt(i)}SimY(:,i-1)+R{qrt(i)}shkDraws(:,i); end rise_files.zip
but without much success. When the simulated path of sprd (variable 17th) simulated using my code (attached) doesn't make much sense, while the one derived using RISE is "beautiful". I don't think the issue is caused by the simul_regime function I wrote to draw the regime. The sprd should fluctuate between zero (or small negative values) and large positive values, which is the case when RISE's simulate command is used. I might have misinterpreted the step mentioned in your post. Many thanks again for your time and help. Kostas
Hi Kostas,
Once you know the past regime and have extracted the vector of probabilities, you have the probabilities of moving to each regime. The higher the probability, the higher the likelihood of moving to the regime.
For example, if you have a vector [0.1,0.9], you add zero at the beginning and take the accumulated sum. The result is [0, 0.1,1]. You now have two intervals [0,0.1] and (0.1,1]
Now draw a random number in [0,1]. If the number falls in the first interval, choose the first regime, otherwise choose the second regime.
I hope this helps
On Wed, Mar 15, 2023 at 8:45 PM KonstantinosTheodoridis < @.***> wrote:
Hi Junior, This is brilliant! Always to the point! Could you please let me know what RISE function I could use to draw the regime (i.e. Step 3)? Many thanks again for your time and help. Kostas
— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/179#issuecomment-1470736640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBT3E2K27IT5A7P3JXN3W4IL7NANCNFSM6AAAAAAVZUNT3A . You are receiving this because you commented.Message ID: @.***>
Hi Kostas,
I am overloaded with teaching, I am sorry for responding slowly.
Have you checked the input for the Qfunc function? are they in the correct order?
On Wed, Mar 15, 2023 at 10:24 PM KonstantinosTheodoridis < @.***> wrote:
Hi Junior, I am sorry to bother you again. I tried to implement the steps discussed above.
SimY=zeros(dy,NoPeriods); qrt(1)=1; for i = 2:NoPeriods Q=Qfun(SimY(:,i-1)); path=simul_regime(Q(qrt(i-1),:)'); qrt(i)=path; SimY(:,i)=T{qrt(i)}SimY(:,i-1)+R{qrt(i)}shkDraws(:,i); end rise_files.zip https://github.com/jmaih/RISE_toolbox/files/10984621/rise_files.zip
but without much success. When the simulated path of sprd (variable 17th) simulated using my code (attached) doesn't make much sense, while the one derived using RISE is "beautiful". I don't think the issue is caused by the simul_regime function I wrote to draw the regime. The sprd should fluctuate between zero (or small negative values) and large positive values, which is the case when RISE's simulate command is used. I might have misinterpreted the step mentioned in your post. Many thanks again for your time and help. Kostas
— Reply to this email directly, view it on GitHub https://github.com/jmaih/RISE_toolbox/issues/179#issuecomment-1470866320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATKBT7F4SLW7QAGF4462YTW4IXSLANCNFSM6AAAAAAVZUNT3A . You are receiving this because you commented.Message ID: @.***>
Dear Junior, I trust you are
well.
I am sorry to bother you. I am facing two issues and would be grateful for your help/advice. I tried to use [T,R,Qfunc,steady_state]=load_solution(model,'ov'); to obtain the state space representation of the model, but R comes back empty. Another question is how you simulate the model with endogenous transition probabilities. It is clear to me how this can be done using exogenous probabilities i.e. 1) simulate a path for regimes for (say) T periods 2) use x_t-xss(rt)=A(x_t-xss(rt))+1+BE T periodsbut what do you do when transition probabilities are functions of x_t? rise_files.zip
Many in advance for your time and help. Kostas