-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConstructPDFs.m
204 lines (167 loc) · 5.49 KB
/
ConstructPDFs.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
%% Construct PDF
%
% First version: Richard Tol, 29 March 2021
% This version: Richard Tol, 29 March 2021
%% Sensitivity analysis on kernel functions
NFilterSave = NFilter;
NFilter = 1;
nosplit = true;
distpos = 'normal';
distneg = 'normal';
%%
JohnsonSU = true;
Silverman = true;
ConstructPDF;
JointPDFJSUS = JointPDF;
Silverman = false;
ConstructPDF;
JointPDFJSU = JointPDF;
%%
Silverman = true;
JohnsonSU = false;
ConstructPDF;
JointPDFSilverman = JointPDF;
%% adaptive kernel
TotalWeightSave = TotalWeight;
TotalWeight = TotalWeightNS;
ConstructPDF;
JointPDF0 = JointPDF;
for i=1:NEstimates,
Aux = JointPDF0(SCCgrid==round(SCC(i)));
if isempty(Aux)
AdapWeight(i) = 0;
else
AdapWeight(i) = Aux(1);
end
end
TotalWeight = AdapWeight'.*TotalWeightNS;
ConstructPDF;
JointPDF1 = JointPDF;
for i=1:NEstimates,
Aux = JointPDF1(SCCgrid==round(SCC(i)));
if isempty(Aux)
AdapWeight(i) = 0;
else
AdapWeight(i) = Aux(1);
end
end
TotalWeight = AdapWeight'.*TotalWeightNS;
ConstructPDF;
JointPDF2 = JointPDF;
for i=1:NEstimates,
Aux = JointPDF2(SCCgrid==round(SCC(i)));
if isempty(Aux)
AdapWeight(i) = 0;
else
AdapWeight(i) = Aux(1);
end
end
TotalWeight = AdapWeight'.*TotalWeightNS;
ConstructPDF;
JointPDF3 = JointPDF;
figure %S5 adaptive.jpg
plot(SCCgrid(301:2101),JointPDF0(301:2101,1),SCCgrid(301:2101),JointPDF1(301:2101,1),SCCgrid(301:2101),JointPDF2(301:2101,1),SCCgrid(301:2101),JointPDF3(301:2101,1))
legend('Initial','Iteration 1', 'Iteration 2','Iteration 3');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')
TotalWeight = TotalWeightSave;
%%
Silverman = false;
JohnsonSU = false;
ConstructPDF;
JointPDFGauss = JointPDF;
nosplit = false;
ConstructPDF;
JointPDFGaussGauss = JointPDF;
distneg = 'gumbel';
ConstructPDF;
JointPDFGumbelGauss = JointPDF;
distpos = 'weibull';
ConstructPDF;
JointPDFGumbelWeibull = JointPDF;
%%
figure %S1 kernel.jpg
plot(SCCgrid(301:2101),JointPDFSilverman(301:2101,1),SCCgrid(301:2101),JointPDFGauss(301:2101,1),SCCgrid(301:2101),JointPDFGaussGauss(301:2101,1),SCCgrid(301:2101),JointPDFGumbelGauss(301:2101,1),SCCgrid(301:2101),JointPDFGumbelWeibull(301:2101,1))
legend('Normal, Silverman', 'Normal', 'Normal, Normal','Gumbel, Normal', 'Gumbel, Weibull');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')
%% Sensitivity analysis on weights
TotalWeightSave = TotalWeight;
TotalWeight = ones(NEstimates,1);
ConstructPDF;
JointPDFUncensored = JointPDF;
SCCsave = SCC;
SCC = SCCW;
ConstructPDF;
JointPDFWinsorized = JointPDF;
SCC = SCCsave;
TotalWeight = Censor.*ones(NEstimates,1);
ConstructPDF;
JointPDFNone = JointPDF;
TotalWeight = Censor.*PaperWeight;
ConstructPDF;
JointPDFPaper = JointPDF;
TotalWeight = Censor.*AuthorWeight;
ConstructPDF;
JointPDFAuthor = JointPDF;
TotalWeight = TotalWeightSave;
ConstructPDF;
JointPDFQuality = JointPDF;
%%
figure %S2 weigth.jpg
plot(SCCgrid(301:2101),JointPDFUncensored(301:2101,1),SCCgrid(301:2101),JointPDFWinsorized(301:2101,1),SCCgrid(301:2101),JointPDFNone(301:2101,1),SCCgrid(301:2101),JointPDFPaper(301:2101,1),SCCgrid(301:2101),JointPDFAuthor(301:2101,1),SCCgrid(301:2101),JointPDFQuality(301:2101,1))
legend('Uncensored','Winsorized','No weights','Paper weights', 'Author weights', 'Quality weights');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')
%% More sensitivity analysis on censoring
TotalWeightSave = TotalWeight;
TotalWeight = AltCensor1.*TotalWeightNS;
ConstructPDF;
JointPDFAltCensor1 = JointPDF;
TotalWeight = AltCensor2.*TotalWeightNS;
ConstructPDF;
JointPDFAltCensor2 = JointPDF;
figure %S4 censor.jpg
plot(SCCgrid(301:2101),JointPDFQuality(301:2101,1),SCCgrid(301:2101),JointPDFAltCensor1(301:2101,1),SCCgrid(301:2101),JointPDFAltCensor2(301:2101,1))
legend('Top censor','Top and bottom censor','Asymmetric censor');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')
TotalWeight = TotalWeightSave;
%% More sensitivity analysis on weights
TotalWeight = Censor.*TWeightPeer;
ConstructPDF;
JointPDFPeer = JointPDF;
TotalWeight = Censor.*TWeightImpact;
ConstructPDF;
JointPDFImpact = JointPDF;
TotalWeight = Censor.*TWeightMethod;
ConstructPDF;
JointPDFMethod = JointPDF;
TotalWeight = Censor.*TWeightDyn;
ConstructPDF;
JointPDFDyn = JointPDF;
TotalWeight = Censor.*TWeightScen;
ConstructPDF;
JointPDFScen = JointPDF;
TotalWeight = Censor.*TWeightAge;
ConstructPDF;
JointPDFAge = JointPDF;
figure %S3 qweight.jpg
plot(SCCgrid(301:2101),JointPDFQuality(301:2101,1),SCCgrid(301:2101),JointPDFPeer(301:2101,1),SCCgrid(301:2101),JointPDFImpact(301:2101,1),SCCgrid(301:2101),JointPDFMethod(301:2101,1),SCCgrid(301:2101),JointPDFDyn(301:2101,1),SCCgrid(301:2101),JointPDFScen(301:2101,1),SCCgrid(301:2101),JointPDFAge(301:2101,1))
legend('Quality weights','Not peer-reviewed','No original estimate','Not marginal','Static vulnerability','No scenario','Age of publication');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')
TotalWeight = TotalWeightSave;
%%
%restore defaults
distpos = 'weibull'; %normal gamma lognormal gumbel weibull=default
distneg = 'gumbel'; %normal gumbel=default
Silverman = false;
nosplit = false;
NFilter = NFilterSave;
ConstructPDF
figure
plot(SCCgrid(301:2101),JointPDF(301:2101,1))
legend('Test before bootstrap');
xlabel('dollar per tonne of carbon')
ylabel('Probability density')