-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProjectCode
More file actions
162 lines (137 loc) · 5.46 KB
/
ProjectCode
File metadata and controls
162 lines (137 loc) · 5.46 KB
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
%%Barranquillo Columbia Climate Data from NOAA
figure
plot(MNTM,TPCP);
xlabel('Mean Monthly Temperature');
ylabel('Total Precipitation');
%%Sorting Barranquillo Data from Chikungunya Transmission Data
cities = cell2table(location);
%Preliminary Information for the Charleston, South Carolina dataset from NOAA
figure;
gscatter (data(:, 3), data(:,2));
xlabel('Mean Monthly Temperature');
ylabel('Total Precipitation');
figure;
gscatter (data(:, 3), data(:,2), data(:,4));
xlabel('Mean Monthly Temperature');
ylabel('Total Precipitation');
%%PCA of Sorted Data
%MultipleCityClimateData1 is a cell containing the precipitation,
%temperature, and probability of local transmission for each reach.
MatData = cell2mat(MultipleCityClimateData1);
[coeff, score, latent] = pca(MatData);
mpca = cumsum(latent)/sum(latent);
var95 = mpca>0.95;
pca95 = sum(var95);
%Graph of principle components 1 and 2.
figure
scatter(score(:, 1), score(:, 2),'filled');
xlabel('First Principle Componant');
ylabel('Second Principle Componant');
title('Data Projected onto the Principal Component Directions');
%Another alternative. %%
% View the data and the original variables in the space of the first three
% principal components.
[coeff, score, latent] = princomp(MatData);
mpca = cumsum(latent)/sum(latent);
var95 = mpca>0.95;
pca95 = sum(var95);
vbls = {'Precipitation','Temperature','Transmission'};
figure
biplot(coeff,'scores',score,'varlabels',vbls);
%Graphs looking at trends in data%
readtable('bydate_multicities.xlsx');
%Monthly Precipitation (TCPC) by location, in inches.
Dates = x2mdate((data(:,1)), 1,'datetime');
plot(Dates, data(:,(2:7)));
title('Mean Monthly Precipitation by Location')
xlabel('Time');
ylabel('Mean Monthly Precipitation, in inches');
title('Mean Monthly Preciptation by Location');
%Monthly Temperature (MNMT) by location, in tenths of
%a degree in Celsius).
Dates = x2mdate((data(:,1)), 1,'datetime');
plot(Dates, data(:,(8:13)));
title('Mean Monthly Temperature by Location')
xlabel('Time');
ylabel('Mean Monthly Temperature, in inches');
title('Mean Monthly Temperature by Location');
%Columbia trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
ColTPCPMNTM = [data(:,2) ((data(:,8)./10)*(9/5)+32)];
Coltrans = [data(:,14)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,ColTPCPMNTM,[x'],[Coltrans']);
title('Location: Columbia')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%Minneapolis, Minnesota trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
MNTPCPMNTM = [data(:,3) ((data(:,9)./10)*(9/5)+32)];
MNtrans = [data(:,15)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,MNTPCPMNTM,[x'],[MNtrans']);
title('Location: Minneapolis, Minnesota')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%Pensacola, Florida trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
FLTPCPMNTM = [data(:,4) ((data(:,10)./10)*(9/5)+32)];
FLtrans = [data(:,16)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,FLTPCPMNTM,[x'],[FLtrans']);
title('Location: Pensacola, Florida')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%Phoenix, Arizona trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
AZTPCPMNTM = [data(:,5) ((data(:,11)./10)*(9/5)+32)];
AZtrans = [data(:,17)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,AZTPCPMNTM,[x'],[AZtrans']);
title('Location: Phoenix, Arizona')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%Seattle, Washington trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
WATPCPMNTM = [data(:,6) ((data(:,12)./10)*(9/5)+32)];
WAtrans = [data(:,18)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,WATPCPMNTM,[x'],[WAtrans']);
title('Location: Seattle, Washington')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%Charleston, South Carolina trend lines comparing precipitation, temperature,
%and local transmission probabilities for Chikungunya virus.
x = Dates;
SCTPCPMNTM = [data(:,7) ((data(:,13)./10)*(9/5)+32)];
SCtrans = [data(:,19)*100];
figure
[hAx,hLine1,hLine2] = plotyy(x,SCTPCPMNTM,[x'],[SCtrans']);
title('Location: Charleston, South Carolina')
xlabel('Time');
zlabel('Local Tranmission of Chikungunya Virus (%)');
legend('Precipitation, in inches', 'Temperature, in Farenheit',...
'Local Transmission Probability');
%'Misc Code, not used------------------------------.
%scatter3(Dates, [data(:,2),data(:,8), data(:,14)]);
%polyfit(data(:,2),data(:,8),data(:,14));
%scatter3(Dates, [data(:,3),data(:,9), data(:,15)]);
%scatter3(Dates, [data(:,4),data(:,10), data(:,16)]);
%scatter3(Dates, [data(:,5),data(:,11), data(:,17)]);
%scatter3(Dates, [data(:,6),data(:,12), data(:,18)]);
%scatter3(Dates, [data(:,7),data(:,13), data(:,19)]);