MATLAB: How to model and plot a simple econothe in which recessions, when they occur, are likely to be ‘persistent’

economypersistence

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!

Best Answer

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
Related Question