How to model and plot a simple economy in which recessions, when they occur, are likely to be 'persistent'?
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
the idea is to initially model and plot the growth of an economy that grows at a rate 'g' on average -- and then faces business cycle 'booms' and 'recessions'. the assumption initially is that booms and recessions are completely random (a coin toss, if you will).
then you make the impact of a recession stronger than the impact of a boom. but they are still completely random.
finally, you have to make recessions 'persistent'. meaning that if in period 't-1' the economy was in a recession, then in period 't' (the current period), the probability of a recession is greater than the probability of a boom. (if in t-1, the economy was in a boom period, then the probability of a boom or a recession in the current period remains 50-50.)
this is the code i am currently trying to modify to reflect this but i'm stumped:
for t=1:1:100
c=rand(t,1)
for i=1:t
if c(i,1)>0.5
c(i,1)=0.05
else
c(i,1)=-0.9
end
end
y(i)=1.1^t+[(1.1^t)*c(i,1)]
x=log(y)
plot(x)
title('Plot of log GDP against time - part (d) - g=10%; k=f=0.5')
xlabel('Time')
ylabel('GDP')
end
so now i need to make it 'persistent'. let's say in the first period t=1, it is obviously 50-50, but in every subsequent period going up to t=100, the probability is defined by the period immediately preceding it. so, if in t=1 it's a boom, then in t=2 it's 50-50. if in t=2 it's a recession, then the probability of a recession in t=3 could be 70%, and the probability of a boom 30%.
any help would be much appreciated!
0 Commenti
Risposta accettata
Rick Rosson
il 14 Set 2011
Maybe you can try something like the following:
N = 100; % number of periods to simulate
y = zeros(N,1);
y(1) = 100; % value of GDP in year 1
recession = false; % no recession to begin
for t = 2:N
if recession
p = 0.7; % probability of a recession next period
g = -0.02; % growth rate
else
p = 0.5; % probability of a recession next period
g = 0.10 % growth rate
end
recession = ( rand < p );
y(t) = y(t-1)*(1+g);
end
HTH.
Rick
2 Commenti
Walter Roberson
il 14 Set 2011
Question: your line y(t) = (1.1^t)+(1.1^t*g); appears to be calculating 1.1^t twice. Would it not be more efficient to use
y(t) = 1.1^t * (g+1);
??
Or should your code actually be
y(t) = (1.1^t)+(1.1^(t*g));
??
Più risposte (1)
Walter Roberson
il 14 Set 2011
Sounds to me as if you want a simple stochastic with a 2 x 2 transition matrix.
If your transition matrix is P, then the probability that you will be in the various states after n steps is P^n where that is matrix power intended, and P.^n is not intended.
0 Commenti
Vedere anche
Categorie
Scopri di più su Get Started with DSP System Toolbox in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!