Last updated: 2020-07-31

Checks: 7 0

Knit directory: Cant_eMLR/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20200707) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 2b887d4. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rproj.user/
    Ignored:    data/GLODAPv2_2016b_MappedClimatologies/
    Ignored:    data/GLODAPv2_2020/
    Ignored:    data/World_Ocean_Atlas_2018/
    Ignored:    data/eMLR/
    Ignored:    data/pCO2_atmosphere/
    Ignored:    dump/

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/eMLR.Rmd) and HTML (docs/eMLR.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd 2b887d4 jens-daniel-mueller 2020-07-31 separate basin corr plots
html a469d3a jens-daniel-mueller 2020-07-31 Build site.
Rmd 1692f11 jens-daniel-mueller 2020-07-31 link to individual corr plots, one example individual plot shown
html e9a52c5 jens-daniel-mueller 2020-07-31 Build site.
Rmd 5ee70b2 jens-daniel-mueller 2020-07-31 formatting
html d28701c jens-daniel-mueller 2020-07-30 Build site.
Rmd 3938c9c jens-daniel-mueller 2020-07-30 chunk labels changed
html f22eed2 jens-daniel-mueller 2020-07-30 Build site.
Rmd 2bc1628 jens-daniel-mueller 2020-07-30 correlation table and plot update
html e1e81fc jens-daniel-mueller 2020-07-30 Build site.
Rmd 85c758f jens-daniel-mueller 2020-07-30 PO4* calculation based on oxygen, correlation tables added, formating
html 7fc7fd4 jens-daniel-mueller 2020-07-30 Build site.
Rmd 48e1767 jens-daniel-mueller 2020-07-30 correlation coeffcients plots added
html 9dc5d7f jens-daniel-mueller 2020-07-29 Build site.
Rmd bf5ea88 jens-daniel-mueller 2020-07-29 rebuild, site definition in index.Rmd, without colinear plots
html 21524b4 jens-daniel-mueller 2020-07-29 Build site.
Rmd 3ad6a3c jens-daniel-mueller 2020-07-29 rebuild all with new navbar labels, colinear plots updated
html ff17968 jens-daniel-mueller 2020-07-29 Build site.
Rmd cb5074e jens-daniel-mueller 2020-07-29 subset Cant to GLODAP before merging
html 44502a9 jens-daniel-mueller 2020-07-28 Build site.
Rmd 5dce915 jens-daniel-mueller 2020-07-28 fit top 10 models
html 35f1cd4 jens-daniel-mueller 2020-07-28 Build site.
Rmd da498d0 jens-daniel-mueller 2020-07-28 formatted table, loaded kableExtra
html e5fc772 jens-daniel-mueller 2020-07-28 Build site.
Rmd 7fe0338 jens-daniel-mueller 2020-07-28 rmse output, 10 best models selected
html 4eebe14 jens-daniel-mueller 2020-07-24 Build site.
Rmd 12f9ef2 jens-daniel-mueller 2020-07-24 started neutral density calculation
html 2e08795 jens-daniel-mueller 2020-07-24 Build site.
html 61a1a48 jens-daniel-mueller 2020-07-24 Build site.
Rmd 864a6e3 jens-daniel-mueller 2020-07-24 merged predictor data sets
html 7f51d57 jens-daniel-mueller 2020-07-24 Build site.
Rmd 4a8deb2 jens-daniel-mueller 2020-07-24 corrected false to FALSE
html 2df2065 jens-daniel-mueller 2020-07-23 Build site.
Rmd fa350cf jens-daniel-mueller 2020-07-23 predictor correlation plots, bin2d map plots
html 9d1d67d jens-daniel-mueller 2020-07-23 Build site.
Rmd 3b6658b jens-daniel-mueller 2020-07-23 predictor correlation plots, bin2d map plots
html 2e3691a jens-daniel-mueller 2020-07-23 Build site.
Rmd 26bdc0a jens-daniel-mueller 2020-07-23 new era label, predictor correlation check started
html 556e6cc jens-daniel-mueller 2020-07-23 Build site.
Rmd 1ce10e7 jens-daniel-mueller 2020-07-23 read full GLODAP Cant data set rather than joining again
Rmd 0cb3db2 jens-daniel-mueller 2020-07-23 started MLR fitting
Rmd cf8bc74 jens-daniel-mueller 2020-07-23 started MLR fitting
Rmd 0252675 jens-daniel-mueller 2020-07-23 modeling started
html fdfa7b9 jens-daniel-mueller 2020-07-22 Build site.
Rmd 6416150 jens-daniel-mueller 2020-07-22 cut gamma into slabs
html 0cecfbf jens-daniel-mueller 2020-07-22 Build site.
Rmd 48cf01f jens-daniel-mueller 2020-07-22 defined isoneutral slabs
Rmd 32ed280 jens-daniel-mueller 2020-07-22 sign in Cstar delta plot
html 44334f8 jens-daniel-mueller 2020-07-22 Build site.
Rmd c398496 jens-daniel-mueller 2020-07-22 plot update
html 0ff656b jens-daniel-mueller 2020-07-22 Build site.
Rmd 4b81f16 jens-daniel-mueller 2020-07-22 plot update
html 23038c8 jens-daniel-mueller 2020-07-22 Build site.
Rmd 09b3ca8 jens-daniel-mueller 2020-07-22 eding plain text, restructuring some code
html ac6308d jens-daniel-mueller 2020-07-22 Build site.
Rmd 77c9642 jens-daniel-mueller 2020-07-22 formatted plots
html 40b99cb jens-daniel-mueller 2020-07-22 Build site.
Rmd 8a49adf jens-daniel-mueller 2020-07-22 adjustment to reference year implemented
html bb9c002 jens-daniel-mueller 2020-07-21 Build site.
Rmd d2ed0f8 jens-daniel-mueller 2020-07-21 harmonied lat lon labeling
html e1488e6 jens-daniel-mueller 2020-07-19 Build site.
Rmd e688d6e jens-daniel-mueller 2020-07-19 formating
html f7ea007 jens-daniel-mueller 2020-07-19 Build site.
Rmd 0992256 jens-daniel-mueller 2020-07-19 plotted individual Cstar terms
html 22b588c jens-daniel-mueller 2020-07-18 Build site.
html fdfe5a0 jens-daniel-mueller 2020-07-17 Build site.
Rmd f7485c6 jens-daniel-mueller 2020-07-17 re run als emlr
html 56c3ed9 jens-daniel-mueller 2020-07-14 Build site.
html 74d4abd jens-daniel-mueller 2020-07-14 Build site.
html 1c511ce jens-daniel-mueller 2020-07-14 Build site.
Rmd e03016e jens-daniel-mueller 2020-07-14 split read in per data set
html 45ed0ea jens-daniel-mueller 2020-07-14 Build site.
Rmd dc1c56e jens-daniel-mueller 2020-07-14 tref calculated
html b1ece68 jens-daniel-mueller 2020-07-13 Build site.
Rmd 8eb1b22 jens-daniel-mueller 2020-07-13 cleaned data base file
Rmd 9e8f7f1 jens-daniel-mueller 2020-07-13 untracked changes
html 79312b2 jens-daniel-mueller 2020-07-13 Build site.
Rmd ffbc2a1 jens-daniel-mueller 2020-07-13 added Cstar calculation
html 090cfeb jens-daniel-mueller 2020-07-13 Build site.
Rmd e6a2ade jens-daniel-mueller 2020-07-13 added Cstar calculation

library(tidyverse)
library(lubridate)
library(patchwork)
library(broom)
library(GGally)
library(olsrr)
library(knitr)
library(kableExtra)
library(broom)
library(corrr)

1 Required data

Required are:

  • GLODAPv2.2020
    • cleaned data file
    • horizontal grid of sampling coordinates
  • Cant from GLODAPv2_2016b_MappedClimatologies
  • annual mean atmospheric pCO2
GLODAP <- read_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
                              "GLODAPv2.2020_clean.csv"))

GLODAP_obs_grid <- read_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
                                           "GLODAPv2.2020_clean_obs_grid.csv"))

Cant_clim <- read_csv(here::here("data/GLODAPv2_2016b_MappedClimatologies/_summarized_files",
                                 "Cant.csv"))

co2_atm <- read_csv(here::here("data/pCO2_atmosphere/_summarized_data_files",
                               "co2_atm.csv"))

2 C*

C* serves as a conservative tracer of anthropogenic CO2 uptake. It is derived from measured DIC by removing the impact of

  • organic matter formation and respiration
  • calcification and calcium carbonate dissolution

Contributions of those processes are estimated from phosphate and alkalinity concentrations.

2.1 Stoichiometric ratios

rCP <- 117
rNP <- 16

The stoichiometric nutrient ratios for the production and mineralization of organic matter were set to:

  • C/P: 117
  • N/P: 16

2.2 Calculation

C* is calculated as:

print("Cstar = tco2  + rCP_phosphate  + talk_05  + rNP_phosphate_05")
[1] "Cstar = tco2  + rCP_phosphate  + talk_05  + rNP_phosphate_05"
GLODAP <- GLODAP %>% 
  mutate(rCP_phosphate = -rCP * phosphate,
         talk_05 = -0.5 * talk,
         rNP_phosphate_05 = -0.5 * rNP * phosphate,
         Cstar = tco2  + rCP_phosphate  + talk_05  + rNP_phosphate_05)

3 PO4* calculation

Currently, the predictor PO4* is calculated according to Clement and Gruber (2018), ie based on oxygen rather than nitrate.

GLODAP <- GLODAP %>% 
  mutate(phosphate_star = phosphate + (oxygen / 170)  - 1.95)
GLODAP <- GLODAP %>% 
  mutate(phosphate_star = phosphate - 16*nitrate  + 2.9)

4 Reference year adjustment

The reference year adjustment relies on an apriori estimate of Cant at a given location and depth, which is used as a scaling factor for the concurrent change in atmospheric CO2. The underlying assumption is a transient steady state for the oceanic Cant uptake. Here, Cant from the GLODAP mapped Climatology was used.

Note that eq. 6 in Clement and Gruber (2018) misses pCO2 pre-industrial in the denominator. Here we use the equation published in Gruber et al. (2019).

4.1 Merge data sets

4.1.1 GLODAP + Cant

Cant_clim <- Cant_clim %>% 
  drop_na()

Cant_clim_obs <- left_join(GLODAP_obs_grid, Cant_clim) %>% 
  select(-n)

rm(Cant_clim, GLODAP_obs_grid)

GLODAP_Cant_obs <- full_join(GLODAP, Cant_clim_obs)

rm(Cant_clim_obs)

# GLODAP_Cant_full %>% write_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
#                                           "GLODAP_Cant_full.csv"))
# 
# GLODAP_Cant_full <- read_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
#                                           "GLODAP_Cant_full.csv"))

The mapped Cant product was merged with GLODAP observation by:

  • using an identical 1x1° horizontal grid
  • linear interpolation of Cant from standard to sampling depth
GLODAP_Cant_obs <- GLODAP_Cant_obs %>% 
  group_by(lat, lon) %>% 
  arrange(depth) %>% 
  mutate(Cant_int = approxfun(depth, Cant, rule = 2)(depth)) %>% 
  ungroup()

ggplot() +
    geom_path(data = GLODAP_Cant_obs %>% 
              filter(lat == 48.5, lon == 165.5, !is.na(Cant)) %>% 
              arrange(depth),
            aes(Cant, depth, col = "mapped")) +
  geom_point(data = GLODAP_Cant_obs %>% 
              filter(lat == 48.5, lon == 165.5, !is.na(Cant)) %>% 
              arrange(depth),
            aes(Cant, depth, col = "mapped")) +
  geom_point(data = GLODAP_Cant_obs %>% 
              filter(lat == 48.5, lon == 165.5, date == ymd("2018-06-27")),
            aes(Cant_int, depth, col = "interpolated")) +
  scale_y_reverse() +
  scale_color_brewer(palette = "Dark2", name = "") +
  labs(title = "Cant interpolation to sampling depth - example profile")

GLODAP <- GLODAP_Cant_obs %>% 
  filter(!is.na(Cstar)) %>% 
  mutate(Cant = Cant_int) %>% 
  select(-Cant_int)

rm(GLODAP_Cant_obs)

4.1.2 GLODAP + atm. pCO2

GLODAP observations were merged with mean annual atmospheric pCO2 levels by year.

GLODAP <- left_join(GLODAP, co2_atm)

4.2 Calculate adjustment

GLODAP <- GLODAP %>% 
  group_by(era) %>% 
  mutate(tref = median(year)) %>% 
  ungroup()

tref <- GLODAP %>% 
  group_by(era) %>% 
  summarise(year = median(year)) %>% 
  ungroup()

co2_atm_tref <- right_join(co2_atm, tref) %>% 
  select(-year) %>% 
  rename(pCO2_tref = pCO2)

GLODAP <- full_join(GLODAP, co2_atm_tref)

rm(co2_atm, co2_atm_tref, tref)

GLODAP <- GLODAP %>% 
  mutate(Cstar_tref_delta = 
           ((pCO2 - pCO2_tref) / (pCO2_tref - 280)) * Cant,
         Cstar_tref = Cstar - Cstar_tref_delta)

4.3 Control plots

4.3.1 Histogram

GLODAP %>% 
  ggplot(aes(Cstar_tref_delta)) +
  geom_histogram()

4.3.2 Time series

GLODAP %>% 
  sample_n(10000) %>% 
  ggplot(aes(year, Cstar_tref_delta, col = Cant)) +
  geom_point() +
  scale_color_viridis_c() +
  labs(title = "random subsample 1e4")

5 Selected section plots

Selected sections are plotted to demonstrate the magnitude of various parameters and corrections relevant to C*.

cruises_meridional <- c("1041")

GLODAP_cruise <- GLODAP %>% 
  filter(cruise %in% cruises_meridional)
bbox <- c(
  "xmin" = min(GLODAP_cruise$lat),
  "ymin" = min(GLODAP_cruise$depth),
  "xmax" = max(GLODAP_cruise$lat),
  "ymax" = max(GLODAP_cruise$depth)
)

grd_template <- expand.grid(
  lat = seq(from = bbox["xmin"], to = bbox["xmax"], by = 1),
  depth = seq(from = bbox["ymin"], to = bbox["ymax"], by = 50) # 20 m resolution
)

crs_raster_format <- " +proj=utm  +zone=33  +ellps=GRS80  +towgs84=0,0,0,0,0,0,0  +units=m  +no_defs"

grd_template_raster <- grd_template %>% 
  dplyr::mutate(Z = 0) %>% 
  raster::rasterFromXYZ( 
    crs = crs_raster_format)


# Generalized Additive Model
fit_GAM <- mgcv::gam( # using {mgcv}
  gamma ~ s(lat, depth),      # here come our X/Y/Z data - straightforward enough
  data = GLODAP_cruise      # specify in which object the data is stored
)

# Generalized Additive Model
interp_GAM <- grd_template %>% 
  mutate(Z = predict(fit_GAM, .)) %>% 
  raster::rasterFromXYZ(crs = crs_raster_format)

df <- raster::rasterToPoints(interp_GAM) %>% as_tibble()
colnames(df) <- c("X", "Y", "Z")
  
ggplot(df, aes(x = X, y = Y, fill = Z, z = Z))  +
  geom_raster()  +
  geom_contour(col="white")  +
  ggtitle(label = "interp GAM")  +
  scale_fill_viridis_c()  +
  scale_y_reverse() +
  coord_cartesian(expand = 0)
mapWorld <- borders("world", colour = "gray60", fill = "gray60")

GLODAP_cruise %>%
  arrange(date) %>% 
  ggplot(aes(lon, lat)) +
  mapWorld +
  geom_path() +
  geom_point(aes(col = date)) +
  coord_quickmap(expand = 0) +
  scale_color_viridis_c(trans = "date") +
  labs(title = paste("Cruise year:", mean(GLODAP_cruise$year))) +
  theme(legend.position = "bottom")

lat_section <- 
GLODAP_cruise %>%
  ggplot(aes(lat, depth)) +
  scale_y_reverse() +
  scale_color_viridis_c() +
  theme(legend.position = "bottom")

lat_section +
  geom_point(aes(col = tco2))

lat_section +
  geom_point(aes(col = talk))

lat_section +
  geom_point(aes(col = phosphate))

lat_section +
  geom_point(aes(col = rCP_phosphate))

lat_section +
  geom_point(aes(col = talk_05))

lat_section +
  geom_point(aes(col = rNP_phosphate_05))

lat_section +
  geom_point(aes(col = Cstar))

lat_section +
  geom_point(aes(col = Cant))

lat_section +
  geom_point(aes(col = -Cstar_tref_delta))

rm(mapWorld, lat_section, GLODAP_cruise)

6 MLR

6.1 Isoneutral slabs

slabs_Atl <- c(
-Inf,
26.00,
26.50,
26.75,
27.00,
27.25,
27.50,
27.75,
27.85,
27.95,
28.05,
28.10,
28.15,
28.20,
Inf)

slabs_Ind_Pac <- c(
-Inf,
26.00,
26.50,
26.75,
27.00,
27.25,
27.50,
27.75,
27.85,
27.95,
28.05,
28.10,
Inf)

The following boundaries for isoneutral slabs were defined:

  • Atlantic: -, 26, 26.5, 26.75, 27, 27.25, 27.5, 27.75, 27.85, 27.95, 28.05, 28.1, 28.15, 28.2,
  • Indo-Pacific: -, 26, 26.5, 26.75, 27, 27.25, 27.5, 27.75, 27.85, 27.95, 28.05, 28.1,
GLODAP_Atl <- GLODAP %>% 
  filter(basin == "Atlantic") %>% 
  mutate(gamma_slab = cut(gamma, slabs_Atl))

GLODAP_Ind_Pac <- GLODAP %>% 
  filter(basin == "Indo-Pacific") %>% 
  mutate(gamma_slab = cut(gamma, slabs_Ind_Pac))

GLODAP <- bind_rows(GLODAP_Atl, GLODAP_Ind_Pac)
rm(GLODAP_Atl, GLODAP_Ind_Pac)
GLODAP_cruise <- GLODAP %>% 
  filter(cruise %in% cruises_meridional)

lat_section <- 
GLODAP_cruise %>%
  ggplot(aes(lat, depth)) +
  scale_y_reverse() +
  theme(legend.position = "bottom")

lat_section +
  geom_point(aes(col = gamma)) +
  scale_color_viridis_c()

lat_section +
  geom_point(aes(col = gamma_slab)) +
  scale_color_viridis_d()

6.2 Predictor correlation

The correlation between:

  • pairs of seven potential predictor variables and
  • C* and seven potential predictor variables

were investigated based on:

  • property-property plots and
  • calculated correlation coeffcients.

6.2.1 Correlation plots

For an overview, a subset of data from all basins and eras were plotted, with color indicating neutral density slabs.

GLODAP %>% 
  filter(basin == "Atlantic") %>% 
  sample_frac(0.05) %>% 
  ggpairs(columns = c("Cstar",
                      "salinity",
                      "temperature",
                      "aou",
                      "oxygen",
                      "silicate",
                      "phosphate",
                      "phosphate_star"),
          ggplot2::aes(col = gamma_slab, fill = gamma_slab, alpha = 0.01)) +
      scale_fill_viridis_d() +
      scale_color_viridis_d() +
      labs(title = paste("Basin: Atlantic | era: all | subsample size: 5 % of",
                         nrow(GLODAP %>% filter(basin == "Atlantic"))))

GLODAP %>% 
  filter(basin == "Indo-Pacific") %>% 
  sample_frac(0.05) %>% 
  ggpairs(columns = c("Cstar",
                      "salinity",
                      "temperature",
                      "aou",
                      "oxygen",
                      "silicate",
                      "phosphate",
                      "phosphate_star"),
          ggplot2::aes(col = gamma_slab, fill = gamma_slab, alpha = 0.01)) +
      scale_fill_viridis_d() +
      scale_color_viridis_d() +
      labs(title = paste("Basin: Indo-Pacific | era: all | subsample size: 5 % of",
                         nrow(GLODAP %>% filter(basin == "Indo-Pacific") )))

Individual correlation plots for each basin, era and neutral density (gamma) slab are available here.

for (i_basin in unique(GLODAP$basin)) {
  for (i_era in unique(GLODAP$era)) {

# i_basin <- unique(GLODAP$basin)[1]
# i_era   <- unique(GLODAP$era)[1]

print(i_basin)
print(i_era)

GLODAP_basin_era <- GLODAP %>% 
  filter(basin == i_basin,
         era == i_era)

for (i_gamma_slab in unique(GLODAP_basin_era$gamma_slab)) {
  
  #i_gamma_slab <- unique(GLODAP_basin_era$gamma_slab)[5]
  print(i_gamma_slab)
  
  GLODAP_highlight <- GLODAP_basin_era %>% 
  mutate(gamma_highlight = if_else(gamma_slab == i_gamma_slab,
                                   "in", "out")) %>%
    arrange(desc(gamma_highlight))
  
p <- GLODAP_highlight %>% 
  ggpairs(columns = c("Cstar",
                      "salinity",
                      "temperature",
                      "aou",
                      "oxygen",
                      "silicate",
                      "phosphate",
                      "phosphate_star"),
          ggplot2::aes(col = gamma_highlight, fill = gamma_highlight, alpha = 0.01)) +
      scale_fill_manual( values = c("red", "grey")) +
      scale_color_manual(values = c("red", "grey")) +
      labs(title = paste(i_basin,
                         "| ", i_era,
                         "| Gamma slab", i_gamma_slab,
                         "| total nr", nrow(GLODAP_basin_era),
                         "| slab nr", nrow(GLODAP_highlight %>% 
                                             filter(gamma_highlight == "slab"))))
  

png(here::here("output/figure/eMLR/predictor_correlation",
               paste("predictor_correlation", i_basin, i_era, i_gamma_slab, ".png", sep = "_")),
    width = 12, height = 12, units = "in", res = 300)

print(p)

dev.off()
  
    }
  }
}

6.2.2 Correlation assesment

6.2.2.1 Calculation of correlation coeffcients

for (i_basin in unique(GLODAP$basin)) {
  for (i_era in unique(GLODAP$era)) {

# i_basin <- unique(GLODAP$basin)[1]
# i_era   <- unique(GLODAP$era)[1]
print(i_basin)
print(i_era)

GLODAP_basin_era <- GLODAP %>% 
  filter(basin == i_basin,
         era == i_era) %>% 
  select(basin,
         era,
         gamma_slab,
         Cstar,
         salinity,
         temperature,
         aou,
         oxygen,
         silicate,
         phosphate,
         phosphate_star)

for (i_gamma_slab in unique(GLODAP_basin_era$gamma_slab)) {
  
  # i_gamma_slab <- unique(GLODAP_basin_era$gamma_slab)[5]
  print(i_gamma_slab)
  
  GLODAP_basin_era_slab <- GLODAP_basin_era %>%
    filter(gamma_slab == i_gamma_slab)

  cor_Cstar_predictor_temp <- GLODAP_basin_era_slab %>% 
    select(-c(basin, era, gamma_slab)) %>% 
    correlate() %>% 
    focus(Cstar) %>% 
    mutate(basin = i_basin,
       era = i_era,
       gamma_slab = i_gamma_slab)
  
  if (exists("cor_Cstar_predictor")) {
        cor_Cstar_predictor <- bind_rows(cor_Cstar_predictor, cor_Cstar_predictor_temp)
      }
      
    if (!exists("cor_Cstar_predictor")) {
        cor_Cstar_predictor <- cor_Cstar_predictor_temp
    }
  
  
  cor_predictors_temp <- GLODAP_basin_era_slab %>% 
    select(-c(basin, era, gamma_slab)) %>% 
    correlate() %>% 
    shave %>% 
    stretch() %>% 
    filter(!is.na(r),
           x != "Cstar",
           y != "Cstar") %>% 
    mutate(pair = paste(x, y, sep = " + ")) %>% 
    select(-c(x, y)) %>% 
    mutate(basin = i_basin,
       era = i_era,
       gamma_slab = i_gamma_slab)
  
    if (exists("cor_predictors")) {
        cor_predictors <- bind_rows(cor_predictors, cor_predictors_temp)
      }
      
    if (!exists("cor_predictors")) {
        cor_predictors <- cor_predictors_temp
    }
  
  
  
    }
  }
}


cor_predictors %>%
  write_csv(here::here("data/eMLR",
                       "cor_predictors.csv"))

cor_Cstar_predictor %>%
  write_csv(here::here("data/eMLR",
                       "cor_Cstar_predictor.csv"))

rm(cor_predictors_temp, cor_Cstar_predictor_temp)

6.2.2.2 Predictor pairs

cor_predictors <-
  read_csv(here::here("data/eMLR",
                       "cor_predictors.csv"))

cor_predictors_stats <- cor_predictors %>% 
  group_by(pair, basin, gamma_slab) %>% 
  summarise(mean_r = mean(r),
            min_r = min(r),
            max_r = max(r)) %>% 
  ungroup()

cor_predictors_stats %>% 
  mutate(pair = reorder(pair, mean_r)) %>%
  ggplot() +
  geom_vline(xintercept = c(-0.9, 0.9), col = "red") +
  geom_vline(xintercept = 0) +
  geom_linerange(
    aes(y = pair, xmin = min_r, xmax = max_r, col = gamma_slab),
    position = position_dodge(width = 0.6)) +
  facet_wrap(~basin) +
  scale_color_viridis_d(direction = -1) +
  labs(x = "correlation coefficient", y = "") +
  theme(legend.position = "top")

kable(cor_predictors_stats) %>%
  add_header_above() %>%
  kable_styling() %>%
  scroll_box(width = "100%", height = "400px")
pair basin gamma_slab mean_r min_r max_r
aou + oxygen Atlantic (-Inf,26] -0.9181612 -0.9566141 -0.8863166
aou + oxygen Atlantic (26,26.5] -0.9168222 -0.9409620 -0.8987570
aou + oxygen Atlantic (26.5,26.75] -0.9652673 -0.9754904 -0.9501770
aou + oxygen Atlantic (26.75,27] -0.9782180 -0.9856810 -0.9697365
aou + oxygen Atlantic (27,27.25] -0.9744293 -0.9820587 -0.9637201
aou + oxygen Atlantic (27.25,27.5] -0.9522776 -0.9608428 -0.9397143
aou + oxygen Atlantic (27.5,27.75] -0.9303794 -0.9470832 -0.9028461
aou + oxygen Atlantic (27.75,27.85] -0.9772131 -0.9786507 -0.9759298
aou + oxygen Atlantic (27.85,27.95] -0.9893344 -0.9918342 -0.9873376
aou + oxygen Atlantic (27.95,28.05] -0.9889256 -0.9926695 -0.9823756
aou + oxygen Atlantic (28.05,28.1] -0.9893533 -0.9942939 -0.9813655
aou + oxygen Atlantic (28.1,28.15] -0.9938055 -0.9945634 -0.9923620
aou + oxygen Atlantic (28.15,28.2] -0.9981383 -0.9986039 -0.9974366
aou + oxygen Atlantic (28.2, Inf] -0.9785520 -0.9837852 -0.9737943
aou + oxygen Indo-Pacific (-Inf,26] -0.9199892 -0.9636779 -0.8894647
aou + oxygen Indo-Pacific (26,26.5] -0.9803426 -0.9845577 -0.9728250
aou + oxygen Indo-Pacific (26.5,26.75] -0.9850881 -0.9877960 -0.9817863
aou + oxygen Indo-Pacific (26.75,27] -0.9836727 -0.9846370 -0.9829894
aou + oxygen Indo-Pacific (27,27.25] -0.9886504 -0.9929829 -0.9800836
aou + oxygen Indo-Pacific (27.25,27.5] -0.9913226 -0.9954821 -0.9836315
aou + oxygen Indo-Pacific (27.5,27.75] -0.9926744 -0.9967320 -0.9852991
aou + oxygen Indo-Pacific (27.75,27.85] -0.9961082 -0.9989585 -0.9921026
aou + oxygen Indo-Pacific (27.85,27.95] -0.9968241 -0.9990057 -0.9946008
aou + oxygen Indo-Pacific (27.95,28.05] -0.9951951 -0.9964353 -0.9934380
aou + oxygen Indo-Pacific (28.05,28.1] -0.9956157 -0.9966147 -0.9946222
aou + oxygen Indo-Pacific (28.1, Inf] -0.9908663 -0.9923555 -0.9887596
aou + phosphate Atlantic (-Inf,26] 0.6488368 0.5161554 0.7417322
aou + phosphate Atlantic (26,26.5] 0.7509904 0.5753655 0.9216757
aou + phosphate Atlantic (26.5,26.75] 0.8799344 0.8385999 0.9294296
aou + phosphate Atlantic (26.75,27] 0.8653866 0.8170427 0.8970329
aou + phosphate Atlantic (27,27.25] 0.7961680 0.6776659 0.8599479
aou + phosphate Atlantic (27.25,27.5] 0.7214986 0.6277934 0.8023489
aou + phosphate Atlantic (27.5,27.75] 0.8384476 0.7895234 0.8678536
aou + phosphate Atlantic (27.75,27.85] 0.9466782 0.9405605 0.9553219
aou + phosphate Atlantic (27.85,27.95] 0.9573251 0.9478591 0.9688590
aou + phosphate Atlantic (27.95,28.05] 0.9643270 0.9511925 0.9862507
aou + phosphate Atlantic (28.05,28.1] 0.9705710 0.9555563 0.9871036
aou + phosphate Atlantic (28.1,28.15] 0.9805780 0.9784785 0.9841974
aou + phosphate Atlantic (28.15,28.2] 0.9922852 0.9889823 0.9946912
aou + phosphate Atlantic (28.2, Inf] 0.8184560 0.7760113 0.8773826
aou + phosphate Indo-Pacific (-Inf,26] 0.9403499 0.9073617 0.9670963
aou + phosphate Indo-Pacific (26,26.5] 0.9545261 0.9481344 0.9627786
aou + phosphate Indo-Pacific (26.5,26.75] 0.9511342 0.9393080 0.9626975
aou + phosphate Indo-Pacific (26.75,27] 0.9500133 0.9461165 0.9539790
aou + phosphate Indo-Pacific (27,27.25] 0.9666580 0.9484321 0.9806798
aou + phosphate Indo-Pacific (27.25,27.5] 0.9711209 0.9521979 0.9808396
aou + phosphate Indo-Pacific (27.5,27.75] 0.9751403 0.9605167 0.9825862
aou + phosphate Indo-Pacific (27.75,27.85] 0.9823398 0.9735339 0.9883639
aou + phosphate Indo-Pacific (27.85,27.95] 0.9801186 0.9705015 0.9891580
aou + phosphate Indo-Pacific (27.95,28.05] 0.9674872 0.9566842 0.9761508
aou + phosphate Indo-Pacific (28.05,28.1] 0.9574105 0.9442222 0.9715225
aou + phosphate Indo-Pacific (28.1, Inf] 0.7800593 0.7279375 0.8296450
aou + phosphate_star Atlantic (-Inf,26] 0.0751886 -0.4341508 0.3482348
aou + phosphate_star Atlantic (26,26.5] 0.3475250 0.0643405 0.6175442
aou + phosphate_star Atlantic (26.5,26.75] 0.4741260 0.3723426 0.6411307
aou + phosphate_star Atlantic (26.75,27] 0.2753734 0.2256466 0.3240950
aou + phosphate_star Atlantic (27,27.25] 0.1490537 -0.0321727 0.3056935
aou + phosphate_star Atlantic (27.25,27.5] 0.1729314 0.0440112 0.3213433
aou + phosphate_star Atlantic (27.5,27.75] 0.5455524 0.4836519 0.5929938
aou + phosphate_star Atlantic (27.75,27.85] 0.7638965 0.7433138 0.7962242
aou + phosphate_star Atlantic (27.85,27.95] 0.7180275 0.6537077 0.7855705
aou + phosphate_star Atlantic (27.95,28.05] 0.8229635 0.7423182 0.9319089
aou + phosphate_star Atlantic (28.05,28.1] 0.8861871 0.8392220 0.9523375
aou + phosphate_star Atlantic (28.1,28.15] 0.9253933 0.9114497 0.9418630
aou + phosphate_star Atlantic (28.15,28.2] 0.9755588 0.9625218 0.9834872
aou + phosphate_star Atlantic (28.2, Inf] 0.4783872 0.3898943 0.6414743
aou + phosphate_star Indo-Pacific (-Inf,26] 0.6620179 0.5215468 0.7430101
aou + phosphate_star Indo-Pacific (26,26.5] 0.5812512 0.5202906 0.6206208
aou + phosphate_star Indo-Pacific (26.5,26.75] 0.4265043 0.1669141 0.5829578
aou + phosphate_star Indo-Pacific (26.75,27] 0.3870938 0.3240540 0.4860624
aou + phosphate_star Indo-Pacific (27,27.25] 0.1607629 0.0764660 0.2290589
aou + phosphate_star Indo-Pacific (27.25,27.5] -0.4139314 -0.4787101 -0.3597691
aou + phosphate_star Indo-Pacific (27.5,27.75] -0.6003363 -0.6957268 -0.4920225
aou + phosphate_star Indo-Pacific (27.75,27.85] -0.4758166 -0.6105114 -0.3557962
aou + phosphate_star Indo-Pacific (27.85,27.95] -0.0689547 -0.1201820 0.0056397
aou + phosphate_star Indo-Pacific (27.95,28.05] 0.2346827 0.1165401 0.3284777
aou + phosphate_star Indo-Pacific (28.05,28.1] 0.4091718 0.3650681 0.4643695
aou + phosphate_star Indo-Pacific (28.1, Inf] -0.6155817 -0.6499367 -0.5641977
aou + silicate Atlantic (-Inf,26] 0.2654543 0.0884202 0.4145649
aou + silicate Atlantic (26,26.5] 0.6747329 0.5172910 0.8265329
aou + silicate Atlantic (26.5,26.75] 0.8953646 0.8608648 0.9291670
aou + silicate Atlantic (26.75,27] 0.8767545 0.8429220 0.9015240
aou + silicate Atlantic (27,27.25] 0.7587540 0.6532535 0.8355002
aou + silicate Atlantic (27.25,27.5] 0.5181865 0.4038500 0.6853791
aou + silicate Atlantic (27.5,27.75] 0.6086402 0.5720276 0.6699890
aou + silicate Atlantic (27.75,27.85] 0.8515955 0.8448051 0.8642328
aou + silicate Atlantic (27.85,27.95] 0.8977712 0.8893889 0.9121609
aou + silicate Atlantic (27.95,28.05] 0.9473367 0.9366867 0.9638062
aou + silicate Atlantic (28.05,28.1] 0.9710848 0.9618608 0.9826435
aou + silicate Atlantic (28.1,28.15] 0.9768582 0.9752126 0.9792466
aou + silicate Atlantic (28.15,28.2] 0.9911038 0.9862753 0.9955321
aou + silicate Atlantic (28.2, Inf] 0.8287733 0.7792842 0.8681030
aou + silicate Indo-Pacific (-Inf,26] 0.7213888 0.6365610 0.7899518
aou + silicate Indo-Pacific (26,26.5] 0.6505259 0.5381656 0.7487756
aou + silicate Indo-Pacific (26.5,26.75] 0.6121560 0.4093259 0.7315507
aou + silicate Indo-Pacific (26.75,27] 0.7488040 0.6938246 0.7813525
aou + silicate Indo-Pacific (27,27.25] 0.8648235 0.8075377 0.9105990
aou + silicate Indo-Pacific (27.25,27.5] 0.8993870 0.8537286 0.9387602
aou + silicate Indo-Pacific (27.5,27.75] 0.9194243 0.8681200 0.9540944
aou + silicate Indo-Pacific (27.75,27.85] 0.9671074 0.9511809 0.9761360
aou + silicate Indo-Pacific (27.85,27.95] 0.9644635 0.9545940 0.9707377
aou + silicate Indo-Pacific (27.95,28.05] 0.9493197 0.9417607 0.9533539
aou + silicate Indo-Pacific (28.05,28.1] 0.9487765 0.9460695 0.9532193
aou + silicate Indo-Pacific (28.1, Inf] 0.6256825 0.5387657 0.6694329
oxygen + phosphate Atlantic (-Inf,26] -0.4412587 -0.6061311 -0.3072346
oxygen + phosphate Atlantic (26,26.5] -0.4575598 -0.7627491 -0.1724774
oxygen + phosphate Atlantic (26.5,26.75] -0.7300061 -0.8281720 -0.6306966
oxygen + phosphate Atlantic (26.75,27] -0.7453860 -0.8115376 -0.6537454
oxygen + phosphate Atlantic (27,27.25] -0.6443769 -0.7382896 -0.4603906
oxygen + phosphate Atlantic (27.25,27.5] -0.4827029 -0.6095132 -0.3297344
oxygen + phosphate Atlantic (27.5,27.75] -0.5966809 -0.6749872 -0.4653694
oxygen + phosphate Atlantic (27.75,27.85] -0.8629912 -0.8760309 -0.8562542
oxygen + phosphate Atlantic (27.85,27.95] -0.9109015 -0.9348224 -0.8915953
oxygen + phosphate Atlantic (27.95,28.05] -0.9275300 -0.9680297 -0.8866843
oxygen + phosphate Atlantic (28.05,28.1] -0.9356801 -0.9742818 -0.8890527
oxygen + phosphate Atlantic (28.1,28.15] -0.9594641 -0.9679879 -0.9515113
oxygen + phosphate Atlantic (28.15,28.2] -0.9886288 -0.9933712 -0.9803690
oxygen + phosphate Atlantic (28.2, Inf] -0.7033246 -0.7805874 -0.6632504
oxygen + phosphate Indo-Pacific (-Inf,26] -0.7839570 -0.9067335 -0.6823081
oxygen + phosphate Indo-Pacific (26,26.5] -0.8838199 -0.9048178 -0.8555408
oxygen + phosphate Indo-Pacific (26.5,26.75] -0.8889792 -0.9140662 -0.8726298
oxygen + phosphate Indo-Pacific (26.75,27] -0.8827241 -0.8880642 -0.8745155
oxygen + phosphate Indo-Pacific (27,27.25] -0.9238446 -0.9561043 -0.8755487
oxygen + phosphate Indo-Pacific (27.25,27.5] -0.9427922 -0.9674903 -0.8953701
oxygen + phosphate Indo-Pacific (27.5,27.75] -0.9585959 -0.9797089 -0.9229040
oxygen + phosphate Indo-Pacific (27.75,27.85] -0.9755911 -0.9887694 -0.9587606
oxygen + phosphate Indo-Pacific (27.85,27.95] -0.9722513 -0.9878715 -0.9581609
oxygen + phosphate Indo-Pacific (27.95,28.05] -0.9466635 -0.9591235 -0.9304693
oxygen + phosphate Indo-Pacific (28.05,28.1] -0.9340143 -0.9526139 -0.9221487
oxygen + phosphate Indo-Pacific (28.1, Inf] -0.7014531 -0.7608328 -0.6356990
oxygen + phosphate_star Atlantic (-Inf,26] 0.1893903 -0.1230309 0.6411888
oxygen + phosphate_star Atlantic (26,26.5] 0.0228416 -0.3412350 0.3696066
oxygen + phosphate_star Atlantic (26.5,26.75] -0.2360841 -0.4598066 -0.1076626
oxygen + phosphate_star Atlantic (26.75,27] -0.0749306 -0.1287144 0.0167700
oxygen + phosphate_star Atlantic (27,27.25] 0.0693905 -0.0997210 0.2947309
oxygen + phosphate_star Atlantic (27.25,27.5] 0.1276161 -0.0503131 0.2955341
oxygen + phosphate_star Atlantic (27.5,27.75] -0.2177089 -0.3157434 -0.0747768
oxygen + phosphate_star Atlantic (27.75,27.85] -0.6170288 -0.6556548 -0.5972095
oxygen + phosphate_star Atlantic (27.85,27.95] -0.6181154 -0.7085527 -0.5422986
oxygen + phosphate_star Atlantic (27.95,28.05] -0.7502733 -0.8930381 -0.6783013
oxygen + phosphate_star Atlantic (28.05,28.1] -0.8239907 -0.9270406 -0.7284906
oxygen + phosphate_star Atlantic (28.1,28.15] -0.8866594 -0.9116651 -0.8736184
oxygen + phosphate_star Atlantic (28.15,28.2] -0.9682666 -0.9801919 -0.9467860
oxygen + phosphate_star Atlantic (28.2, Inf] -0.3117873 -0.4938331 -0.2050104
oxygen + phosphate_star Indo-Pacific (-Inf,26] -0.3698447 -0.5847842 -0.1280827
oxygen + phosphate_star Indo-Pacific (26,26.5] -0.4202618 -0.4584822 -0.3719583
oxygen + phosphate_star Indo-Pacific (26.5,26.75] -0.2761827 -0.4243091 -0.0048738
oxygen + phosphate_star Indo-Pacific (26.75,27] -0.2217661 -0.3227939 -0.1608680
oxygen + phosphate_star Indo-Pacific (27,27.25] -0.0265311 -0.1236776 0.1115391
oxygen + phosphate_star Indo-Pacific (27.25,27.5] 0.5064386 0.4721050 0.5407410
oxygen + phosphate_star Indo-Pacific (27.5,27.75] 0.6614212 0.6066151 0.7182471
oxygen + phosphate_star Indo-Pacific (27.75,27.85] 0.5145704 0.4301678 0.6144466
oxygen + phosphate_star Indo-Pacific (27.85,27.95] 0.1122673 0.0557543 0.1740921
oxygen + phosphate_star Indo-Pacific (27.95,28.05] -0.1584253 -0.2445424 -0.0445188
oxygen + phosphate_star Indo-Pacific (28.05,28.1] -0.3379210 -0.4043857 -0.2788553
oxygen + phosphate_star Indo-Pacific (28.1, Inf] 0.7065238 0.6675602 0.7338818
oxygen + silicate Atlantic (-Inf,26] -0.0202925 -0.1715993 0.1534811
oxygen + silicate Atlantic (26,26.5] -0.3941576 -0.6443663 -0.1482352
oxygen + silicate Atlantic (26.5,26.75] -0.7701318 -0.8436954 -0.6846121
oxygen + silicate Atlantic (26.75,27] -0.7780682 -0.8302180 -0.7139144
oxygen + silicate Atlantic (27,27.25] -0.6142032 -0.7169366 -0.4522280
oxygen + silicate Atlantic (27.25,27.5] -0.2596380 -0.4764353 -0.0923371
oxygen + silicate Atlantic (27.5,27.75] -0.3185453 -0.4360723 -0.2092809
oxygen + silicate Atlantic (27.75,27.85] -0.7407622 -0.7579846 -0.7298223
oxygen + silicate Atlantic (27.85,27.95] -0.8322018 -0.8599509 -0.8161961
oxygen + silicate Atlantic (27.95,28.05] -0.8965103 -0.9290503 -0.8615934
oxygen + silicate Atlantic (28.05,28.1] -0.9316667 -0.9616389 -0.8975675
oxygen + silicate Atlantic (28.1,28.15] -0.9522411 -0.9528684 -0.9511337
oxygen + silicate Atlantic (28.15,28.2] -0.9869917 -0.9916129 -0.9808054
oxygen + silicate Atlantic (28.2, Inf] -0.7163708 -0.7458716 -0.6760719
oxygen + silicate Indo-Pacific (-Inf,26] -0.4884062 -0.6825358 -0.3169944
oxygen + silicate Indo-Pacific (26,26.5] -0.5302245 -0.6549671 -0.4175494
oxygen + silicate Indo-Pacific (26.5,26.75] -0.4928426 -0.6371103 -0.2746742
oxygen + silicate Indo-Pacific (26.75,27] -0.6349982 -0.6716084 -0.5683559
oxygen + silicate Indo-Pacific (27,27.25] -0.7945613 -0.8639831 -0.6962955
oxygen + silicate Indo-Pacific (27.25,27.5] -0.8492028 -0.9092098 -0.7707499
oxygen + silicate Indo-Pacific (27.5,27.75] -0.8794456 -0.9316797 -0.7938492
oxygen + silicate Indo-Pacific (27.75,27.85] -0.9519542 -0.9721552 -0.9212389
oxygen + silicate Indo-Pacific (27.85,27.95] -0.9504681 -0.9648651 -0.9328229
oxygen + silicate Indo-Pacific (27.95,28.05] -0.9245872 -0.9323370 -0.9110657
oxygen + silicate Indo-Pacific (28.05,28.1] -0.9256529 -0.9269820 -0.9237752
oxygen + silicate Indo-Pacific (28.1, Inf] -0.5366149 -0.5919324 -0.4282915
phosphate + phosphate_star Atlantic (-Inf,26] 0.7624671 0.5332725 0.8902339
phosphate + phosphate_star Atlantic (26,26.5] 0.8668735 0.8515142 0.8809509
phosphate + phosphate_star Atlantic (26.5,26.75] 0.8320960 0.7783560 0.8785106
phosphate + phosphate_star Atlantic (26.75,27] 0.7162345 0.6721479 0.7456449
phosphate + phosphate_star Atlantic (27,27.25] 0.7086069 0.6647082 0.7485194
phosphate + phosphate_star Atlantic (27.25,27.5] 0.8031728 0.7826237 0.8224384
phosphate + phosphate_star Atlantic (27.5,27.75] 0.9115930 0.9041334 0.9174374
phosphate + phosphate_star Atlantic (27.75,27.85] 0.9300108 0.9253656 0.9385056
phosphate + phosphate_star Atlantic (27.85,27.95] 0.8862340 0.8465936 0.9129611
phosphate + phosphate_star Atlantic (27.95,28.05] 0.9408191 0.9033721 0.9773587
phosphate + phosphate_star Atlantic (28.05,28.1] 0.9701545 0.9612884 0.9876899
phosphate + phosphate_star Atlantic (28.1,28.15] 0.9809299 0.9757912 0.9856240
phosphate + phosphate_star Atlantic (28.15,28.2] 0.9948207 0.9916620 0.9964604
phosphate + phosphate_star Atlantic (28.2, Inf] 0.8932301 0.8684747 0.9289934
phosphate + phosphate_star Indo-Pacific (-Inf,26] 0.8603014 0.8124352 0.8961438
phosphate + phosphate_star Indo-Pacific (26,26.5] 0.7938226 0.7526968 0.8355190
phosphate + phosphate_star Indo-Pacific (26.5,26.75] 0.6775601 0.4926295 0.8031857
phosphate + phosphate_star Indo-Pacific (26.75,27] 0.6518593 0.6008772 0.7413236
phosphate + phosphate_star Indo-Pacific (27,27.25] 0.3985357 0.3824574 0.4090257
phosphate + phosphate_star Indo-Pacific (27.25,27.5] -0.2020783 -0.3104182 -0.0694949
phosphate + phosphate_star Indo-Pacific (27.5,27.75] -0.4289067 -0.5642191 -0.2537503
phosphate + phosphate_star Indo-Pacific (27.75,27.85] -0.3195294 -0.4896367 -0.1558532
phosphate + phosphate_star Indo-Pacific (27.85,27.95] 0.1162110 0.0487248 0.2323633
phosphate + phosphate_star Indo-Pacific (27.95,28.05] 0.4635889 0.3254063 0.5827854
phosphate + phosphate_star Indo-Pacific (28.05,28.1] 0.6489135 0.6019465 0.7266992
phosphate + phosphate_star Indo-Pacific (28.1, Inf] 0.0053285 -0.0947674 0.1503829
salinity + aou Atlantic (-Inf,26] -0.0452495 -0.3257778 0.3355069
salinity + aou Atlantic (26,26.5] -0.1316899 -0.2309276 0.0334238
salinity + aou Atlantic (26.5,26.75] -0.3436234 -0.5297627 -0.1936560
salinity + aou Atlantic (26.75,27] -0.2274688 -0.2786631 -0.1798969
salinity + aou Atlantic (27,27.25] -0.1722725 -0.3548045 0.0243317
salinity + aou Atlantic (27.25,27.5] -0.1716808 -0.3370859 -0.0600930
salinity + aou Atlantic (27.5,27.75] -0.4656439 -0.4956237 -0.4140142
salinity + aou Atlantic (27.75,27.85] -0.5438494 -0.6028770 -0.4959685
salinity + aou Atlantic (27.85,27.95] -0.3566450 -0.5027073 -0.1656048
salinity + aou Atlantic (27.95,28.05] -0.5444684 -0.7924660 -0.2117975
salinity + aou Atlantic (28.05,28.1] -0.7479505 -0.8681681 -0.6651277
salinity + aou Atlantic (28.1,28.15] -0.8326742 -0.8705770 -0.7857761
salinity + aou Atlantic (28.15,28.2] -0.9536576 -0.9757986 -0.9232777
salinity + aou Atlantic (28.2, Inf] -0.5299343 -0.7118279 -0.4183440
salinity + aou Indo-Pacific (-Inf,26] -0.0976234 -0.1346395 -0.0319685
salinity + aou Indo-Pacific (26,26.5] -0.0501848 -0.2595400 0.1341664
salinity + aou Indo-Pacific (26.5,26.75] -0.0552989 -0.3767854 0.2662912
salinity + aou Indo-Pacific (26.75,27] -0.1605742 -0.3700368 0.0263806
salinity + aou Indo-Pacific (27,27.25] -0.0833167 -0.2071071 0.1440841
salinity + aou Indo-Pacific (27.25,27.5] 0.1152309 0.0311502 0.2680199
salinity + aou Indo-Pacific (27.5,27.75] 0.0468967 -0.0757758 0.2344463
salinity + aou Indo-Pacific (27.75,27.85] -0.1678875 -0.4051461 0.0905928
salinity + aou Indo-Pacific (27.85,27.95] -0.3774176 -0.6902419 -0.1322621
salinity + aou Indo-Pacific (27.95,28.05] -0.3780087 -0.4619637 -0.2601785
salinity + aou Indo-Pacific (28.05,28.1] -0.4597512 -0.5848017 -0.3719058
salinity + aou Indo-Pacific (28.1, Inf] 0.3997470 0.2765693 0.4833991
salinity + oxygen Atlantic (-Inf,26] -0.3109640 -0.5824114 -0.0830958
salinity + oxygen Atlantic (26,26.5] -0.2558098 -0.4586109 -0.0978965
salinity + oxygen Atlantic (26.5,26.75] 0.0954246 -0.0452345 0.3329757
salinity + oxygen Atlantic (26.75,27] 0.0271900 -0.0618028 0.0825327
salinity + oxygen Atlantic (27,27.25] -0.0428928 -0.2848910 0.1542667
salinity + oxygen Atlantic (27.25,27.5] -0.1247762 -0.2755115 0.0699327
salinity + oxygen Atlantic (27.5,27.75] 0.1285747 0.0007210 0.2049111
salinity + oxygen Atlantic (27.75,27.85] 0.3596203 0.2998878 0.4260460
salinity + oxygen Atlantic (27.85,27.95] 0.2285522 0.0268688 0.3965104
salinity + oxygen Atlantic (27.95,28.05] 0.4435389 0.1139659 0.7289259
salinity + oxygen Atlantic (28.05,28.1] 0.6554291 0.5677434 0.8196414
salinity + oxygen Atlantic (28.1,28.15] 0.7693824 0.7201298 0.8169252
salinity + oxygen Atlantic (28.15,28.2] 0.9361833 0.8965298 0.9637406
salinity + oxygen Atlantic (28.2, Inf] 0.3650789 0.2179548 0.5646201
salinity + oxygen Indo-Pacific (-Inf,26] -0.2157463 -0.3359558 -0.1039456
salinity + oxygen Indo-Pacific (26,26.5] -0.1316348 -0.2879960 0.0406246
salinity + oxygen Indo-Pacific (26.5,26.75] -0.1064139 -0.4189153 0.1974485
salinity + oxygen Indo-Pacific (26.75,27] -0.0126002 -0.1962625 0.1972547
salinity + oxygen Indo-Pacific (27,27.25] -0.0535173 -0.3319775 0.0959141
salinity + oxygen Indo-Pacific (27.25,27.5] -0.2236543 -0.4282238 -0.1152695
salinity + oxygen Indo-Pacific (27.5,27.75] -0.1310450 -0.3816878 0.0324730
salinity + oxygen Indo-Pacific (27.75,27.85] 0.0993157 -0.2068707 0.3778925
salinity + oxygen Indo-Pacific (27.85,27.95] 0.3221359 0.0409348 0.6777124
salinity + oxygen Indo-Pacific (27.95,28.05] 0.3031510 0.1635871 0.4038045
salinity + oxygen Indo-Pacific (28.05,28.1] 0.3840285 0.2817047 0.5276693
salinity + oxygen Indo-Pacific (28.1, Inf] -0.4956548 -0.5910869 -0.3703990
salinity + phosphate Atlantic (-Inf,26] -0.5368678 -0.7820996 -0.3151151
salinity + phosphate Atlantic (26,26.5] -0.6861720 -0.7694493 -0.5227085
salinity + phosphate Atlantic (26.5,26.75] -0.7286769 -0.7958907 -0.6260673
salinity + phosphate Atlantic (26.75,27] -0.6705112 -0.7056194 -0.6198328
salinity + phosphate Atlantic (27,27.25] -0.7145275 -0.7748703 -0.6639096
salinity + phosphate Atlantic (27.25,27.5] -0.7876444 -0.8205324 -0.7418126
salinity + phosphate Atlantic (27.5,27.75] -0.8352052 -0.8445523 -0.8291386
salinity + phosphate Atlantic (27.75,27.85] -0.7551779 -0.7831275 -0.7242229
salinity + phosphate Atlantic (27.85,27.95] -0.5751115 -0.6726756 -0.4171452
salinity + phosphate Atlantic (27.95,28.05] -0.6954715 -0.8503110 -0.4308056
salinity + phosphate Atlantic (28.05,28.1] -0.8442799 -0.9056577 -0.7678284
salinity + phosphate Atlantic (28.1,28.15] -0.8938608 -0.9149390 -0.8537034
salinity + phosphate Atlantic (28.15,28.2] -0.9592330 -0.9685939 -0.9542868
salinity + phosphate Atlantic (28.2, Inf] -0.8964793 -0.9415770 -0.8474669
salinity + phosphate Indo-Pacific (-Inf,26] -0.2194966 -0.2517569 -0.2020443
salinity + phosphate Indo-Pacific (26,26.5] -0.2842714 -0.5082835 -0.1021091
salinity + phosphate Indo-Pacific (26.5,26.75] -0.3083614 -0.6118401 -0.0366340
salinity + phosphate Indo-Pacific (26.75,27] -0.4155439 -0.6195949 -0.2396882
salinity + phosphate Indo-Pacific (27,27.25] -0.2652062 -0.3794062 -0.1086066
salinity + phosphate Indo-Pacific (27.25,27.5] 0.0061186 -0.0358510 0.0567469
salinity + phosphate Indo-Pacific (27.5,27.75] -0.0111189 -0.0732762 0.0984362
salinity + phosphate Indo-Pacific (27.75,27.85] -0.1895421 -0.3793168 0.0420360
salinity + phosphate Indo-Pacific (27.85,27.95] -0.4214157 -0.6925250 -0.1799031
salinity + phosphate Indo-Pacific (27.95,28.05] -0.5186201 -0.5966346 -0.4036067
salinity + phosphate Indo-Pacific (28.05,28.1] -0.6204174 -0.7160040 -0.5713107
salinity + phosphate Indo-Pacific (28.1, Inf] -0.1349102 -0.2265805 -0.0763846
salinity + phosphate_star Atlantic (-Inf,26] -0.7974374 -0.9317164 -0.5625034
salinity + phosphate_star Atlantic (26,26.5] -0.9224630 -0.9699638 -0.8348915
salinity + phosphate_star Atlantic (26.5,26.75] -0.9690939 -0.9798972 -0.9501833
salinity + phosphate_star Atlantic (26.75,27] -0.9811322 -0.9867684 -0.9769403
salinity + phosphate_star Atlantic (27,27.25] -0.9837524 -0.9853382 -0.9820819
salinity + phosphate_star Atlantic (27.25,27.5] -0.9808522 -0.9835208 -0.9755483
salinity + phosphate_star Atlantic (27.5,27.75] -0.9529986 -0.9547226 -0.9511752
salinity + phosphate_star Atlantic (27.75,27.85] -0.9150719 -0.9211116 -0.9045425
salinity + phosphate_star Atlantic (27.85,27.95] -0.8473387 -0.8810768 -0.7953825
salinity + phosphate_star Atlantic (27.95,28.05] -0.8504594 -0.9230189 -0.7178387
salinity + phosphate_star Atlantic (28.05,28.1] -0.9138634 -0.9442163 -0.8593220
salinity + phosphate_star Atlantic (28.1,28.15] -0.9379116 -0.9600247 -0.9089368
salinity + phosphate_star Atlantic (28.15,28.2] -0.9621816 -0.9727023 -0.9506763
salinity + phosphate_star Atlantic (28.2, Inf] -0.9717163 -0.9756048 -0.9639516
salinity + phosphate_star Indo-Pacific (-Inf,26] -0.5186648 -0.5420309 -0.4997099
salinity + phosphate_star Indo-Pacific (26,26.5] -0.7288970 -0.8430713 -0.6266783
salinity + phosphate_star Indo-Pacific (26.5,26.75] -0.8431342 -0.9196684 -0.7882671
salinity + phosphate_star Indo-Pacific (26.75,27] -0.8928260 -0.9361704 -0.8471015
salinity + phosphate_star Indo-Pacific (27,27.25] -0.8387976 -0.8582931 -0.8065417
salinity + phosphate_star Indo-Pacific (27.25,27.5] -0.6298080 -0.8494018 -0.4417094
salinity + phosphate_star Indo-Pacific (27.5,27.75] -0.4110256 -0.7556259 -0.0693757
salinity + phosphate_star Indo-Pacific (27.75,27.85] -0.2591739 -0.5854542 0.2022713
salinity + phosphate_star Indo-Pacific (27.85,27.95] -0.3802058 -0.5771706 -0.0749978
salinity + phosphate_star Indo-Pacific (27.95,28.05] -0.7514025 -0.7918821 -0.7053462
salinity + phosphate_star Indo-Pacific (28.05,28.1] -0.8195662 -0.8740056 -0.7483517
salinity + phosphate_star Indo-Pacific (28.1, Inf] -0.8277035 -0.8551669 -0.8111767
salinity + silicate Atlantic (-Inf,26] -0.7139001 -0.7950883 -0.6725144
salinity + silicate Atlantic (26,26.5] -0.6824066 -0.7243435 -0.6125911
salinity + silicate Atlantic (26.5,26.75] -0.6350098 -0.7294011 -0.5055632
salinity + silicate Atlantic (26.75,27] -0.5545102 -0.5946755 -0.5155890
salinity + silicate Atlantic (27,27.25] -0.6607943 -0.7124112 -0.6219032
salinity + silicate Atlantic (27.25,27.5] -0.7972274 -0.8097390 -0.7859144
salinity + silicate Atlantic (27.5,27.75] -0.8197880 -0.8386444 -0.8101704
salinity + silicate Atlantic (27.75,27.85] -0.7884695 -0.8228682 -0.7518060
salinity + silicate Atlantic (27.85,27.95] -0.6617053 -0.7465839 -0.5237283
salinity + silicate Atlantic (27.95,28.05] -0.7307836 -0.8883221 -0.4777178
salinity + silicate Atlantic (28.05,28.1] -0.8591589 -0.9274773 -0.7987466
salinity + silicate Atlantic (28.1,28.15] -0.9053625 -0.9385148 -0.8708267
salinity + silicate Atlantic (28.15,28.2] -0.9565403 -0.9729301 -0.9307135
salinity + silicate Atlantic (28.2, Inf] -0.8546034 -0.9653379 -0.7751529
salinity + silicate Indo-Pacific (-Inf,26] -0.5327640 -0.5805799 -0.4445816
salinity + silicate Indo-Pacific (26,26.5] -0.5678803 -0.6927174 -0.4641915
salinity + silicate Indo-Pacific (26.5,26.75] -0.6741637 -0.8161866 -0.5696984
salinity + silicate Indo-Pacific (26.75,27] -0.6672540 -0.7747210 -0.4979258
salinity + silicate Indo-Pacific (27,27.25] -0.4685733 -0.5470162 -0.3358847
salinity + silicate Indo-Pacific (27.25,27.5] -0.1679460 -0.2354897 -0.0950205
salinity + silicate Indo-Pacific (27.5,27.75] -0.0843286 -0.1062914 -0.0648291
salinity + silicate Indo-Pacific (27.75,27.85] -0.2171798 -0.3571247 -0.0574093
salinity + silicate Indo-Pacific (27.85,27.95] -0.3985178 -0.6239515 -0.2184840
salinity + silicate Indo-Pacific (27.95,28.05] -0.4391131 -0.4910533 -0.3621739
salinity + silicate Indo-Pacific (28.05,28.1] -0.5463477 -0.6170559 -0.4790016
salinity + silicate Indo-Pacific (28.1, Inf] -0.0742257 -0.1716903 0.0723564
salinity + temperature Atlantic (-Inf,26] 0.9207161 0.8381654 0.9786562
salinity + temperature Atlantic (26,26.5] 0.9600524 0.9470189 0.9717127
salinity + temperature Atlantic (26.5,26.75] 0.9866701 0.9811261 0.9902331
salinity + temperature Atlantic (26.75,27] 0.9794774 0.9741859 0.9843463
salinity + temperature Atlantic (27,27.25] 0.9773384 0.9758270 0.9794429
salinity + temperature Atlantic (27.25,27.5] 0.9728298 0.9698213 0.9754742
salinity + temperature Atlantic (27.5,27.75] 0.9596412 0.9556522 0.9622929
salinity + temperature Atlantic (27.75,27.85] 0.9789351 0.9753679 0.9808720
salinity + temperature Atlantic (27.85,27.95] 0.9441199 0.9369742 0.9480091
salinity + temperature Atlantic (27.95,28.05] 0.8823423 0.8069203 0.9317987
salinity + temperature Atlantic (28.05,28.1] 0.9497597 0.9127320 0.9685717
salinity + temperature Atlantic (28.1,28.15] 0.9486238 0.9195421 0.9706795
salinity + temperature Atlantic (28.15,28.2] 0.8825453 0.8477644 0.9035039
salinity + temperature Atlantic (28.2, Inf] 0.4658301 0.3653252 0.6272068
salinity + temperature Indo-Pacific (-Inf,26] 0.7708602 0.7410815 0.8179872
salinity + temperature Indo-Pacific (26,26.5] 0.9289978 0.8853113 0.9536617
salinity + temperature Indo-Pacific (26.5,26.75] 0.9783761 0.9690919 0.9833196
salinity + temperature Indo-Pacific (26.75,27] 0.9769327 0.9720313 0.9799861
salinity + temperature Indo-Pacific (27,27.25] 0.9494681 0.9326539 0.9706486
salinity + temperature Indo-Pacific (27.25,27.5] 0.8759716 0.8219365 0.9581021
salinity + temperature Indo-Pacific (27.5,27.75] 0.7034281 0.5144167 0.9146415
salinity + temperature Indo-Pacific (27.75,27.85] 0.8099353 0.6545628 0.9380027
salinity + temperature Indo-Pacific (27.85,27.95] 0.6993368 0.4548127 0.8692827
salinity + temperature Indo-Pacific (27.95,28.05] 0.7212254 0.6298824 0.8192591
salinity + temperature Indo-Pacific (28.05,28.1] 0.6984918 0.5756878 0.7976297
salinity + temperature Indo-Pacific (28.1, Inf] 0.7137388 0.5996297 0.8277495
silicate + phosphate Atlantic (-Inf,26] 0.6435212 0.5417703 0.7736760
silicate + phosphate Atlantic (26,26.5] 0.9197612 0.9020743 0.9319463
silicate + phosphate Atlantic (26.5,26.75] 0.9667453 0.9625265 0.9712821
silicate + phosphate Atlantic (26.75,27] 0.9516208 0.9345927 0.9610085
silicate + phosphate Atlantic (27,27.25] 0.9447014 0.9296485 0.9556204
silicate + phosphate Atlantic (27.25,27.5] 0.8978592 0.8721677 0.9280920
silicate + phosphate Atlantic (27.5,27.75] 0.8895426 0.8694482 0.9021325
silicate + phosphate Atlantic (27.75,27.85] 0.9520945 0.9423096 0.9653637
silicate + phosphate Atlantic (27.85,27.95] 0.9714709 0.9666891 0.9776300
silicate + phosphate Atlantic (27.95,28.05] 0.9807086 0.9759663 0.9866261
silicate + phosphate Atlantic (28.05,28.1] 0.9890124 0.9850664 0.9911994
silicate + phosphate Atlantic (28.1,28.15] 0.9933245 0.9921857 0.9941494
silicate + phosphate Atlantic (28.15,28.2] 0.9941483 0.9898345 0.9973286
silicate + phosphate Atlantic (28.2, Inf] 0.9695668 0.9599850 0.9887272
silicate + phosphate Indo-Pacific (-Inf,26] 0.7876839 0.7391622 0.8126822
silicate + phosphate Indo-Pacific (26,26.5] 0.7574193 0.6608833 0.8319689
silicate + phosphate Indo-Pacific (26.5,26.75] 0.7499238 0.5908688 0.8379373
silicate + phosphate Indo-Pacific (26.75,27] 0.8528399 0.8041063 0.8787578
silicate + phosphate Indo-Pacific (27,27.25] 0.8991939 0.8740174 0.9339553
silicate + phosphate Indo-Pacific (27.25,27.5] 0.8886196 0.8594089 0.9287864
silicate + phosphate Indo-Pacific (27.5,27.75] 0.8903745 0.8465955 0.9317081
silicate + phosphate Indo-Pacific (27.75,27.85] 0.9511429 0.9310040 0.9641457
silicate + phosphate Indo-Pacific (27.85,27.95] 0.9644519 0.9518321 0.9716657
silicate + phosphate Indo-Pacific (27.95,28.05] 0.9593524 0.9507325 0.9638756
silicate + phosphate Indo-Pacific (28.05,28.1] 0.9558313 0.9482752 0.9622640
silicate + phosphate Indo-Pacific (28.1, Inf] 0.7938885 0.7638105 0.8300839
silicate + phosphate_star Atlantic (-Inf,26] 0.6657357 0.5879842 0.7603159
silicate + phosphate_star Atlantic (26,26.5] 0.8170619 0.7939173 0.8600889
silicate + phosphate_star Atlantic (26.5,26.75] 0.7520637 0.6827585 0.8197783
silicate + phosphate_star Atlantic (26.75,27] 0.6116921 0.5791991 0.6496392
silicate + phosphate_star Atlantic (27,27.25] 0.6681878 0.6433144 0.7005654
silicate + phosphate_star Atlantic (27.25,27.5] 0.8415873 0.8273388 0.8515505
silicate + phosphate_star Atlantic (27.5,27.75] 0.9216818 0.9165649 0.9291800
silicate + phosphate_star Atlantic (27.75,27.85] 0.9440820 0.9353454 0.9528566
silicate + phosphate_star Atlantic (27.85,27.95] 0.9202164 0.8884566 0.9395646
silicate + phosphate_star Atlantic (27.95,28.05] 0.9338785 0.8893533 0.9735236
silicate + phosphate_star Atlantic (28.05,28.1] 0.9553651 0.9419911 0.9811098
silicate + phosphate_star Atlantic (28.1,28.15] 0.9750655 0.9683713 0.9863218
silicate + phosphate_star Atlantic (28.15,28.2] 0.9862398 0.9747826 0.9943196
silicate + phosphate_star Atlantic (28.2, Inf] 0.8433934 0.7614150 0.9449404
silicate + phosphate_star Indo-Pacific (-Inf,26] 0.7846398 0.7499336 0.8320484
silicate + phosphate_star Indo-Pacific (26,26.5] 0.7849543 0.7460552 0.8089737
silicate + phosphate_star Indo-Pacific (26.5,26.75] 0.8025628 0.7203978 0.8551129
silicate + phosphate_star Indo-Pacific (26.75,27] 0.7486277 0.7228274 0.7794527
silicate + phosphate_star Indo-Pacific (27,27.25] 0.4430103 0.4144601 0.4661379
silicate + phosphate_star Indo-Pacific (27.25,27.5] -0.2204614 -0.3420444 -0.0625492
silicate + phosphate_star Indo-Pacific (27.5,27.75] -0.4798617 -0.6607115 -0.2462836
silicate + phosphate_star Indo-Pacific (27.75,27.85] -0.4151131 -0.6129553 -0.2445990
silicate + phosphate_star Indo-Pacific (27.85,27.95] 0.0587229 0.0037064 0.1504415
silicate + phosphate_star Indo-Pacific (27.95,28.05] 0.4020673 0.2858781 0.4954316
silicate + phosphate_star Indo-Pacific (28.05,28.1] 0.5537216 0.5219203 0.6015185
silicate + phosphate_star Indo-Pacific (28.1, Inf] 0.0313625 -0.0797758 0.1882002
temperature + aou Atlantic (-Inf,26] -0.0687693 -0.3518914 0.3120683
temperature + aou Atlantic (26,26.5] -0.2026044 -0.3782715 -0.0257882
temperature + aou Atlantic (26.5,26.75] -0.3626266 -0.5394586 -0.2278605
temperature + aou Atlantic (26.75,27] -0.2258924 -0.2684537 -0.1748759
temperature + aou Atlantic (27,27.25] -0.1116539 -0.2812963 0.0747144
temperature + aou Atlantic (27.25,27.5] -0.1280238 -0.2994314 -0.0069762
temperature + aou Atlantic (27.5,27.75] -0.4163606 -0.4606483 -0.3507414
temperature + aou Atlantic (27.75,27.85] -0.5228423 -0.5682867 -0.4812475
temperature + aou Atlantic (27.85,27.95] -0.3044515 -0.4569619 -0.0804600
temperature + aou Atlantic (27.95,28.05] -0.5202876 -0.7151551 -0.3144163
temperature + aou Atlantic (28.05,28.1] -0.6062227 -0.8064307 -0.4385820
temperature + aou Atlantic (28.1,28.15] -0.6597060 -0.7330619 -0.5223213
temperature + aou Atlantic (28.15,28.2] -0.7563883 -0.8202708 -0.7093370
temperature + aou Atlantic (28.2, Inf] 0.3523127 0.2491837 0.4736749
temperature + aou Indo-Pacific (-Inf,26] -0.2687307 -0.4106364 -0.1750756
temperature + aou Indo-Pacific (26,26.5] -0.1238013 -0.3087069 -0.0170725
temperature + aou Indo-Pacific (26.5,26.75] -0.0458774 -0.3460052 0.2570151
temperature + aou Indo-Pacific (26.75,27] -0.1772755 -0.3633119 -0.0314426
temperature + aou Indo-Pacific (27,27.25] -0.1612950 -0.2850675 0.0541017
temperature + aou Indo-Pacific (27.25,27.5] 0.0851221 -0.0155813 0.2506184
temperature + aou Indo-Pacific (27.5,27.75] 0.1057566 0.0131166 0.2585448
temperature + aou Indo-Pacific (27.75,27.85] -0.0078459 -0.1982387 0.1848164
temperature + aou Indo-Pacific (27.85,27.95] -0.0752691 -0.2789347 0.0530825
temperature + aou Indo-Pacific (27.95,28.05] 0.0868853 0.0687610 0.1173523
temperature + aou Indo-Pacific (28.05,28.1] 0.1568685 0.0330026 0.2601188
temperature + aou Indo-Pacific (28.1, Inf] 0.8409642 0.8007045 0.8667850
temperature + oxygen Atlantic (-Inf,26] -0.3163713 -0.5749811 -0.1206498
temperature + oxygen Atlantic (26,26.5] -0.1968196 -0.4148047 0.0427067
temperature + oxygen Atlantic (26.5,26.75] 0.1118365 -0.0150026 0.3410353
temperature + oxygen Atlantic (26.75,27] 0.0214474 -0.0706434 0.0678025
temperature + oxygen Atlantic (27,27.25] -0.1086535 -0.3379192 0.0727534
temperature + oxygen Atlantic (27.25,27.5] -0.1762577 -0.3351416 0.0234851
temperature + oxygen Atlantic (27.5,27.75] 0.0584126 -0.0852544 0.1518829
temperature + oxygen Atlantic (27.75,27.85] 0.3304151 0.2786541 0.3801715
temperature + oxygen Atlantic (27.85,27.95] 0.1653514 -0.0686148 0.3399528
temperature + oxygen Atlantic (27.95,28.05] 0.3933041 0.1904284 0.6256963
temperature + oxygen Atlantic (28.05,28.1] 0.4917184 0.3267804 0.7418371
temperature + oxygen Atlantic (28.1,28.15] 0.5766872 0.4345949 0.6498435
temperature + oxygen Atlantic (28.15,28.2] 0.7180076 0.6732370 0.7888052
temperature + oxygen Atlantic (28.2, Inf] -0.5293353 -0.6164468 -0.4358133
temperature + oxygen Indo-Pacific (-Inf,26] -0.1162531 -0.2916973 -0.0104878
temperature + oxygen Indo-Pacific (26,26.5] -0.0707788 -0.1580104 0.0803955
temperature + oxygen Indo-Pacific (26.5,26.75] -0.1205630 -0.4160528 0.1616372
temperature + oxygen Indo-Pacific (26.75,27] -0.0005306 -0.1431829 0.1863308
temperature + oxygen Indo-Pacific (27,27.25] 0.0182729 -0.2509850 0.1689748
temperature + oxygen Indo-Pacific (27.25,27.5] -0.2071617 -0.4206513 -0.0793657
temperature + oxygen Indo-Pacific (27.5,27.75] -0.2160274 -0.4195962 -0.0938038
temperature + oxygen Indo-Pacific (27.75,27.85] -0.0722622 -0.3064867 0.1534029
temperature + oxygen Indo-Pacific (27.85,27.95] 0.0003896 -0.1561502 0.2362149
temperature + oxygen Indo-Pacific (27.95,28.05] -0.1821228 -0.1995946 -0.1652786
temperature + oxygen Indo-Pacific (28.05,28.1] -0.2391831 -0.3522109 -0.1209645
temperature + oxygen Indo-Pacific (28.1, Inf] -0.9013842 -0.9172228 -0.8763236
temperature + phosphate Atlantic (-Inf,26] -0.4465037 -0.6217540 -0.2872539
temperature + phosphate Atlantic (26,26.5] -0.7252611 -0.7977219 -0.6318815
temperature + phosphate Atlantic (26.5,26.75] -0.7441481 -0.8013726 -0.6584993
temperature + phosphate Atlantic (26.75,27] -0.6690712 -0.7005508 -0.6280295
temperature + phosphate Atlantic (27,27.25] -0.6703935 -0.7235873 -0.6197743
temperature + phosphate Atlantic (27.25,27.5] -0.7580177 -0.7945460 -0.7146478
temperature + phosphate Atlantic (27.5,27.75] -0.7998618 -0.8089097 -0.7910859
temperature + phosphate Atlantic (27.75,27.85] -0.7425998 -0.7630549 -0.7137399
temperature + phosphate Atlantic (27.85,27.95] -0.5252112 -0.6256550 -0.3343713
temperature + phosphate Atlantic (27.95,28.05] -0.6492760 -0.7702004 -0.4548313
temperature + phosphate Atlantic (28.05,28.1] -0.7213138 -0.8442823 -0.5630099
temperature + phosphate Atlantic (28.1,28.15] -0.7416721 -0.8216944 -0.6194000
temperature + phosphate Atlantic (28.15,28.2] -0.7549808 -0.7961936 -0.6943424
temperature + phosphate Atlantic (28.2, Inf] -0.1112661 -0.1984830 -0.0519485
temperature + phosphate Indo-Pacific (-Inf,26] -0.4319706 -0.5907832 -0.2930051
temperature + phosphate Indo-Pacific (26,26.5] -0.3748471 -0.5663897 -0.2747163
temperature + phosphate Indo-Pacific (26.5,26.75] -0.3119225 -0.5942870 -0.0615034
temperature + phosphate Indo-Pacific (26.75,27] -0.4475683 -0.6253158 -0.3132553
temperature + phosphate Indo-Pacific (27,27.25] -0.3618353 -0.4445069 -0.2190449
temperature + phosphate Indo-Pacific (27.25,27.5] -0.0569980 -0.1307047 0.0170352
temperature + phosphate Indo-Pacific (27.5,27.75] 0.0397540 -0.0165849 0.1160272
temperature + phosphate Indo-Pacific (27.75,27.85] -0.0313387 -0.1669361 0.1257444
temperature + phosphate Indo-Pacific (27.85,27.95] -0.1248251 -0.2780650 -0.0132564
temperature + phosphate Indo-Pacific (27.95,28.05] -0.0750418 -0.1054087 -0.0398646
temperature + phosphate Indo-Pacific (28.05,28.1] -0.0300473 -0.1526343 0.0485644
temperature + phosphate Indo-Pacific (28.1, Inf] 0.3939452 0.2669475 0.4779643
temperature + phosphate_star Atlantic (-Inf,26] -0.7061483 -0.8582740 -0.5189364
temperature + phosphate_star Atlantic (26,26.5] -0.9343385 -0.9733157 -0.8856727
temperature + phosphate_star Atlantic (26.5,26.75] -0.9771888 -0.9831216 -0.9694274
temperature + phosphate_star Atlantic (26.75,27] -0.9848572 -0.9878559 -0.9828411
temperature + phosphate_star Atlantic (27,27.25] -0.9872929 -0.9897957 -0.9859356
temperature + phosphate_star Atlantic (27.25,27.5] -0.9827437 -0.9848519 -0.9792676
temperature + phosphate_star Atlantic (27.5,27.75] -0.9457047 -0.9496670 -0.9430617
temperature + phosphate_star Atlantic (27.75,27.85] -0.9165933 -0.9234699 -0.9037825
temperature + phosphate_star Atlantic (27.85,27.95] -0.8235049 -0.8668068 -0.7510793
temperature + phosphate_star Atlantic (27.95,28.05] -0.8044664 -0.8822707 -0.6772425
temperature + phosphate_star Atlantic (28.05,28.1] -0.8295893 -0.8899325 -0.7112782
temperature + phosphate_star Atlantic (28.1,28.15] -0.8215634 -0.8914645 -0.7272136
temperature + phosphate_star Atlantic (28.15,28.2] -0.7699644 -0.8118849 -0.7039532
temperature + phosphate_star Atlantic (28.2, Inf] -0.4817703 -0.6144520 -0.3740281
temperature + phosphate_star Indo-Pacific (-Inf,26] -0.7517559 -0.8459188 -0.6176220
temperature + phosphate_star Indo-Pacific (26,26.5] -0.8257311 -0.9021705 -0.7660248
temperature + phosphate_star Indo-Pacific (26.5,26.75] -0.8700434 -0.9311307 -0.8117115
temperature + phosphate_star Indo-Pacific (26.75,27] -0.9386195 -0.9624515 -0.9120804
temperature + phosphate_star Indo-Pacific (27,27.25] -0.9218151 -0.9321647 -0.9027204
temperature + phosphate_star Indo-Pacific (27.25,27.5] -0.7653579 -0.9093303 -0.6472260
temperature + phosphate_star Indo-Pacific (27.5,27.75] -0.5678149 -0.8145377 -0.3176058
temperature + phosphate_star Indo-Pacific (27.75,27.85] -0.3921300 -0.6657844 0.0137202
temperature + phosphate_star Indo-Pacific (27.85,27.95] -0.5021655 -0.6685866 -0.2610595
temperature + phosphate_star Indo-Pacific (27.95,28.05] -0.7356150 -0.8076554 -0.6815412
temperature + phosphate_star Indo-Pacific (28.05,28.1] -0.5963326 -0.6150003 -0.5756832
temperature + phosphate_star Indo-Pacific (28.1, Inf] -0.8757538 -0.8944860 -0.8648381
temperature + silicate Atlantic (-Inf,26] -0.6058851 -0.7356100 -0.5118555
temperature + silicate Atlantic (26,26.5] -0.6940228 -0.7324635 -0.6713966
temperature + silicate Atlantic (26.5,26.75] -0.6575854 -0.7401620 -0.5514632
temperature + silicate Atlantic (26.75,27] -0.5731056 -0.6058513 -0.5474068
temperature + silicate Atlantic (27,27.25] -0.6439136 -0.6895759 -0.6139537
temperature + silicate Atlantic (27.25,27.5] -0.8337342 -0.8392335 -0.8288195
temperature + silicate Atlantic (27.5,27.75] -0.8573527 -0.8796812 -0.8389417
temperature + silicate Atlantic (27.75,27.85] -0.8042016 -0.8434315 -0.7626576
temperature + silicate Atlantic (27.85,27.95] -0.6354677 -0.7301266 -0.4645337
temperature + silicate Atlantic (27.95,28.05] -0.7256101 -0.8518541 -0.5596467
temperature + silicate Atlantic (28.05,28.1] -0.7473424 -0.8802581 -0.6125043
temperature + silicate Atlantic (28.1,28.15] -0.7610483 -0.8231982 -0.6456801
temperature + silicate Atlantic (28.15,28.2] -0.7570242 -0.8073258 -0.7273218
temperature + silicate Atlantic (28.2, Inf] -0.0842811 -0.1558594 0.0039567
temperature + silicate Indo-Pacific (-Inf,26] -0.5999219 -0.7261407 -0.4490039
temperature + silicate Indo-Pacific (26,26.5] -0.6176997 -0.7251983 -0.4810773
temperature + silicate Indo-Pacific (26.5,26.75] -0.6733967 -0.8085773 -0.5740942
temperature + silicate Indo-Pacific (26.75,27] -0.6780530 -0.7655022 -0.5519163
temperature + silicate Indo-Pacific (27,27.25] -0.5369362 -0.6256717 -0.4284266
temperature + silicate Indo-Pacific (27.25,27.5] -0.2491110 -0.3118250 -0.1549767
temperature + silicate Indo-Pacific (27.5,27.75] -0.1764726 -0.2391804 -0.1254418
temperature + silicate Indo-Pacific (27.75,27.85] -0.1261121 -0.2532228 0.0014025
temperature + silicate Indo-Pacific (27.85,27.95] -0.1986039 -0.3604705 -0.1009276
temperature + silicate Indo-Pacific (27.95,28.05] -0.1028996 -0.1330721 -0.0704056
temperature + silicate Indo-Pacific (28.05,28.1] 0.0329346 -0.1020876 0.1151647
temperature + silicate Indo-Pacific (28.1, Inf] 0.2405551 0.0668675 0.3358980
rm(cor_predictors, cor_predictors_stats)

6.2.2.3 C* vs individual predictors

cor_Cstar_predictor <-
  read_csv(here::here("data/eMLR",
                       "cor_Cstar_predictor.csv")) %>% 
  rename(predictor = rowname)

cor_Cstar_predictor_stats <- cor_Cstar_predictor %>% 
  group_by(predictor, basin, gamma_slab) %>% 
  summarise(mean_r = mean(Cstar),
            min_r = min(Cstar),
            max_r = max(Cstar)) %>% 
  ungroup()

cor_Cstar_predictor_stats %>% 
  mutate(predictor = reorder(predictor, mean_r)) %>%
  ggplot() +
  geom_vline(xintercept = c(-0.9, 0.9), col = "red") +
  geom_vline(xintercept = 0) +
  geom_linerange(
    aes(y = predictor, xmin = min_r, xmax = max_r, col = gamma_slab),
    position = position_dodge(width = 0.6)) +
  facet_wrap(~basin) +
  scale_color_viridis_d(direction = -1) +
  labs(x = "correlation coefficient", y = "C* correlation with...") +
  theme(legend.position = "top")

kable(cor_Cstar_predictor_stats) %>%
  add_header_above() %>%
  kable_styling() %>%
  scroll_box(width = "100%", height = "400px")
predictor basin gamma_slab mean_r min_r max_r
aou Atlantic (-Inf,26] 0.0948744 -0.3711871 0.5332243
aou Atlantic (26,26.5] -0.3140197 -0.6933099 0.0545390
aou Atlantic (26.5,26.75] -0.5996279 -0.6700148 -0.5064340
aou Atlantic (26.75,27] -0.5053251 -0.5703139 -0.4583983
aou Atlantic (27,27.25] -0.4571842 -0.5506422 -0.2911704
aou Atlantic (27.25,27.5] -0.4924236 -0.5716618 -0.4010756
aou Atlantic (27.5,27.75] -0.7856120 -0.8211551 -0.7382048
aou Atlantic (27.75,27.85] -0.9354504 -0.9470128 -0.9249823
aou Atlantic (27.85,27.95] -0.9469077 -0.9628294 -0.9359087
aou Atlantic (27.95,28.05] -0.9189538 -0.9271593 -0.9128789
aou Atlantic (28.05,28.1] -0.9002490 -0.9131254 -0.8806348
aou Atlantic (28.1,28.15] -0.9281787 -0.9396740 -0.9162489
aou Atlantic (28.15,28.2] -0.9620568 -0.9692194 -0.9510549
aou Atlantic (28.2, Inf] -0.6922519 -0.8195458 -0.6205950
aou Indo-Pacific (-Inf,26] -0.4996104 -0.6193266 -0.4220052
aou Indo-Pacific (26,26.5] -0.8377855 -0.8483028 -0.8184451
aou Indo-Pacific (26.5,26.75] -0.8398693 -0.8584880 -0.8156240
aou Indo-Pacific (26.75,27] -0.8457455 -0.8923007 -0.8147475
aou Indo-Pacific (27,27.25] -0.6293704 -0.6922140 -0.5706964
aou Indo-Pacific (27.25,27.5] 0.0762664 0.0183026 0.1150447
aou Indo-Pacific (27.5,27.75] 0.4224227 0.2950276 0.5018787
aou Indo-Pacific (27.75,27.85] 0.4569819 0.2840598 0.5841937
aou Indo-Pacific (27.85,27.95] 0.2879750 0.1623772 0.4147307
aou Indo-Pacific (27.95,28.05] -0.1200218 -0.2021546 0.0217023
aou Indo-Pacific (28.05,28.1] -0.2536276 -0.3866125 -0.1783939
aou Indo-Pacific (28.1, Inf] 0.1307578 -0.0382601 0.3660777
oxygen Atlantic (-Inf,26] -0.1061722 -0.5051495 0.2983873
oxygen Atlantic (26,26.5] 0.0339248 -0.3966024 0.5419770
oxygen Atlantic (26.5,26.75] 0.4001245 0.2477960 0.5192255
oxygen Atlantic (26.75,27] 0.3308273 0.2401203 0.4345322
oxygen Atlantic (27,27.25] 0.2586414 0.0372186 0.3720205
oxygen Atlantic (27.25,27.5] 0.2170106 0.0774325 0.3328796
oxygen Atlantic (27.5,27.75] 0.5333498 0.4050772 0.6073790
oxygen Atlantic (27.75,27.85] 0.8590177 0.8398607 0.8807056
oxygen Atlantic (27.85,27.95] 0.9150818 0.8995165 0.9460879
oxygen Atlantic (27.95,28.05] 0.8963245 0.8577963 0.9269719
oxygen Atlantic (28.05,28.1] 0.8777149 0.8516523 0.9197717
oxygen Atlantic (28.1,28.15] 0.9181816 0.9012301 0.9322195
oxygen Atlantic (28.15,28.2] 0.9637201 0.9592676 0.9686129
oxygen Atlantic (28.2, Inf] 0.5704957 0.4729743 0.7272496
oxygen Indo-Pacific (-Inf,26] 0.5040644 0.4248754 0.6262807
oxygen Indo-Pacific (26,26.5] 0.7496681 0.6998708 0.7792208
oxygen Indo-Pacific (26.5,26.75] 0.7564835 0.7280525 0.7937860
oxygen Indo-Pacific (26.75,27] 0.7673178 0.7374483 0.8254535
oxygen Indo-Pacific (27,27.25] 0.6155390 0.5409389 0.7060918
oxygen Indo-Pacific (27.25,27.5] -0.0352779 -0.0838439 0.0205076
oxygen Indo-Pacific (27.5,27.75] -0.3653738 -0.4647683 -0.2077907
oxygen Indo-Pacific (27.75,27.85] -0.4188507 -0.5629082 -0.2167310
oxygen Indo-Pacific (27.85,27.95] -0.2653503 -0.4000667 -0.1233800
oxygen Indo-Pacific (27.95,28.05] 0.1139176 -0.0268951 0.1906271
oxygen Indo-Pacific (28.05,28.1] 0.2336410 0.1646883 0.3569015
oxygen Indo-Pacific (28.1, Inf] -0.1811320 -0.4177864 -0.0123509
phosphate Atlantic (-Inf,26] -0.4126614 -0.8052489 -0.0480374
phosphate Atlantic (26,26.5] -0.7844496 -0.8659538 -0.6799348
phosphate Atlantic (26.5,26.75] -0.8776544 -0.9092614 -0.8542561
phosphate Atlantic (26.75,27] -0.8525408 -0.8702323 -0.8225758
phosphate Atlantic (27,27.25] -0.8889143 -0.8895507 -0.8881820
phosphate Atlantic (27.25,27.5] -0.9505560 -0.9579696 -0.9420302
phosphate Atlantic (27.5,27.75] -0.9884561 -0.9907126 -0.9853712
phosphate Atlantic (27.75,27.85] -0.9827512 -0.9876438 -0.9756229
phosphate Atlantic (27.85,27.95] -0.9667140 -0.9716584 -0.9627816
phosphate Atlantic (27.95,28.05] -0.9502178 -0.9649152 -0.9339718
phosphate Atlantic (28.05,28.1] -0.9425539 -0.9587959 -0.9251717
phosphate Atlantic (28.1,28.15] -0.9583747 -0.9684832 -0.9464709
phosphate Atlantic (28.15,28.2] -0.9810583 -0.9883310 -0.9724947
phosphate Atlantic (28.2, Inf] -0.9620339 -0.9790526 -0.9387764
phosphate Indo-Pacific (-Inf,26] -0.5638239 -0.6878116 -0.4972373
phosphate Indo-Pacific (26,26.5] -0.9321381 -0.9444061 -0.9206850
phosphate Indo-Pacific (26.5,26.75] -0.9479832 -0.9544130 -0.9445690
phosphate Indo-Pacific (26.75,27] -0.9431337 -0.9637762 -0.9182553
phosphate Indo-Pacific (27,27.25] -0.7095520 -0.7337122 -0.6694928
phosphate Indo-Pacific (27.25,27.5] -0.0313802 -0.1047596 0.0186200
phosphate Indo-Pacific (27.5,27.75] 0.3083326 0.1797954 0.3997344
phosphate Indo-Pacific (27.75,27.85] 0.3466687 0.1603515 0.4817711
phosphate Indo-Pacific (27.85,27.95] 0.1586467 0.0061840 0.3154189
phosphate Indo-Pacific (27.95,28.05] -0.2708156 -0.3647272 -0.0880230
phosphate Indo-Pacific (28.05,28.1] -0.4197660 -0.5487571 -0.3012822
phosphate Indo-Pacific (28.1, Inf] -0.2895288 -0.4373891 -0.0213370
phosphate_star Atlantic (-Inf,26] -0.5935735 -0.8157792 -0.4771581
phosphate_star Atlantic (26,26.5] -0.8718047 -0.9201545 -0.8427446
phosphate_star Atlantic (26.5,26.75] -0.9255284 -0.9349912 -0.9207291
phosphate_star Atlantic (26.75,27] -0.9328314 -0.9400878 -0.9199980
phosphate_star Atlantic (27,27.25] -0.9262818 -0.9387045 -0.9125823
phosphate_star Atlantic (27.25,27.5] -0.9298303 -0.9479061 -0.9206732
phosphate_star Atlantic (27.5,27.75] -0.9304176 -0.9426621 -0.9161227
phosphate_star Atlantic (27.75,27.85] -0.9060442 -0.9148401 -0.8969919
phosphate_star Atlantic (27.85,27.95] -0.8181430 -0.8415868 -0.7867834
phosphate_star Atlantic (27.95,28.05] -0.8787212 -0.9070702 -0.8355508
phosphate_star Atlantic (28.05,28.1] -0.9181583 -0.9313194 -0.9010139
phosphate_star Atlantic (28.1,28.15] -0.9415685 -0.9519313 -0.9220626
phosphate_star Atlantic (28.15,28.2] -0.9802308 -0.9841552 -0.9727547
phosphate_star Atlantic (28.2, Inf] -0.9281786 -0.9386588 -0.9144437
phosphate_star Indo-Pacific (-Inf,26] -0.4450676 -0.5969589 -0.3356988
phosphate_star Indo-Pacific (26,26.5] -0.8343674 -0.8809910 -0.8073142
phosphate_star Indo-Pacific (26.5,26.75] -0.7774699 -0.8827000 -0.6367511
phosphate_star Indo-Pacific (26.75,27] -0.7172191 -0.8260731 -0.6434565
phosphate_star Indo-Pacific (27,27.25] -0.3806223 -0.5134801 -0.2858245
phosphate_star Indo-Pacific (27.25,27.5] -0.1979648 -0.2506467 -0.1569013
phosphate_star Indo-Pacific (27.5,27.75] -0.3915037 -0.5454948 -0.1507756
phosphate_star Indo-Pacific (27.75,27.85] -0.5061099 -0.7408345 -0.2439190
phosphate_star Indo-Pacific (27.85,27.95] -0.4836665 -0.5537441 -0.3976820
phosphate_star Indo-Pacific (27.95,28.05] -0.5243472 -0.6153159 -0.4006077
phosphate_star Indo-Pacific (28.05,28.1] -0.5991372 -0.6751435 -0.4640165
phosphate_star Indo-Pacific (28.1, Inf] -0.5474076 -0.6637739 -0.4380748
salinity Atlantic (-Inf,26] 0.2893199 0.2228703 0.3269860
salinity Atlantic (26,26.5] 0.7307163 0.5226450 0.8666493
salinity Atlantic (26.5,26.75] 0.8567660 0.8063865 0.8880440
salinity Atlantic (26.75,27] 0.8973845 0.8699793 0.9146719
salinity Atlantic (27,27.25] 0.9172249 0.8999376 0.9429090
salinity Atlantic (27.25,27.5] 0.9109993 0.8814810 0.9378890
salinity Atlantic (27.5,27.75] 0.8557359 0.8418518 0.8667822
salinity Atlantic (27.75,27.85] 0.7298170 0.7081495 0.7436290
salinity Atlantic (27.85,27.95] 0.4577464 0.3090975 0.5387157
salinity Atlantic (27.95,28.05] 0.5549736 0.2690369 0.7159448
salinity Atlantic (28.05,28.1] 0.7234078 0.6613456 0.7730548
salinity Atlantic (28.1,28.15] 0.7974262 0.7724322 0.8443428
salinity Atlantic (28.15,28.2] 0.9099105 0.8925141 0.9326793
salinity Atlantic (28.2, Inf] 0.9028001 0.8621840 0.9295343
salinity Indo-Pacific (-Inf,26] 0.1424162 0.1302355 0.1490515
salinity Indo-Pacific (26,26.5] 0.4116612 0.2672732 0.6357848
salinity Indo-Pacific (26.5,26.75] 0.4397660 0.2122471 0.7191236
salinity Indo-Pacific (26.75,27] 0.4597281 0.3190997 0.6789589
salinity Indo-Pacific (27,27.25] 0.0123945 -0.1171006 0.2012728
salinity Indo-Pacific (27.25,27.5] -0.4118120 -0.6169920 -0.2106017
salinity Indo-Pacific (27.5,27.75] -0.3507712 -0.4420790 -0.2781870
salinity Indo-Pacific (27.75,27.85] -0.4422701 -0.5218193 -0.3402807
salinity Indo-Pacific (27.85,27.95] -0.2650744 -0.3579383 -0.1096441
salinity Indo-Pacific (27.95,28.05] 0.1894492 0.0558813 0.3305911
salinity Indo-Pacific (28.05,28.1] 0.2948295 0.2278978 0.4117443
salinity Indo-Pacific (28.1, Inf] 0.3146967 0.2545246 0.4136392
silicate Atlantic (-Inf,26] -0.3229475 -0.5522968 -0.0825164
silicate Atlantic (26,26.5] -0.7356319 -0.8267582 -0.6270016
silicate Atlantic (26.5,26.75] -0.8212687 -0.8391818 -0.7891525
silicate Atlantic (26.75,27] -0.7667031 -0.7871720 -0.7496485
silicate Atlantic (27,27.25] -0.8433176 -0.8716919 -0.8191915
silicate Atlantic (27.25,27.5] -0.8992211 -0.9059750 -0.8945185
silicate Atlantic (27.5,27.75] -0.8829288 -0.9051178 -0.8630863
silicate Atlantic (27.75,27.85] -0.9073224 -0.9314085 -0.8764643
silicate Atlantic (27.85,27.95] -0.9030935 -0.9219478 -0.8890345
silicate Atlantic (27.95,28.05] -0.9003694 -0.9327048 -0.8740608
silicate Atlantic (28.05,28.1] -0.9082445 -0.9356242 -0.8911054
silicate Atlantic (28.1,28.15] -0.9385935 -0.9562571 -0.9230594
silicate Atlantic (28.15,28.2] -0.9704431 -0.9773359 -0.9651271
silicate Atlantic (28.2, Inf] -0.9111351 -0.9642570 -0.8445701
silicate Indo-Pacific (-Inf,26] -0.5042313 -0.6084832 -0.4353253
silicate Indo-Pacific (26,26.5] -0.7720302 -0.8099400 -0.7136697
silicate Indo-Pacific (26.5,26.75] -0.7649857 -0.8394297 -0.6332848
silicate Indo-Pacific (26.75,27] -0.7688679 -0.7989565 -0.7199367
silicate Indo-Pacific (27,27.25] -0.4288905 -0.5067920 -0.3808500
silicate Indo-Pacific (27.25,27.5] 0.3487353 0.2863804 0.4238548
silicate Indo-Pacific (27.5,27.75] 0.6207373 0.5432704 0.6742328
silicate Indo-Pacific (27.75,27.85] 0.5180889 0.3788004 0.6335329
silicate Indo-Pacific (27.85,27.95] 0.2837091 0.1630961 0.4182219
silicate Indo-Pacific (27.95,28.05] -0.1466626 -0.2390264 0.0164143
silicate Indo-Pacific (28.05,28.1] -0.3088625 -0.4332697 -0.2382106
silicate Indo-Pacific (28.1, Inf] -0.2082541 -0.3356880 -0.0587563
temperature Atlantic (-Inf,26] 0.0655155 -0.0827931 0.1465154
temperature Atlantic (26,26.5] 0.7223412 0.5595250 0.8169447
temperature Atlantic (26.5,26.75] 0.8562581 0.8275488 0.8735358
temperature Atlantic (26.75,27] 0.8850341 0.8656686 0.9019147
temperature Atlantic (27,27.25] 0.8879506 0.8729674 0.9066721
temperature Atlantic (27.25,27.5] 0.8839156 0.8608731 0.9128891
temperature Atlantic (27.5,27.75] 0.8129182 0.7950602 0.8219969
temperature Atlantic (27.75,27.85] 0.7102829 0.6959796 0.7246136
temperature Atlantic (27.85,27.95] 0.4251724 0.2476208 0.5283781
temperature Atlantic (27.95,28.05] 0.5337535 0.3266584 0.6577087
temperature Atlantic (28.05,28.1] 0.6005779 0.4727863 0.6745071
temperature Atlantic (28.1,28.15] 0.6225691 0.5370767 0.7289768
temperature Atlantic (28.15,28.2] 0.6648944 0.6118608 0.7276289
temperature Atlantic (28.2, Inf] 0.1867555 0.0586055 0.3122400
temperature Indo-Pacific (-Inf,26] -0.0095803 -0.0853838 0.0630388
temperature Indo-Pacific (26,26.5] 0.4530371 0.3284862 0.6438857
temperature Indo-Pacific (26.5,26.75] 0.4357882 0.2238553 0.6994812
temperature Indo-Pacific (26.75,27] 0.5017951 0.3992145 0.6959193
temperature Indo-Pacific (27,27.25] 0.1560749 0.0539126 0.3437092
temperature Indo-Pacific (27.25,27.5] -0.3384487 -0.5112289 -0.1887612
temperature Indo-Pacific (27.5,27.75] -0.4346242 -0.5502807 -0.3667787
temperature Indo-Pacific (27.75,27.85] -0.4515418 -0.5549833 -0.3402104
temperature Indo-Pacific (27.85,27.95] -0.3311004 -0.4395518 -0.1852648
temperature Indo-Pacific (27.95,28.05] 0.0334726 -0.0145886 0.0670336
temperature Indo-Pacific (28.05,28.1] 0.1142159 0.1022677 0.1252990
temperature Indo-Pacific (28.1, Inf] 0.2929595 0.1220996 0.5486616
rm(cor_Cstar_predictor, cor_Cstar_predictor_stats)

6.3 Model fitting

GLODAP %>% write_csv(here::here("data/GLODAPv2_2020/_summarized_data_files",
                                "GLODAP_MLR_fitting_ready.csv"))

6.3.1 Predictor selection

# gamma_slab_max <- GLODAP %>%
#   filter(basin == "Atlantic", era == "new_era") %>% 
#   group_by(gamma_slab) %>% 
#   count() %>% 
#   ungroup() %>% 
#   filter(n == max(n)) %>% 
#   pull(1)


for (i_basin in unique(GLODAP$basin)) {
  for (i_era in unique(GLODAP$era)) {
    
    # i_basin <- unique(GLODAP$basin)[1]
    # i_era   <- unique(GLODAP$era)[1]
    
    print(i_basin) 
    print(i_era  )
    
    GLODAP_basin_era <- GLODAP %>%
      filter(basin == i_basin, era == i_era)

    for (i_gamma_slab in unique(GLODAP_basin_era$gamma_slab)) {

      # i_gamma_slab <- unique(GLODAP_basin_era$gamma_slab)[1]
      print(i_gamma_slab)
      
      GLODAP_basin_era_slab <- GLODAP_basin_era %>% 
        filter(gamma_slab == i_gamma_slab)
      
      lm_full <- lm(Cstar ~ 
                salinity  + 
                temperature  + 
                aou  + 
                oxygen  + 
                silicate  + 
                phosphate  + 
                phosphate_star, 
              data = GLODAP_basin_era_slab)
      
      lm_all <- ols_step_all_possible(lm_full)
      
      temp <- as_tibble(lm_all$result)
      
      temp <- temp %>% 
        mutate(basin = i_basin,
               era = i_era,
               gamma_slab = i_gamma_slab)
      
      if (exists("all_lm_stats")) {
        all_lm_stats <- bind_rows(all_lm_stats, temp)
      }
      
      if (!exists("all_lm_stats")) {
        all_lm_stats <- temp
      }
      
      rm(lm_full, lm_all, temp)
      
    }
    
  }
  
}

all_lm_stats %>%
  write_csv(here::here("data/eMLR",
                       "all_lm_stats.csv"))
all_lm_stats <- read_csv(here::here("data/eMLR",
                                    "all_lm_stats.csv"))


# all_lm_stats <- all_lm_stats %>% 
#   rename(sigma = rmse)

all_lm_stats %>% 
  ggplot(aes(n, rmse, col = basin)) +
  geom_hline(yintercept = 10) + 
  geom_point(shape = 21) +
  facet_grid(gamma_slab~era) +
  scale_color_brewer(palette = "Set1")

all_lm_stats %>% 
  ggplot(aes(n, adjr, col = basin)) +
  geom_point(shape = 21) +
  facet_grid(gamma_slab~era) +
  scale_color_brewer(palette = "Set1")

all_lm_stats %>% 
  ggplot(aes(n, aic, col = basin)) +
  geom_point(shape = 21) +
  facet_grid(gamma_slab~era) +
  scale_color_brewer(palette = "Set1")

# all_lm_stats %>% 
#   ggplot(aes(rmse, predictors, col = gamma_slab)) +
#   geom_point(shape = 21) +
#   facet_grid(.~basin)
n_predictors_max <- 5
n_predictors_min <- 2

all_lm_stats <- all_lm_stats %>% 
  filter(n >= n_predictors_min,
         n <= n_predictors_max) %>% 
  select(basin, era, gamma_slab, predictors, rmse)

all_lm_stats_wide <- all_lm_stats %>% 
  pivot_wider(names_from = era, values_from = rmse, names_prefix = "rmse_")

all_lm_stats_wide <- all_lm_stats_wide %>% 
  mutate(rmse_sum = rmse_JGOFS_WOCE + rmse_GO_SHIP + rmse_new_era)

lm_best <- all_lm_stats_wide %>% 
  group_by(basin, gamma_slab) %>% 
  slice_min(rmse_sum, n = 10) %>% 
  ungroup()

kable(lm_best) %>%
  add_header_above() %>%
  kable_styling() %>%
  scroll_box(width = "100%", height = "400px")
basin gamma_slab predictors rmse_JGOFS_WOCE rmse_GO_SHIP rmse_new_era rmse_sum
Atlantic (-Inf,26] salinity temperature aou oxygen phosphate 7.233104 6.424028 2.765130 16.422262
Atlantic (-Inf,26] temperature aou oxygen phosphate phosphate_star 7.238731 6.515207 2.671672 16.425610
Atlantic (-Inf,26] temperature oxygen silicate phosphate phosphate_star 7.342865 6.367196 2.734672 16.444733
Atlantic (-Inf,26] salinity aou oxygen silicate phosphate 7.363174 6.256378 2.875347 16.494899
Atlantic (-Inf,26] salinity temperature oxygen silicate phosphate 7.246124 6.404483 2.852778 16.503385
Atlantic (-Inf,26] salinity temperature aou silicate phosphate 7.276259 6.370141 2.857798 16.504198
Atlantic (-Inf,26] temperature aou silicate phosphate phosphate_star 7.399728 6.385907 2.744721 16.530356
Atlantic (-Inf,26] temperature aou oxygen silicate phosphate 7.055656 6.789733 2.766765 16.612154
Atlantic (-Inf,26] salinity temperature oxygen phosphate phosphate_star 7.594469 6.323889 2.711688 16.630046
Atlantic (-Inf,26] salinity temperature aou phosphate phosphate_star 7.637863 6.281897 2.717708 16.637469
Atlantic (26,26.5] temperature aou oxygen silicate phosphate 5.363576 6.786906 3.120245 15.270727
Atlantic (26,26.5] temperature aou oxygen phosphate phosphate_star 5.437464 6.819617 3.180828 15.437908
Atlantic (26,26.5] salinity temperature aou oxygen phosphate 5.453636 6.837398 3.164633 15.455668
Atlantic (26,26.5] aou oxygen silicate phosphate phosphate_star 5.394684 6.892097 3.178032 15.464813
Atlantic (26,26.5] temperature aou oxygen phosphate 5.456491 6.837548 3.181060 15.475099
Atlantic (26,26.5] temperature aou silicate phosphate phosphate_star 5.430921 6.955271 3.193715 15.579907
Atlantic (26,26.5] salinity aou oxygen phosphate phosphate_star 5.443918 6.941283 3.196238 15.581438
Atlantic (26,26.5] salinity aou oxygen silicate phosphate 5.432267 6.973621 3.182424 15.588312
Atlantic (26,26.5] aou oxygen phosphate phosphate_star 5.467333 6.943299 3.206234 15.616865
Atlantic (26,26.5] aou oxygen silicate phosphate 5.439014 7.001567 3.184956 15.625537
Atlantic (26.5,26.75] temperature aou oxygen silicate phosphate 5.219837 5.589322 3.704869 14.514028
Atlantic (26.5,26.75] salinity temperature aou silicate phosphate 5.156094 5.583682 3.805535 14.545311
Atlantic (26.5,26.75] salinity temperature oxygen silicate phosphate 5.145692 5.566412 3.838208 14.550311
Atlantic (26.5,26.75] temperature oxygen silicate phosphate phosphate_star 5.211439 5.585131 3.758446 14.555017
Atlantic (26.5,26.75] temperature aou silicate phosphate phosphate_star 5.228077 5.603867 3.730283 14.562227
Atlantic (26.5,26.75] aou oxygen silicate phosphate phosphate_star 5.263529 5.643834 3.699733 14.607095
Atlantic (26.5,26.75] salinity aou oxygen silicate phosphate 5.201822 5.640533 3.769774 14.612130
Atlantic (26.5,26.75] salinity temperature aou oxygen phosphate 5.359083 5.561143 3.703778 14.624004
Atlantic (26.5,26.75] temperature aou oxygen phosphate phosphate_star 5.397508 5.580509 3.646853 14.624871
Atlantic (26.5,26.75] salinity temperature oxygen phosphate phosphate_star 5.369848 5.574805 3.734403 14.679057
Atlantic (26.75,27] salinity temperature oxygen silicate phosphate 4.683879 5.085526 3.618918 13.388323
Atlantic (26.75,27] salinity temperature aou silicate phosphate 4.703334 5.094493 3.629813 13.427639
Atlantic (26.75,27] salinity temperature oxygen phosphate phosphate_star 4.729705 5.146821 3.618566 13.495093
Atlantic (26.75,27] temperature oxygen silicate phosphate phosphate_star 4.734490 5.134443 3.633381 13.502314
Atlantic (26.75,27] salinity temperature aou phosphate phosphate_star 4.749608 5.152628 3.629477 13.531713
Atlantic (26.75,27] salinity temperature aou oxygen phosphate 4.742004 5.170997 3.622653 13.535654
Atlantic (26.75,27] salinity temperature oxygen phosphate 4.742309 5.171062 3.623176 13.536547
Atlantic (26.75,27] temperature aou silicate phosphate phosphate_star 4.761655 5.140782 3.647651 13.550089
Atlantic (26.75,27] temperature aou oxygen phosphate phosphate_star 4.757625 5.161932 3.641829 13.561385
Atlantic (26.75,27] salinity temperature aou phosphate 4.758055 5.173299 3.634027 13.565381
Atlantic (27,27.25] temperature oxygen silicate phosphate phosphate_star 5.150199 4.920376 4.425074 14.495649
Atlantic (27,27.25] temperature aou oxygen phosphate phosphate_star 5.155952 4.955575 4.485850 14.597377
Atlantic (27,27.25] temperature aou silicate phosphate phosphate_star 5.201088 4.956303 4.448113 14.605505
Atlantic (27,27.25] salinity temperature oxygen phosphate phosphate_star 5.205096 4.944247 4.501528 14.650871
Atlantic (27,27.25] temperature oxygen phosphate phosphate_star 5.243274 4.975377 4.507371 14.726023
Atlantic (27,27.25] salinity temperature oxygen silicate phosphate 5.025839 5.042443 4.665827 14.734108
Atlantic (27,27.25] salinity temperature aou phosphate phosphate_star 5.259815 4.977166 4.519119 14.756100
Atlantic (27,27.25] salinity temperature aou silicate phosphate 5.086705 5.064103 4.676695 14.827503
Atlantic (27,27.25] temperature aou phosphate phosphate_star 5.294046 5.010556 4.526341 14.830943
Atlantic (27,27.25] aou oxygen silicate phosphate phosphate_star 5.340125 5.046883 4.477069 14.864077
Atlantic (27.25,27.5] salinity temperature oxygen phosphate phosphate_star 4.784084 4.325538 3.661619 12.771241
Atlantic (27.25,27.5] salinity temperature aou phosphate phosphate_star 4.831010 4.335440 3.672001 12.838450
Atlantic (27.25,27.5] temperature aou oxygen phosphate phosphate_star 4.778594 4.486817 3.662943 12.928355
Atlantic (27.25,27.5] temperature oxygen silicate phosphate phosphate_star 4.815587 4.464644 3.651525 12.931757
Atlantic (27.25,27.5] salinity aou oxygen phosphate phosphate_star 4.909921 4.380487 3.693874 12.984282
Atlantic (27.25,27.5] temperature aou silicate phosphate phosphate_star 4.864184 4.466131 3.654361 12.984677
Atlantic (27.25,27.5] temperature oxygen phosphate phosphate_star 4.836475 4.492731 3.663888 12.993095
Atlantic (27.25,27.5] salinity temperature aou oxygen phosphate 4.690176 4.375626 3.957693 13.023495
Atlantic (27.25,27.5] temperature aou phosphate phosphate_star 4.877589 4.486869 3.672726 13.037184
Atlantic (27.25,27.5] salinity temperature oxygen silicate phosphate 4.785817 4.370284 3.888408 13.044510
Atlantic (27.5,27.75] temperature aou silicate phosphate phosphate_star 4.178798 4.405750 4.230958 12.815506
Atlantic (27.5,27.75] temperature oxygen silicate phosphate phosphate_star 4.171250 4.419163 4.233864 12.824277
Atlantic (27.5,27.75] aou oxygen silicate phosphate phosphate_star 4.197885 4.399525 4.230411 12.827821
Atlantic (27.5,27.75] salinity temperature oxygen silicate phosphate 4.179766 4.394406 4.324356 12.898528
Atlantic (27.5,27.75] salinity temperature aou silicate phosphate 4.191718 4.383035 4.326416 12.901169
Atlantic (27.5,27.75] salinity aou oxygen silicate phosphate 4.210252 4.376137 4.327749 12.914138
Atlantic (27.5,27.75] temperature aou oxygen silicate phosphate 4.183773 4.409376 4.344048 12.937196
Atlantic (27.5,27.75] temperature aou silicate phosphate 4.197530 4.418293 4.345437 12.961259
Atlantic (27.5,27.75] temperature oxygen silicate phosphate 4.186794 4.431777 4.344048 12.962619
Atlantic (27.5,27.75] aou oxygen silicate phosphate 4.219326 4.412680 4.348932 12.980938
Atlantic (27.75,27.85] salinity aou oxygen silicate phosphate 4.155188 4.343314 6.006423 14.504925
Atlantic (27.75,27.85] salinity temperature oxygen silicate phosphate 4.152518 4.345415 6.018195 14.516128
Atlantic (27.75,27.85] salinity oxygen silicate phosphate phosphate_star 4.148845 4.341301 6.027563 14.517708
Atlantic (27.75,27.85] salinity temperature aou silicate phosphate 4.156656 4.348980 6.020016 14.525652
Atlantic (27.75,27.85] salinity aou silicate phosphate phosphate_star 4.141199 4.359680 6.036728 14.537608
Atlantic (27.75,27.85] salinity oxygen silicate phosphate 4.165017 4.346978 6.027909 14.539904
Atlantic (27.75,27.85] temperature aou oxygen silicate phosphate 4.221683 4.350846 5.972594 14.545123
Atlantic (27.75,27.85] salinity aou silicate phosphate 4.158893 4.364303 6.036854 14.560050
Atlantic (27.75,27.85] temperature oxygen silicate phosphate phosphate_star 4.213737 4.380967 6.023641 14.618345
Atlantic (27.75,27.85] temperature aou silicate phosphate phosphate_star 4.216149 4.387433 6.025514 14.629095
Atlantic (27.85,27.95] salinity aou oxygen silicate phosphate 3.727889 4.172888 4.843709 12.744486
Atlantic (27.85,27.95] salinity temperature oxygen silicate phosphate 3.739892 4.187911 4.879615 12.807418
Atlantic (27.85,27.95] salinity temperature aou silicate phosphate 3.750570 4.193737 4.879217 12.823524
Atlantic (27.85,27.95] salinity temperature silicate phosphate phosphate_star 3.882773 4.290264 4.849271 13.022309
Atlantic (27.85,27.95] salinity temperature silicate phosphate 3.980800 4.290271 4.879951 13.151023
Atlantic (27.85,27.95] salinity oxygen silicate phosphate phosphate_star 3.771723 4.412669 5.319665 13.504056
Atlantic (27.85,27.95] salinity oxygen silicate phosphate 3.788228 4.442442 5.332826 13.563495
Atlantic (27.85,27.95] salinity aou silicate phosphate phosphate_star 3.896036 4.600259 5.378794 13.875090
Atlantic (27.85,27.95] salinity aou silicate phosphate 3.924500 4.616418 5.383425 13.924343
Atlantic (27.85,27.95] temperature aou oxygen silicate phosphate 4.214755 4.849638 5.263138 14.327531
Atlantic (27.95,28.05] salinity aou oxygen silicate phosphate 3.487770 4.416875 4.820087 12.724732
Atlantic (27.95,28.05] salinity temperature oxygen silicate phosphate 3.498901 4.435697 4.910557 12.845155
Atlantic (27.95,28.05] salinity oxygen silicate phosphate phosphate_star 3.570396 4.433626 4.875191 12.879213
Atlantic (27.95,28.05] salinity temperature aou silicate phosphate 3.508118 4.459459 4.931814 12.899391
Atlantic (27.95,28.05] salinity temperature aou oxygen phosphate 3.755336 4.422690 4.799080 12.977106
Atlantic (27.95,28.05] salinity oxygen silicate phosphate 3.570686 4.452825 5.020607 13.044118
Atlantic (27.95,28.05] salinity temperature silicate phosphate phosphate_star 3.755808 4.829486 4.861915 13.447209
Atlantic (27.95,28.05] salinity aou silicate phosphate phosphate_star 3.750648 4.607306 5.100329 13.458284
Atlantic (27.95,28.05] salinity aou silicate phosphate 3.757788 4.616897 5.190912 13.565597
Atlantic (27.95,28.05] salinity temperature silicate phosphate 3.758011 4.835232 4.988962 13.582204
Atlantic (28.05,28.1] salinity temperature aou oxygen phosphate 3.539499 4.427871 4.144983 12.112354
Atlantic (28.05,28.1] temperature aou oxygen silicate phosphate 3.643192 4.386906 4.117142 12.147240
Atlantic (28.05,28.1] temperature aou oxygen phosphate phosphate_star 3.737328 4.517341 4.186888 12.441557
Atlantic (28.05,28.1] temperature aou oxygen phosphate 3.737933 4.520827 4.228193 12.486953
Atlantic (28.05,28.1] salinity temperature oxygen silicate phosphate 3.531111 4.629803 4.415293 12.576206
Atlantic (28.05,28.1] salinity temperature oxygen phosphate phosphate_star 3.554312 4.684188 4.356252 12.594752
Atlantic (28.05,28.1] salinity oxygen silicate phosphate phosphate_star 3.548422 4.631248 4.447473 12.627143
Atlantic (28.05,28.1] salinity temperature oxygen phosphate 3.557078 4.688580 4.416199 12.661857
Atlantic (28.05,28.1] salinity aou oxygen silicate phosphate 3.554108 4.635135 4.529410 12.718653
Atlantic (28.05,28.1] salinity oxygen silicate phosphate 3.555467 4.648734 4.534233 12.738434
Atlantic (28.1,28.15] salinity temperature oxygen silicate phosphate 3.349308 4.010613 4.254217 11.614139
Atlantic (28.1,28.15] salinity temperature aou oxygen phosphate 3.440411 4.008819 4.211635 11.660865
Atlantic (28.1,28.15] temperature aou oxygen silicate phosphate 3.436793 4.025910 4.216057 11.678759
Atlantic (28.1,28.15] temperature oxygen silicate phosphate phosphate_star 3.430280 4.041063 4.243363 11.714706
Atlantic (28.1,28.15] salinity temperature oxygen phosphate phosphate_star 3.448754 4.022449 4.243864 11.715066
Atlantic (28.1,28.15] salinity temperature oxygen phosphate 3.449525 4.022451 4.254795 11.726772
Atlantic (28.1,28.15] temperature oxygen silicate phosphate 3.437071 4.041093 4.255279 11.733443
Atlantic (28.1,28.15] salinity temperature aou silicate phosphate 3.390856 4.077688 4.319062 11.787606
Atlantic (28.1,28.15] temperature aou oxygen phosphate phosphate_star 3.542289 4.045605 4.211446 11.799340
Atlantic (28.1,28.15] temperature aou oxygen phosphate 3.542305 4.046629 4.220084 11.809018
Atlantic (28.15,28.2] salinity temperature aou oxygen phosphate 3.719163 3.681081 2.836143 10.236388
Atlantic (28.15,28.2] salinity temperature aou silicate phosphate 3.739761 3.698785 2.835064 10.273611
Atlantic (28.15,28.2] salinity temperature aou phosphate phosphate_star 3.727244 3.710071 2.837066 10.274381
Atlantic (28.15,28.2] salinity temperature aou phosphate 3.740143 3.711047 2.837785 10.288975
Atlantic (28.15,28.2] salinity aou oxygen silicate phosphate 3.713912 3.687702 2.914045 10.315659
Atlantic (28.15,28.2] salinity temperature oxygen silicate phosphate 3.775192 3.734735 2.836415 10.346342
Atlantic (28.15,28.2] salinity aou oxygen phosphate phosphate_star 3.705570 3.688287 2.955392 10.349249
Atlantic (28.15,28.2] salinity aou oxygen phosphate 3.719217 3.688379 2.956477 10.364073
Atlantic (28.15,28.2] salinity temperature oxygen phosphate phosphate_star 3.777038 3.755312 2.835243 10.367592
Atlantic (28.15,28.2] salinity temperature oxygen phosphate 3.784450 3.757169 2.836701 10.378319
Atlantic (28.2, Inf] salinity temperature aou oxygen phosphate 3.337999 3.143686 2.685083 9.166769
Atlantic (28.2, Inf] salinity aou oxygen silicate phosphate 3.358320 3.145049 2.767527 9.270896
Atlantic (28.2, Inf] salinity temperature aou silicate phosphate 3.425561 3.148993 2.696506 9.271059
Atlantic (28.2, Inf] salinity aou oxygen phosphate phosphate_star 3.376522 3.141055 2.763926 9.281502
Atlantic (28.2, Inf] salinity aou oxygen phosphate 3.378104 3.145072 2.767543 9.290719
Atlantic (28.2, Inf] salinity temperature aou phosphate phosphate_star 3.471029 3.143746 2.692778 9.307553
Atlantic (28.2, Inf] salinity temperature aou phosphate 3.472721 3.149181 2.700720 9.322622
Atlantic (28.2, Inf] salinity temperature oxygen silicate phosphate 3.502342 3.144268 2.676045 9.322655
Atlantic (28.2, Inf] temperature aou oxygen silicate phosphate 3.361576 3.278500 2.736479 9.376555
Atlantic (28.2, Inf] temperature aou oxygen phosphate phosphate_star 3.384056 3.283704 2.751414 9.419175
Indo-Pacific (-Inf,26] salinity aou oxygen phosphate phosphate_star 11.652593 6.872465 4.747255 23.272313
Indo-Pacific (-Inf,26] salinity temperature aou phosphate phosphate_star 11.725349 6.849543 4.968075 23.542968
Indo-Pacific (-Inf,26] salinity temperature oxygen phosphate phosphate_star 11.771329 6.883678 5.114532 23.769539
Indo-Pacific (-Inf,26] salinity aou oxygen silicate phosphate 11.591824 7.146475 5.644898 24.383197
Indo-Pacific (-Inf,26] salinity temperature aou silicate phosphate 11.662658 7.221472 5.848813 24.732943
Indo-Pacific (-Inf,26] salinity temperature aou oxygen phosphate_star 12.532453 7.048097 5.305447 24.885997
Indo-Pacific (-Inf,26] salinity temperature oxygen silicate phosphate 11.701156 7.270085 5.949523 24.920764
Indo-Pacific (-Inf,26] salinity temperature oxygen silicate phosphate_star 12.564249 7.054970 5.319566 24.938785
Indo-Pacific (-Inf,26] salinity temperature aou silicate phosphate_star 12.593023 7.092992 5.270621 24.956636
Indo-Pacific (-Inf,26] salinity temperature oxygen phosphate_star 12.574223 7.054989 5.382004 25.011216
Indo-Pacific (26,26.5] salinity temperature aou phosphate phosphate_star 7.884709 5.129658 3.991869 17.006237
Indo-Pacific (26,26.5] salinity aou oxygen phosphate phosphate_star 7.825697 5.232341 3.950876 17.008915
Indo-Pacific (26,26.5] salinity aou oxygen silicate phosphate 7.863872 5.215921 3.936596 17.016389
Indo-Pacific (26,26.5] salinity temperature oxygen phosphate phosphate_star 7.925778 5.121998 4.024452 17.072228
Indo-Pacific (26,26.5] salinity temperature aou silicate phosphate 7.935808 5.171091 4.013896 17.120795
Indo-Pacific (26,26.5] salinity temperature oxygen silicate phosphate 7.972957 5.179160 4.053536 17.205653
Indo-Pacific (26,26.5] salinity temperature aou oxygen phosphate 7.969753 5.311089 4.249030 17.529872
Indo-Pacific (26,26.5] salinity temperature aou phosphate 8.020770 5.323834 4.291014 17.635619
Indo-Pacific (26,26.5] salinity aou oxygen phosphate 7.970078 5.414262 4.254610 17.638950
Indo-Pacific (26,26.5] salinity temperature oxygen phosphate 8.051221 5.312575 4.311661 17.675457
Indo-Pacific (26.5,26.75] salinity aou oxygen phosphate phosphate_star 5.643270 5.441635 4.201758 15.286663
Indo-Pacific (26.5,26.75] salinity temperature aou phosphate phosphate_star 5.744701 5.481610 4.285316 15.511626
Indo-Pacific (26.5,26.75] salinity temperature oxygen phosphate phosphate_star 5.810017 5.522181 4.347636 15.679835
Indo-Pacific (26.5,26.75] salinity aou oxygen silicate phosphate 5.905584 5.702333 4.562541 16.170458
Indo-Pacific (26.5,26.75] salinity temperature aou oxygen phosphate 5.986932 5.709024 4.619676 16.315632
Indo-Pacific (26.5,26.75] salinity aou oxygen phosphate 5.988940 5.709065 4.635932 16.333936
Indo-Pacific (26.5,26.75] salinity temperature aou silicate phosphate 6.048583 5.719303 4.660956 16.428842
Indo-Pacific (26.5,26.75] aou oxygen silicate phosphate phosphate_star 6.137998 5.852677 4.450257 16.440932
Indo-Pacific (26.5,26.75] salinity temperature aou phosphate 6.075088 5.745923 4.716630 16.537642
Indo-Pacific (26.5,26.75] temperature aou oxygen phosphate phosphate_star 6.114876 5.850423 4.573040 16.538338
Indo-Pacific (26.75,27] temperature aou oxygen phosphate phosphate_star 6.512153 4.907927 4.030310 15.450390
Indo-Pacific (26.75,27] salinity aou oxygen phosphate phosphate_star 6.562262 4.957194 4.045916 15.565373
Indo-Pacific (26.75,27] aou oxygen silicate phosphate phosphate_star 6.519772 4.958933 4.154753 15.633458
Indo-Pacific (26.75,27] temperature aou oxygen silicate phosphate 6.525639 4.983289 4.221813 15.730741
Indo-Pacific (26.75,27] aou oxygen phosphate phosphate_star 6.598292 5.006942 4.154785 15.760018
Indo-Pacific (26.75,27] salinity temperature aou oxygen phosphate 6.549695 5.020274 4.249159 15.819127
Indo-Pacific (26.75,27] temperature aou oxygen phosphate 6.552943 5.020844 4.262915 15.836701
Indo-Pacific (26.75,27] temperature aou silicate phosphate phosphate_star 6.552474 5.026245 4.289949 15.868669
Indo-Pacific (26.75,27] temperature oxygen silicate phosphate phosphate_star 6.589732 5.091516 4.384008 16.065256
Indo-Pacific (26.75,27] salinity temperature aou phosphate phosphate_star 6.677586 5.136264 4.252461 16.066312
Indo-Pacific (27,27.25] temperature aou oxygen silicate phosphate 6.057890 4.532863 4.048207 14.638960
Indo-Pacific (27,27.25] salinity temperature aou oxygen phosphate 6.083955 4.607439 4.166144 14.857539
Indo-Pacific (27,27.25] temperature aou oxygen phosphate phosphate_star 6.113241 4.648067 4.163487 14.924795
Indo-Pacific (27,27.25] salinity aou oxygen silicate phosphate 6.431710 4.541014 4.107446 15.080171
Indo-Pacific (27,27.25] temperature aou oxygen phosphate 6.115680 4.747192 4.304603 15.167475
Indo-Pacific (27,27.25] salinity aou silicate phosphate phosphate_star 6.509533 4.544592 4.121767 15.175892
Indo-Pacific (27,27.25] salinity temperature aou silicate phosphate 6.562627 4.548385 4.119478 15.230490
Indo-Pacific (27,27.25] salinity aou silicate phosphate 6.576878 4.548729 4.126122 15.251729
Indo-Pacific (27,27.25] salinity aou oxygen phosphate phosphate_star 6.431281 4.709064 4.174627 15.314973
Indo-Pacific (27,27.25] salinity temperature oxygen silicate phosphate 6.676758 4.583771 4.146776 15.407305
Indo-Pacific (27.25,27.5] temperature aou oxygen silicate phosphate 4.835968 3.913969 3.527790 12.277728
Indo-Pacific (27.25,27.5] salinity aou oxygen silicate phosphate 5.251519 3.924282 3.243081 12.418882
Indo-Pacific (27.25,27.5] temperature aou oxygen phosphate phosphate_star 4.863065 4.084331 3.647515 12.594911
Indo-Pacific (27.25,27.5] salinity temperature aou oxygen phosphate 4.862194 4.131183 3.627177 12.620554
Indo-Pacific (27.25,27.5] salinity temperature aou silicate phosphate 5.578168 3.945800 3.247152 12.771119
Indo-Pacific (27.25,27.5] temperature aou oxygen phosphate 4.866519 4.177465 3.729263 12.773247
Indo-Pacific (27.25,27.5] salinity aou oxygen phosphate phosphate_star 5.202101 4.189161 3.564507 12.955770
Indo-Pacific (27.25,27.5] salinity temperature oxygen silicate phosphate 5.801738 3.975890 3.253916 13.031545
Indo-Pacific (27.25,27.5] aou oxygen silicate phosphate phosphate_star 5.231115 4.179514 3.679102 13.089731
Indo-Pacific (27.25,27.5] salinity aou silicate phosphate phosphate_star 5.925597 3.952449 3.239888 13.117934
Indo-Pacific (27.5,27.75] salinity aou oxygen silicate phosphate 4.688828 3.618102 2.968149 11.275080
Indo-Pacific (27.5,27.75] salinity temperature aou silicate phosphate 4.857991 3.616196 2.966581 11.440767
Indo-Pacific (27.5,27.75] temperature aou oxygen silicate phosphate 4.414022 3.841294 3.290961 11.546277
Indo-Pacific (27.5,27.75] salinity temperature oxygen silicate phosphate 4.986342 3.619099 2.965966 11.571407
Indo-Pacific (27.5,27.75] salinity temperature aou oxygen phosphate 4.436909 3.849001 3.371011 11.656920
Indo-Pacific (27.5,27.75] temperature aou oxygen phosphate phosphate_star 4.435934 3.911470 3.405050 11.752454
Indo-Pacific (27.5,27.75] temperature aou oxygen phosphate 4.437170 3.916272 3.429891 11.783332
Indo-Pacific (27.5,27.75] salinity aou oxygen phosphate phosphate_star 4.689603 3.835711 3.334569 11.859882
Indo-Pacific (27.5,27.75] salinity aou oxygen phosphate 4.689770 3.851583 3.372534 11.913887
Indo-Pacific (27.5,27.75] aou oxygen silicate phosphate phosphate_star 4.694510 3.840147 3.409260 11.943917
Indo-Pacific (27.75,27.85] temperature aou oxygen silicate phosphate 4.269432 3.241574 2.903747 10.414753
Indo-Pacific (27.75,27.85] salinity temperature oxygen silicate phosphate 4.308811 3.258512 2.865015 10.432338
Indo-Pacific (27.75,27.85] salinity temperature aou silicate phosphate 4.285667 3.281811 2.876268 10.443746
Indo-Pacific (27.75,27.85] salinity aou oxygen silicate phosphate 4.262144 3.320317 2.896917 10.479378
Indo-Pacific (27.75,27.85] temperature aou silicate phosphate phosphate_star 4.300544 3.271219 2.918998 10.490761
Indo-Pacific (27.75,27.85] temperature oxygen silicate phosphate phosphate_star 4.326772 3.254352 2.911216 10.492339
Indo-Pacific (27.75,27.85] aou oxygen silicate phosphate phosphate_star 4.272132 3.304968 2.938537 10.515636
Indo-Pacific (27.75,27.85] temperature oxygen silicate phosphate 4.327841 3.271370 2.916579 10.515790
Indo-Pacific (27.75,27.85] temperature aou silicate phosphate 4.302407 3.293390 2.924736 10.520533
Indo-Pacific (27.75,27.85] temperature aou oxygen phosphate phosphate_star 4.261066 3.299139 3.000201 10.560406
Indo-Pacific (27.85,27.95] temperature aou silicate phosphate phosphate_star 4.303730 2.964754 2.889269 10.157754
Indo-Pacific (27.85,27.95] aou oxygen silicate phosphate phosphate_star 4.288887 2.967361 2.903249 10.159496
Indo-Pacific (27.85,27.95] salinity temperature aou silicate phosphate 4.321113 2.980023 2.878668 10.179804
Indo-Pacific (27.85,27.95] temperature oxygen silicate phosphate phosphate_star 4.322979 2.972074 2.886339 10.181392
Indo-Pacific (27.85,27.95] salinity aou oxygen silicate phosphate 4.308082 2.987020 2.896438 10.191540
Indo-Pacific (27.85,27.95] temperature aou oxygen silicate phosphate 4.314832 2.983036 2.896340 10.194207
Indo-Pacific (27.85,27.95] salinity temperature oxygen silicate phosphate 4.340586 2.984254 2.870691 10.195531
Indo-Pacific (27.85,27.95] temperature aou silicate phosphate 4.326316 2.983354 2.899097 10.208768
Indo-Pacific (27.85,27.95] aou oxygen silicate phosphate 4.314868 2.989308 2.913618 10.217794
Indo-Pacific (27.85,27.95] salinity aou oxygen phosphate phosphate_star 4.271402 2.998071 2.959829 10.229302
Indo-Pacific (27.95,28.05] salinity aou oxygen silicate phosphate 4.380825 2.852408 3.078449 10.311682
Indo-Pacific (27.95,28.05] salinity aou oxygen phosphate phosphate_star 4.381490 2.878636 3.076442 10.336569
Indo-Pacific (27.95,28.05] aou oxygen silicate phosphate phosphate_star 4.398487 2.860645 3.079305 10.338437
Indo-Pacific (27.95,28.05] salinity temperature aou silicate phosphate 4.399293 2.875842 3.067839 10.342974
Indo-Pacific (27.95,28.05] temperature aou oxygen phosphate phosphate_star 4.399165 2.871522 3.076308 10.346995
Indo-Pacific (27.95,28.05] aou oxygen phosphate phosphate_star 4.399784 2.878684 3.080077 10.358546
Indo-Pacific (27.95,28.05] salinity temperature aou oxygen phosphate 4.381680 2.872244 3.110001 10.363925
Indo-Pacific (27.95,28.05] salinity aou oxygen phosphate 4.381858 2.881876 3.110180 10.373914
Indo-Pacific (27.95,28.05] temperature aou silicate phosphate phosphate_star 4.422479 2.885926 3.068729 10.377135
Indo-Pacific (27.95,28.05] temperature aou oxygen silicate phosphate 4.402331 2.868436 3.112341 10.383108
Indo-Pacific (28.05,28.1] salinity aou oxygen phosphate phosphate_star 4.234297 2.857998 2.800839 9.893134
Indo-Pacific (28.05,28.1] salinity aou oxygen silicate phosphate 4.231465 2.843034 2.829063 9.903562
Indo-Pacific (28.05,28.1] salinity temperature aou oxygen phosphate 4.230598 2.861453 2.819898 9.911949
Indo-Pacific (28.05,28.1] salinity aou oxygen phosphate 4.234300 2.864288 2.831678 9.930266
Indo-Pacific (28.05,28.1] aou oxygen silicate phosphate phosphate_star 4.232564 2.871417 2.826666 9.930646
Indo-Pacific (28.05,28.1] temperature aou oxygen phosphate phosphate_star 4.232111 2.872811 2.844050 9.948973
Indo-Pacific (28.05,28.1] salinity temperature aou silicate phosphate 4.271623 2.848117 2.838349 9.958088
Indo-Pacific (28.05,28.1] aou oxygen phosphate phosphate_star 4.237606 2.873181 2.851534 9.962321
Indo-Pacific (28.05,28.1] temperature aou oxygen silicate phosphate 4.231850 2.881579 2.863461 9.976889
Indo-Pacific (28.05,28.1] aou oxygen silicate phosphate 4.233558 2.883351 2.872585 9.989494
Indo-Pacific (28.1, Inf] salinity aou oxygen silicate phosphate 3.567664 3.090883 2.618254 9.276801
Indo-Pacific (28.1, Inf] temperature aou oxygen silicate phosphate 3.599744 3.042637 2.653758 9.296139
Indo-Pacific (28.1, Inf] aou oxygen silicate phosphate phosphate_star 3.633084 2.982321 2.697944 9.313349
Indo-Pacific (28.1, Inf] aou oxygen silicate phosphate 3.638971 3.091267 2.706785 9.437024
Indo-Pacific (28.1, Inf] salinity aou oxygen phosphate phosphate_star 3.596967 3.202683 2.651638 9.451287
Indo-Pacific (28.1, Inf] salinity temperature aou phosphate phosphate_star 3.537341 3.234509 2.701246 9.473096
Indo-Pacific (28.1, Inf] salinity temperature aou oxygen phosphate 3.537528 3.314768 2.641163 9.493459
Indo-Pacific (28.1, Inf] salinity aou oxygen phosphate 3.597324 3.320281 2.652926 9.570531
Indo-Pacific (28.1, Inf] salinity temperature aou silicate phosphate 3.538830 3.348288 2.712252 9.599369
Indo-Pacific (28.1, Inf] salinity temperature oxygen phosphate phosphate_star 3.590808 3.275252 2.761419 9.627479
rm(n_predictors_max, n_predictors_min)
lm_best <- lm_best %>% 
  mutate(lm_coeff = str_replace_all(predictors, " ", " + "),
         lm_coeff = paste("Cstar ~", lm_coeff))

# test_lm <- lm_best %>% 
#   slice_min(rmse_sum) %>% 
#   select(lm_coeff) %>% 
#   pull()
# 
# class(test_lm)
# test_lm_formula <- as.formula(test_lm)
# class(test_lm_formula)

for (i_basin in unique(GLODAP$basin)) {
  for (i_era in unique(GLODAP$era)) {
    
    # i_basin <- unique(GLODAP$basin)[1]
    # i_era   <- unique(GLODAP$era)[1]
    
    print(i_basin) 
    print(i_era  )
    
    GLODAP_basin_era <- GLODAP %>%
      filter(basin == i_basin, era == i_era)

    lm_best_basin <- lm_best %>%
      filter(basin == i_basin)

    for (i_gamma_slab in unique(GLODAP_basin_era$gamma_slab)) {

      # i_gamma_slab <- unique(GLODAP_basin_era$gamma_slab)[1]
      print(i_gamma_slab)
      
      GLODAP_basin_era_slab <- GLODAP_basin_era %>% 
        filter(gamma_slab == i_gamma_slab)
      
      lm_best_basin_slab <- lm_best_basin %>% 
        filter(gamma_slab == i_gamma_slab)
      
      for (i_rmse_sum in unique(lm_best_basin_slab$rmse_sum)) {
        
        # i_rmse_sum <- unique(lm_best_basin_slab$rmse_sum)[2]
        
        lm_best_single <- lm_best %>%
          filter(rmse_sum == i_rmse_sum) %>%
          select(lm_coeff) %>%
          pull()
        
        lm_formula <- as.formula(lm_best_single)
        
        model_single <- lm(lm_formula, 
              data = GLODAP_basin_era_slab)
        
        coefficients <- tidy(model_single)
        coefficients <- coefficients %>% 
          mutate(basin = i_basin,
                 era = i_era,
                 gamma_slab = i_gamma_slab,
                 model = lm_best_single,
                 rmse = i_rmse_sum)
        
        print(lm_best_single)
      
      if (exists("all_lm")) {
        all_lm <- bind_rows(all_lm, coefficients)
      }
      
      if (!exists("all_lm")) {
        all_lm <- coefficients
      }
      
      rm(lm_formula, model_single, coefficients)
        
      }
      
 
    }
    
  }
  
}


all_lm %>%
  write_csv(here::here("data/eMLR",
                       "all_lm.csv"))

6.3.2 All predictors

MLRs <- GLODAP %>%
  nest(data = -c(basin, era, gamma_slab)) %>% 
  mutate(
    fit = map(data, ~ lm(Cstar ~ salinity  + temperature  + aou  + oxygen  + silicate  + phosphate  + phosphate_star,
                         data = .x)),
    tidied = map(fit, tidy),
    glanced = map(fit, glance),
    augmented = map(fit, augment)
  )

MLRs_tidied <- MLRs %>% 
  unnest(tidied)

MLRs_tidied

MLRs_tidied <- MLRs_tidied %>% 
  select(era, basin, gamma_slab, term, estimate, p.value)

MLRs_tidied_wide <- MLRs_tidied %>% 
  select(-p.value) %>% 
  pivot_wider(names_from = era, values_from = estimate, names_prefix = "coeff_")

MLRs_tidied_wide <- MLRs_tidied_wide %>% 
  mutate(delta_coeff_J_G = coeff_GO_SHIP - coeff_JGOFS_WOCE,
         delta_coeff_G_n = coeff_new_era - coeff_GO_SHIP,
         delta_coeff_n_G = coeff_new_era - coeff_JGOFS_WOCE)

MLRs_tidied %>% 
  ggplot(aes(p.value, term, col = gamma_slab)) +
  geom_point() +
  facet_grid(basin~era)

MLRs_tidied %>% 
  filter(p.value < 0.05) %>% 
  ggplot(aes(p.value, term, col = gamma_slab)) +
  geom_point() +
  facet_grid(basin~era)

MLRs_tidied %>% 
  ggplot(aes(p.value, term)) +
  geom_boxplot() +
  facet_grid(basin~era)

MLRs %>% 
  unnest(glanced)

MLRs %>% 
  unnest(augmented)

7 Open tasks

  • Check if intercept is modeled

sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_Germany.1252  LC_CTYPE=English_Germany.1252   
[3] LC_MONETARY=English_Germany.1252 LC_NUMERIC=C                    
[5] LC_TIME=English_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] corrr_0.4.2      kableExtra_1.1.0 knitr_1.29       olsrr_0.5.3.9000
 [5] GGally_2.0.0     broom_0.7.0      patchwork_1.0.1  lubridate_1.7.9 
 [9] forcats_0.5.0    stringr_1.4.0    dplyr_1.0.0      purrr_0.3.4     
[13] readr_1.3.1      tidyr_1.1.0      tibble_3.0.3     ggplot2_3.3.2   
[17] tidyverse_1.3.0  workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] fs_1.4.2           webshot_0.5.2      RColorBrewer_1.1-2 httr_1.4.2        
 [5] rprojroot_1.3-2    tools_4.0.2        backports_1.1.8    R6_2.4.1          
 [9] nortest_1.0-4      DBI_1.1.0          colorspace_1.4-1   withr_2.2.0       
[13] tidyselect_1.1.0   gridExtra_2.3      curl_4.3           compiler_4.0.2    
[17] git2r_0.27.1       cli_2.0.2          rvest_0.3.6        xml2_1.3.2        
[21] labeling_0.3       scales_1.1.1       goftest_1.2-2      digest_0.6.25     
[25] foreign_0.8-80     rmarkdown_2.3      rio_0.5.16         pkgconfig_2.0.3   
[29] htmltools_0.5.0    highr_0.8          dbplyr_1.4.4       maps_3.3.0        
[33] rlang_0.4.7        readxl_1.3.1       rstudioapi_0.11    generics_0.0.2    
[37] farver_2.0.3       jsonlite_1.7.0     zip_2.0.4          car_3.0-8         
[41] magrittr_1.5       Rcpp_1.0.5         munsell_0.5.0      fansi_0.4.1       
[45] abind_1.4-5        lifecycle_0.2.0    stringi_1.4.6      whisker_0.4       
[49] yaml_2.2.1         carData_3.0-4      plyr_1.8.6         grid_4.0.2        
[53] blob_1.2.1         promises_1.1.1     crayon_1.3.4       haven_2.3.1       
[57] hms_0.5.3          pillar_1.4.6       reprex_0.3.0       glue_1.4.1        
[61] evaluate_0.14      data.table_1.13.0  modelr_0.1.8       vctrs_0.3.2       
[65] httpuv_1.5.4       cellranger_1.1.0   gtable_0.3.0       reshape_0.8.8     
[69] assertthat_0.2.1   xfun_0.16          openxlsx_4.1.5     later_1.1.0.1     
[73] viridisLite_0.3.0  ellipsis_0.3.1     here_0.1