forked from SMOOTH-ERC/believe_me_green
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel_function.m
166 lines (132 loc) · 8.49 KB
/
model_function.m
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
%% Climate policy uncertainty model - Emanuele Campiglio, Francesco Lamperti, Roberta Terranova
% Copyright Campiglio, Lamperti, Terranova 2023
% this file provides the source code of the model
% it is composed by a single function (model_function) performing the
% simulation
% inputs: initial conditions and parameters
% outputs: all key variables
function[output] = model_function(R,T,N,J,eta,beta,gamma,g_tax,a,c,delta,g_Y,initial_tax,g_sk,g_b,D,initial_kappa,initial_lc_cost)
%% Vectors
% Demand and supply
s =NaN(T,N); % sectoral supply
S =NaN(T,1); % total supply
%Costs
theta =NaN(T+1,N); % cost of production of one unit of output with no carbon tax
unit_cost =NaN(T,N); % unit cost of tehnology
costs =NaN(T,N); % total costs of technology
% Capital and investment
K =NaN(T,N); % capital stock
kappa =NaN(T,N); % low- and high-carbon share of capital capital
xi_k =NaN(T+1,N); % productivity of capital
I =NaN(T,N); % investment per technology
totI =NaN(T,1); % total investment
chi =NaN(T,J); % share of low-carbon investment for each expectation type
chi_agg =NaN(T,1); % overall share of low-carbon investment
% Expectations
n =NaN(T,1); % share of believers
n_s =NaN(T,1); % share of sceptics
E_tax_b =NaN(T,N); % tax expected by believers updated in every t
E_tax_s =NaN(T,N); % tax expected by skeptics updated in every t
E_tax =NaN(T,N,J); % matrix of expected tax
E_tax_allt_b =NaN(T,T); % schedule of expected tax believers
E_tax_allt_s =NaN(T,T); % schedule of expected tax sceptics
Ec_t =NaN(T,J); % schedule expected costs of high-carbon for both belief types
z1 =NaN(T,J); % investment choice logit numerator for both belief types - low-carbon
z2 =NaN(T,J); % investment choice logit numerator for both belief types - high-carbon
sumz =NaN(T,J); % investment choice logit denominator for both belief types
U =NaN(T,J); % fitness measure for belief choice
acc =NaN(T,J); % squared prediction error
z =NaN(T,1); % belief choice logit numerator
zz =NaN(T,1); % belief choice logit denominator
% Policy maker
tax_target =NaN(T,1); % carbon tax target
tax_target_t =NaN(T,T); % carbon tax target updated in every t
tax =NaN(T,N); % carbon tax implemented
pi_pot =NaN(T,1); % potential transition risk index function
pi_actual =NaN(T,1); % actual transition risk index
trans_rate =NaN(T,1); % speed of transition
%% Initial values
kappa(2,:) =[initial_kappa, 1-initial_kappa];
K(2,:) =155.2*[kappa(2,1),kappa(2,2)];
xi_k(:,:) =0.3;
tax(1,2) =initial_tax;
tax(2,2) =initial_tax;
tax_target(2) =initial_tax;
E_tax_b(:,:) =0;
E_tax_s(:,:) =0;
E_tax(:,:,:) =0;
E_tax(2,2,:) =[tax_target(2),0];
U(1:3,:) =[1,0.15;1,0.15;1,0.15];
n(1:3) =0.3;
n_s(1:3) =0.7;
theta(:,1) =initial_lc_cost;
theta(:,2) =1;
%% Carbon tax announcement
tax_targ_prev = tax_target(2);
for tt=3:T
tax_target(tt) = tax_targ_prev*(1 + g_tax);
tax_targ_prev = tax_target(tt);
end
%% Tax expectations
%Believers
tax_targ_prev = tax_target(2);
for tt=3:T
E_tax_b(tt,2) = tax_targ_prev*(1+g_b); % determine sceptics' expected tax schedule (if fixed)
tax_targ_prev = E_tax_b(tt,2);
end
%Sceptics
tax_targ_prev = tax_target(2);
for tt=3:T
E_tax_s(tt,2) = tax_targ_prev*(1+g_sk); % determine sceptics' expected tax schedule (if fixed)
tax_targ_prev = E_tax_s(tt,2);
end
E_tax = cat(3,E_tax_b,E_tax_s);
%% T-loop starts
for t=3:T
%% Expected costs and choice of technology
% Find the last t of firms' planning horizon
if T-t>R
end_time=t+R;
else
end_time=T;
end
% Find net present value of expected production cost including carbon
% tax
Ec_lt = (theta(t:end_time,:).*(1 + (E_tax(t:end_time,:,:)))); % schedule of expected production costs from t to end of planning horizon
tt=t:end_time;
depr=D.^(tt-t); % discounting of future periods
Ec_lt_disc = sum(Ec_lt.*depr',1); % net present value
Ec_lt_disc = reshape(Ec_lt_disc,[],N); % obtain matrix of net present values at t
Ec_t(t,:) = [Ec_lt_disc(2,1),Ec_lt_disc(2,2)];
z1(t,:) = exp(-gamma * Ec_lt_disc(1,:)); % investment choice logit numerator - low-carbon capital for believers and sceptics
z2(t,:) = exp(-gamma * Ec_lt_disc(2,:)); % investment choice logit numerator - high-carbon capital for believers and sceptics
sumz(t,:) = z1(t,:)+z2(t,:); % sum of the two previous terms
chi(t,:) = z1(t,:)./sumz(t,:); % low-carbon investment share for both belief types
chi_agg(t) = n(t-1).*chi(t,1) + n_s(t-1).*chi(t,2); % share of aggregate low-carbon investment in t
totI(t) = sum(K(t-1,:))*(g_Y + delta); % total investment
I(t,:) = [chi_agg(t)*totI(t),(1-chi_agg(t))*totI(t)]; % sectoral investments
K(t,:) = K(t-1,:)*(1 - delta) + I(t,:); % sectoral capital stock
kappa(t,:) = K(t,:)./sum(K(t,:)); % sectoral capital share
%% Carbon tax implemented
pi_pot(t) = 1 - 1/(1 + a*(1-kappa(t,1))*tax_target(t)); % compute potential transition risk index
tax(t,2) = c*tax_target(t) + (1-c)*tax_target(t)*(1-pi_pot(t)); % set actual tax
pi_actual(t) = 1 - 1/(1 + a*(1-kappa(t,1))*tax(t,2)); % compute actual transition risk index depending on actual tax
%% Production
s(t,:) = K(t,:).*xi_k(t); % sectoral supply
S(t) = sum(s(t,:)); % total supply
%% Final good costs
unit_cost(t,:) = (theta(t,:).*(1 + tax(t,:))); % unit cost of production including tax
costs(t,:) = s(t,:).*unit_cost(t,:); % sectoal costs
%% Belief switching
E_tax_t = reshape(E_tax(t,:,:),[N,J]); % expected tax in previous period by both belief types
acc(t-1,:) = abs(tax(t,2) - E_tax_t(2,:)); % absolute value of prediction errors
U(t-1,:) = eta*acc(t-1,:) + (1-eta)*U(t-2,:); % fitness measure of expectation rules
z(t) = exp(-beta.*U(t-1,1)); % logit numerator
zz(t) = sum(exp(-beta*U(t-1,:))); % logit denominator
n(t) = z(t)/zz(t); % share of believers
n_s(t) = 1-n(t); % share of sceptics
end
%% Results
save('Results')
output='Results';
end