How to model and plot a simple economy in which recessions, when they occur, are likely to be 'persistent'?

4 次查看(过去 30 天)
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!

采纳的回答

Rick Rosson
Rick Rosson 2011-9-14
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 个评论
NOWhereinNY
NOWhereinNY 2011-9-14
Thank you! Your answer wasn't quite the same concept: as I mentioned, it's not the actual growth rate of the modeled economy that's affected by the probability but the business cycle booms and recessions.
But with very minor modifications (code below), I got exactly what I was looking for. Thank you, again!
N = 100; % number of periods to simulate
y = zeros(N,1);
y(1) = 1; % 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.9; % growth rate
else
p = 0.5; % probability of a recession next period
g = 0.05 % growth rate
end
recession = ( rand < p );
y(t) = (1.1^t)+(1.1^t*g);
end
x=log(y)
plot(x)
Walter Roberson
Walter Roberson 2011-9-14
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));
??

请先登录,再进行评论。

更多回答(1 个)

Walter Roberson
Walter Roberson 2011-9-14
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.

类别

Help CenterFile Exchange 中查找有关 Get Started with DSP System Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by