/
PKE
123 lines (92 loc) · 5.93 KB
/
PKE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#Post-Keynesian Economics (PKE) MODEL
#Made by Marco Veronese Passarella, 26th February 2020
############################################################################
#STEP 1: Clear the workspace
#Clear all
rm(list=ls(all=TRUE))
############################################################################
#STEP 2: Define the number of periods and scenarios
#Number of periods
nPeriods = 100
#Number of scenarios
nScenarios=2
############################################################################
#STEP 3: Define variables
Y=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Output (income)
C=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Consumption
I=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Investment
NX=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Net export
K=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Capital stock
KT=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Desired capital stock
P=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Profits
W=matrix(data=0,nrow=nScenarios,ncol=nPeriods) #Wages
omega=matrix(data=0.5,nrow=nScenarios,ncol=nPeriods) #Wage share to total income
############################################################################
#STEP 4: Set values for parameters and exogenous variables
c0=20 #Autonomous consumption
c1=0.8 #Marginal propensity to consume out of income
kappa=1 #Target capital to output ratio
gamma=0.15 #Speed of adjustment of capital
delta=0.1 #Capital depreciation rate
m=0.1 #Marginal propensity to import out of total income
x0=0 #Autonomous export
cW=0.9 #Marginal propensity to consume out of wages
cP=0.7 #Marginal propensity to consume out of profits
############################################################################
# STEP 5: CREATE THE MODEL
#Select scenarios
for (j in 1:nScenarios){
#Define the time loop
for (i in 2:nPeriods){
#Define iterations
for (iterations in 1:100){
#Define alternative scenarios
#Higher wage share
if (i>=30 && j==2){
omega[2,i]=0.6
}
#MODEL EQUATIONS
#Original equations
Y[j,i] = C[j,i] + I[j,i] + NX[j,i] #1) National income (output)
#C[j,i] = c0 + c1*Y[j,i-1] #2) Consumption
KT[j,i] = kappa*Y[j,i-1] #3) Desired capital stock
I[j,i] = gamma*(KT[j,i] - K[j,i-1]) + delta*K[j,i-1] #4) Gross investment
K[j,i] = K[j,i-1]*(1-delta) + I[j,i] #5) Capital stock
NX[j,i] = x0 -m*Y[j,i-1] #6) Net export
#Equations for distribution
C[j,i] = c0 + cW*W[j,i-1] + cP*P[j,i-1] #2B) New consumption function
W[j,i] = omega[j,i]*Y[j,i] #7) Wage bill
P[j,i] = (1-omega[j,i])*Y[j,i] #8) Profits
}
}
}
############################################################################
# STEP 6: PERFORM CHECKS AND PLOTS
#Create custom color
mycol1 <- rgb(0,255,0, max = 255, alpha = 50, names = "mygreen")
mycol2 <- rgb(255,0,0, max = 255, alpha = 50, names = "myred")
mycol3 <- rgb(0, 0, 255, max = 255, alpha = 50, names = "blue50")
#Output components under baseline
plot(Y[1,2:50], type="l", lty = 1, lwd = 2, col=1, font.main=1,cex.main=1,main="a) Output components under baseline",ylab = '£',xlab = '', ylim = range(-20,105),cex.axis=0.75,cex.lab=1)
lines(C[1,2:50], type="l", lty = 2, lwd = 2, col=2)
lines(I[1,2:50], type="l", lty = 3, lwd = 2, col=3)
lines(NX[1,2:50], type="l", lty = 4, lwd = 2, col=4)
abline(h=(c0/(1-c1-delta*kappa+m)),col=1,lty=3,lwd=1)
legend("right",c("Output","Consumption","Gross investment","Net export"), bty = "n", cex = 1, lty=c(1,2,3,4), lwd=c(2,2,2,2), col = c(1,2,3,4), box.lty=0)
#Capital stock under baseline
plot(K[1,2:50], type="l", lty = 1, lwd = 2, col=1, font.main=1,cex.main=1,main="b) Capital stock under baseline",ylab = '£',xlab = '', ylim = range(-20,105),cex.axis=0.75,cex.lab=1)
lines(KT[1,2:50], type="l", lty = 2, lwd = 2, col=2)
abline(h=(c0/(1-c1-delta*kappa+m)),col=1,lty=3,lwd=1)
legend("right",c("Actual","Target"), bty = "n", cex = 1, lty=c(1,2), lwd=c(2,2), col = c(1,2), box.lty=0)
#Output components after shock to distribution
plot(Y[2,27:50]-Y[1,27:50], type="l", lty = 1, lwd = 2, col=1, font.main=1,cex.main=1,main="a) Change in output components following an \n increase in wage share",ylab = 'Difference with baseline',xlab = '', ylim = range(-5,15),cex.axis=0.75,cex.lab=1)
rect(xleft=4,xright=5,ybottom=-50,ytop=50,col=mycol1,border=NA)
lines(C[2,27:50]-C[1,27:50], type="l", lty = 2, lwd = 2, col=2)
lines(I[2,27:50]-I[1,27:50], type="l", lty = 3, lwd = 2, col=3)
lines(NX[2,27:50]-NX[1,27:50], type="l", lty = 4, lwd = 2, col=4)
legend("topleft",c("Output","Consumption","Gross investment","Net export"), bty = "n", cex = 1, lty=c(1,2,3,4), lwd=c(2,2,2,2), col = c(1,2,3,4), box.lty=0)
#Capital stock after shock to distribution
plot(K[2,27:50]/K[1,27:50], type="l", lty = 1, lwd = 2, col=1, font.main=1,cex.main=1,main="b) Change in capital stock following an increase in \n wage share",ylab = 'Relative to baseline',xlab = '', ylim = range(1,1.15),cex.axis=0.75,cex.lab=1)
rect(xleft=5,xright=6,ybottom=-50,ytop=50,col=mycol1,border=NA)
lines(KT[2,27:50]/KT[1,27:50], type="l", lty = 2, lwd = 2, col=2)
legend("topleft",c("Actual","Target"), bty = "n", cex = 1, lty=c(1,2), lwd=c(2,2), col = c(1,2), box.lty=0)