forked from SnBuenafe/LarvaDistModels
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path18e_PCA_CorrMatrices.R
More file actions
51 lines (42 loc) · 1.79 KB
/
18e_PCA_CorrMatrices.R
File metadata and controls
51 lines (42 loc) · 1.79 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
# DESCRIPTION: Correlation matrices using the PCA loadings
# Load preliminaries
source("00_Preliminaries.R")
seasons <- c("jan-mar", "apr-jun", "jul-sept", "oct-dec")
PC <- c("PC1", "PC2")
figure_dir <- here::here(figure_dir, "PCA")
#### January-March ####
# PC1
res <- prepare_corrmat_obj("jan-mar", "Comp.1")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC1_jan-mar.png")), height = 4, width = 9, dpi = 600)
# PC2
res <- prepare_corrmat_obj("jan-mar", "Comp.2")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC2_jan-mar.png")), height = 4, width = 9, dpi = 600)
#### April-June ####
# PC1
res <- prepare_corrmat_obj("apr-jun", "Comp.1")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC1_apr-jun.png")), height = 4, width = 9, dpi = 600)
# PC2
res <- prepare_corrmat_obj("apr-jun", "Comp.2")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC2_apr-jun.png")), height = 4, width = 9, dpi = 600)
#### July-September ####
# PC1
res <- prepare_corrmat_obj("jul-sept", "Comp.1")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC1_jul-sept.png")), height = 4, width = 9, dpi = 600)
# PC2
res <- prepare_corrmat_obj("jul-sept", "Comp.2")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC2_jul-sept.png")), height = 4, width = 9, dpi = 600)
#### October-December ####
# PC1
res <- prepare_corrmat_obj("oct-dec", "Comp.1")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC1_oct-dec.png")), height = 4, width = 9, dpi = 600)
# PC2
res <- prepare_corrmat_obj("oct-dec", "Comp.2")
gg <- plotCorrMat(res)
ggsave(plot = gg, here::here(figure_dir, paste("CorrMat_PC2_oct-dec.png")), height = 4, width = 9, dpi = 600)