setwd("~/Desktop/inPrep/pew/github/erp/Rmd")
This is an R Markdown document for the analysis of Pearson’s correlation between Mackerel biomass trends (SSB and recruitment) and sea surface temperature. Four temperature time series were used at 0, 1, and 2 year lags. These include:
# Calculate correlation matrix
cor_matrix <- cor(data)
corrplot(cor_matrix, method = "color",tl.cex = 0.8,tl.col = 'black')
Figure 1. Pearson’s correlation analysis for mackerel SSB and recruitment against sea surface temperature.
# Calculate p values
pval <- psych::corr.test(data, adjust="none")$p
# Plot correlation and p values
corrplot(cor_matrix, p.mat=pval,method="color", insig="label_sig",sig.level=c(0.001, 0.01, 0.05),pch.cex = 1, tl.cex = 0.8,tl.col = 'black',order = 'hclust', addrect = 2)
Figure 2. Pearson’s correlation analysis for mackerel SSB and recruitment against sea surface temperature. The matrix is arranged to cluster comparable groups. The two clusters here represent comparisons 1) between temperature time series and 2) between recruitment and SSB time series. The comparisons outside of the clusters are therefore those which compare dependent and independent variables. Significance is denoted based on p-values: 0.05, 0.01, 0.001.