Last updated: 2020-12-07

Checks: 7 0

Knit directory: emlr_obs_v_XXX/

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 a4ec6a0. 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:    .Rhistory
    Ignored:    .Rproj.user/

Unstaged changes:
    Modified:   code/Workflowr_project_managment.R
    Modified:   data/auxillary/params_local.rds

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_model_fitting.Rmd) and HTML (docs/eMLR_model_fitting.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
html 70bf1a5 jens-daniel-mueller 2020-12-07 Build site.
html 7555355 jens-daniel-mueller 2020-12-07 Build site.
html 143d6fa jens-daniel-mueller 2020-12-07 Build site.
html abc6818 jens-daniel-mueller 2020-12-03 Build site.
Rmd 992ba15 jens-daniel-mueller 2020-12-03 rebuild with variable inventory depth
html c8c2e7b jens-daniel-mueller 2020-12-03 Build site.
Rmd 83203db jens-daniel-mueller 2020-12-03 calculate cant with variable inventory depth
html 090e4d5 jens-daniel-mueller 2020-12-02 Build site.
html 7c25f7a jens-daniel-mueller 2020-12-02 Build site.
html ec8dc38 jens-daniel-mueller 2020-12-02 Build site.
html c987de1 jens-daniel-mueller 2020-12-02 Build site.
html f8358f8 jens-daniel-mueller 2020-12-02 Build site.
html b03ddb8 jens-daniel-mueller 2020-12-02 Build site.
Rmd 9183e8f jens-daniel-mueller 2020-12-02 revised assignment of era to eras
html 22d0127 jens-daniel-mueller 2020-12-01 Build site.
html 0ff728b jens-daniel-mueller 2020-12-01 Build site.
html 91435ae jens-daniel-mueller 2020-12-01 Build site.
Rmd 17d09be jens-daniel-mueller 2020-12-01 auto eras naming
html cf19652 jens-daniel-mueller 2020-11-30 Build site.
Rmd 0895ad6 jens-daniel-mueller 2020-11-30 rebuild with all plot output
Rmd 2842970 jens-daniel-mueller 2020-11-30 cleaned for eMLR part only
html 196be51 jens-daniel-mueller 2020-11-30 Build site.
Rmd 7a4b015 jens-daniel-mueller 2020-11-30 first rebuild on ETH server
Rmd bc61ce3 Jens Müller 2020-11-30 Initial commit

1 Required data

Required are:

  • cleaned and prepared GLODAPv2_2020 file
GLODAP <-
  read_csv(paste(path_version_data,
                 "GLODAPv2.2020_MLR_fitting_ready.csv",
                 sep = ""))

2 Fitting all models

2.1 RMSE calculation

Individual linear regression models were fitted for C* as a function of each predictor combination. Fitting was performed separately within each basin, era, and slab. The root mean squared error (RMSE) was calculated for each fitted model.

# loops across all basins and eras
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  )
    
    # subset one basin and era for fitting
    GLODAP_basin_era <- GLODAP %>%
      filter(basin == i_basin, era == i_era)
    
    # loop across all gamma slabs in the current basin and 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)
      
      # subset one gamma slab
      GLODAP_basin_era_slab <- GLODAP_basin_era %>% 
        filter(gamma_slab == i_gamma_slab)

      # fit the full linear model, i.e. all predictor combinations
      lm_full <- lm(
        params_local$MLR_full_model,
        data = GLODAP_basin_era_slab)
      
      # fit linear models for all possible predictor combinations
      # unfortunately, this functions does not provide model coefficients (yet)
      lm_all <- ols_step_all_possible(lm_full)
      
      # extract diagnostics of each linear model
      lm_all <- as_tibble(lm_all$result)
      
      # add currect basin, era, and gamma values
      lm_all <- lm_all %>% 
        mutate(basin = i_basin,
               era = i_era,
               gamma_slab = i_gamma_slab)
      
      # expanding table with model diagnostics for all eras, basins, slabs
      if (exists("lm_all_stats")) {
        lm_all_stats <- bind_rows(lm_all_stats, lm_all)
      }
      
      if (!exists("lm_all_stats")) {
        lm_all_stats <- lm_all
      }
      
      rm(lm_full, lm_all)
      
    }
    
  }
  
}

# write model diagnostics to file

lm_all_stats %>% write_csv(paste(path_version_data,
                             "lm_all_stats.csv",
                             sep = ""))

rm(i_gamma_slab, i_era, i_basin,
   GLODAP_basin_era, GLODAP_basin_era_slab)

RMSE was plotted against the number of predictors (limited to 2 - 5).

# lm_all_stats <- read_csv(paste(path_version_data,
#                                "lm_all_stats.csv",
#                                sep = ""))


lm_all_stats <- lm_all_stats %>% 
  filter(n >= params_local$predictors_min,
         n <= params_local$predictors_max)

lm_all_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")

Version Author Date
70bf1a5 jens-daniel-mueller 2020-12-07
7555355 jens-daniel-mueller 2020-12-07
143d6fa jens-daniel-mueller 2020-12-07
090e4d5 jens-daniel-mueller 2020-12-02
7c25f7a jens-daniel-mueller 2020-12-02
b03ddb8 jens-daniel-mueller 2020-12-02
91435ae jens-daniel-mueller 2020-12-01
196be51 jens-daniel-mueller 2020-11-30

2.2 RMSE alternatives

AIC is an alternative criterion to RMSE to judge model quality, but not (yet) taken into account.

lm_all_stats %>% 
  ggplot(aes(rmse, aic, col = gamma_slab)) +
  geom_point() +
  scale_color_viridis_d() +
  facet_grid(era~basin)

Version Author Date
70bf1a5 jens-daniel-mueller 2020-12-07
7555355 jens-daniel-mueller 2020-12-07
143d6fa jens-daniel-mueller 2020-12-07
090e4d5 jens-daniel-mueller 2020-12-02
7c25f7a jens-daniel-mueller 2020-12-02
b03ddb8 jens-daniel-mueller 2020-12-02
91435ae jens-daniel-mueller 2020-12-01
196be51 jens-daniel-mueller 2020-11-30

2.3 Predictor selection

Within each basin and slab, the 10 linear regression models with lowest summed RMSE across two adjacent (ie compared) eras were selected.

# select relevant columns
lm_all_stats <- lm_all_stats %>%
  select(basin, era, gamma_slab, predictors, rmse)

# calculate RMSE sum for adjacent eras
lm_all_stats_eras <- lm_all_stats %>%
  arrange(era) %>% 
  group_by(basin, gamma_slab, predictors) %>% 
  mutate(rmse_sum = rmse + lag(rmse),
         eras = paste(lag(era), era, sep = " --> ")) %>% 
  ungroup() %>% 
  arrange(basin, gamma_slab, predictors, era) %>% 
  drop_na()

# subset models with lowest RMSE sum
lm_best <- lm_all_stats_eras %>%
  group_by(basin, gamma_slab, eras) %>%
  slice_min(order_by = rmse_sum,
            with_ties = FALSE,
            n = params_local$MLR_number) %>%
  ungroup() %>% 
  arrange(basin, gamma_slab, eras, predictors, era)

# plot table for website
kable(lm_best) %>%
  add_header_above() %>%
  kable_styling() %>%
  scroll_box(width = "100%", height = "400px")
basin era gamma_slab predictors rmse rmse_sum eras
Atlantic 2012-2019 (-Inf,26] sal aou oxygen silicate phosphate 3.403484 10.504670 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal aou oxygen silicate phosphate_star 3.403484 10.504670 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal aou silicate phosphate phosphate_star 3.403484 10.504670 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem aou oxygen phosphate 3.387050 10.700824 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem aou oxygen phosphate_star 3.387050 10.700824 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem aou silicate phosphate 3.392788 10.554426 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem aou silicate phosphate_star 3.391512 10.561045 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem oxygen silicate phosphate 3.390411 10.564758 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem oxygen silicate phosphate_star 3.390411 10.564758 2000-2011 –> 2012-2019
Atlantic 2012-2019 (-Inf,26] sal tem silicate phosphate phosphate_star 3.390411 10.564758 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal aou oxygen silicate phosphate 4.110057 9.414471 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal aou oxygen silicate phosphate_star 4.110057 9.414471 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal aou silicate phosphate phosphate_star 4.110057 9.414471 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal tem aou oxygen phosphate 4.350984 9.454209 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal tem aou oxygen phosphate_star 4.350984 9.454209 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal tem aou phosphate phosphate_star 4.350984 9.454209 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] sal tem aou silicate phosphate 4.114498 9.478396 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] tem aou oxygen silicate phosphate 4.229950 9.323391 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] tem aou oxygen silicate phosphate_star 4.229950 9.323391 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26,26.5] tem aou silicate phosphate phosphate_star 4.229950 9.323391 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem aou oxygen phosphate 4.034562 8.288290 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem aou oxygen phosphate_star 4.034562 8.288290 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem aou silicate phosphate 3.901766 8.202575 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem aou silicate phosphate_star 3.883341 8.159431 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem oxygen silicate phosphate 3.876287 8.150070 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem oxygen silicate phosphate_star 3.876287 8.150070 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] sal tem silicate phosphate phosphate_star 3.876287 8.150070 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] tem aou oxygen silicate phosphate 3.919468 8.232621 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] tem aou oxygen silicate phosphate_star 3.919468 8.232621 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.5,26.75] tem aou silicate phosphate phosphate_star 3.919468 8.232621 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] sal tem aou silicate phosphate 3.784438 8.358959 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] sal tem aou silicate phosphate_star 3.763850 8.316361 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] sal tem oxygen silicate phosphate 3.762644 8.315325 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] sal tem oxygen silicate phosphate_star 3.762644 8.315325 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] sal tem silicate phosphate phosphate_star 3.762644 8.315325 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] tem aou oxygen silicate phosphate 3.773010 8.397167 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] tem aou oxygen silicate phosphate_star 3.773010 8.397167 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] tem aou silicate phosphate phosphate_star 3.773010 8.397167 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] tem oxygen silicate phosphate 3.774724 8.400441 2000-2011 –> 2012-2019
Atlantic 2012-2019 (26.75,27] tem oxygen silicate phosphate phosphate_star 3.774724 8.400441 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] sal tem aou silicate phosphate 4.961956 9.921970 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] sal tem aou silicate phosphate_star 4.971820 9.834522 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] sal tem oxygen silicate phosphate 4.971695 9.843107 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] sal tem oxygen silicate phosphate_star 4.971695 9.843107 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] sal tem silicate phosphate phosphate_star 4.971695 9.843107 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] tem aou oxygen silicate phosphate 5.013665 9.818714 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] tem aou oxygen silicate phosphate_star 5.013665 9.818714 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] tem aou silicate phosphate phosphate_star 5.013665 9.818714 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] tem aou silicate phosphate_star 5.040938 9.944515 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27,27.25] tem silicate phosphate phosphate_star 5.040072 9.952734 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal aou oxygen silicate phosphate 4.333343 8.630122 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal aou silicate phosphate phosphate_star 4.333343 8.630122 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal tem aou silicate phosphate 4.385511 8.592742 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal tem aou silicate phosphate_star 4.446872 8.604427 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal tem oxygen silicate phosphate 4.427239 8.596783 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal tem oxygen silicate phosphate_star 4.427239 8.596783 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] sal tem silicate phosphate phosphate_star 4.427239 8.596783 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] tem aou oxygen silicate phosphate 4.381297 8.616409 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] tem aou oxygen silicate phosphate_star 4.381297 8.616409 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.25,27.5] tem aou silicate phosphate phosphate_star 4.381297 8.616409 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal aou oxygen silicate phosphate 4.254833 8.797541 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal aou oxygen silicate phosphate_star 4.254833 8.797541 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal aou silicate phosphate phosphate_star 4.254833 8.797541 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal tem aou silicate phosphate 4.257281 8.770381 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal tem aou silicate phosphate_star 4.279870 8.791175 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal tem oxygen silicate phosphate 4.263150 8.770336 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal tem oxygen silicate phosphate_star 4.263150 8.770336 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] sal tem silicate phosphate phosphate_star 4.263150 8.770336 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] tem aou oxygen silicate phosphate 4.254461 8.841584 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.5,27.75] tem aou silicate phosphate phosphate_star 4.254461 8.841584 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal aou oxygen silicate phosphate 5.076845 10.015311 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal aou oxygen silicate phosphate_star 5.076845 10.015311 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal aou silicate phosphate phosphate_star 5.076845 10.015311 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal tem aou silicate phosphate 5.095841 10.034259 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal tem aou silicate phosphate_star 5.071867 10.017678 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal tem oxygen silicate phosphate_star 5.095317 10.035262 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] sal tem silicate phosphate phosphate_star 5.095317 10.035262 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] tem aou oxygen silicate phosphate 5.043024 9.998922 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] tem aou oxygen silicate phosphate_star 5.043024 9.998922 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.75,27.85] tem aou silicate phosphate phosphate_star 5.043024 9.998922 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal aou oxygen silicate phosphate 4.399038 9.478116 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal aou oxygen silicate phosphate_star 4.399038 9.478116 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal aou silicate phosphate phosphate_star 4.399038 9.478116 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal aou silicate phosphate_star 4.610095 9.717955 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem aou silicate phosphate 4.434316 9.510629 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem aou silicate phosphate_star 4.414772 9.491907 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem oxygen silicate phosphate 4.434211 9.510296 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem oxygen silicate phosphate_star 4.434211 9.510296 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem silicate phosphate 4.434323 9.612493 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.85,27.95] sal tem silicate phosphate phosphate_star 4.434211 9.510296 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal aou oxygen silicate phosphate 4.556534 10.648594 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal aou oxygen silicate phosphate_star 4.556534 10.648594 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal aou silicate phosphate phosphate_star 4.556534 10.648594 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal aou silicate phosphate_star 4.636048 10.728109 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem aou phosphate phosphate_star 4.731872 10.906041 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem aou silicate phosphate 4.663218 10.780813 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem aou silicate phosphate_star 4.592345 10.683449 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem oxygen silicate phosphate 4.636499 10.742576 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem oxygen silicate phosphate_star 4.636499 10.742576 2000-2011 –> 2012-2019
Atlantic 2012-2019 (27.95,28.05] sal tem silicate phosphate phosphate_star 4.636499 10.742576 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] sal tem aou oxygen phosphate 4.313118 10.693142 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] sal tem aou oxygen phosphate_star 4.313118 10.693142 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] sal tem aou phosphate phosphate_star 4.313118 10.693142 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou oxygen phosphate 4.411489 10.861880 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou oxygen phosphate phosphate_star 4.411489 10.861880 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou oxygen phosphate_star 4.411489 10.861880 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou oxygen silicate phosphate 4.242968 10.616782 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou oxygen silicate phosphate_star 4.242968 10.616782 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou phosphate phosphate_star 4.411489 10.861880 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.05,28.1] tem aou silicate phosphate phosphate_star 4.242968 10.616782 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem aou oxygen phosphate 4.121460 11.364135 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem aou oxygen phosphate_star 4.121460 11.364135 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem aou phosphate phosphate_star 4.121460 11.364135 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem aou silicate phosphate_star 4.159900 11.408450 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem oxygen silicate phosphate 4.159743 11.409090 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem oxygen silicate phosphate_star 4.159743 11.409090 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] sal tem silicate phosphate phosphate_star 4.159743 11.409090 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] tem aou oxygen silicate phosphate 4.114907 11.402602 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] tem aou oxygen silicate phosphate_star 4.114907 11.402602 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.1,28.15] tem aou silicate phosphate phosphate_star 4.114907 11.402602 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal aou oxygen silicate phosphate 2.842743 6.391368 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal aou oxygen silicate phosphate_star 2.842743 6.391368 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal aou silicate phosphate phosphate_star 2.842743 6.391368 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem aou oxygen phosphate 2.789444 6.336877 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem aou oxygen phosphate_star 2.789444 6.336877 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem aou phosphate 2.790727 6.372110 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem aou phosphate phosphate_star 2.789444 6.336877 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem aou silicate phosphate 2.788296 6.353332 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem oxygen silicate phosphate 2.790384 6.394371 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.15,28.2] sal tem silicate phosphate phosphate_star 2.790384 6.394371 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou oxygen phosphate 2.990938 5.977066 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou oxygen phosphate phosphate_star 2.990938 5.977066 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou oxygen phosphate_star 2.990938 5.977066 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou oxygen silicate phosphate 2.988295 5.974420 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou oxygen silicate phosphate_star 2.988295 5.974420 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou phosphate phosphate_star 2.990938 5.977066 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal aou silicate phosphate phosphate_star 2.988295 5.974420 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal tem aou oxygen phosphate 2.986378 5.972168 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal tem aou oxygen phosphate_star 2.986378 5.972168 2000-2011 –> 2012-2019
Atlantic 2012-2019 (28.2, Inf] sal tem aou phosphate phosphate_star 2.986378 5.972168 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal aou oxygen silicate phosphate 5.401470 11.862149 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal aou oxygen silicate phosphate_star 5.401470 11.862149 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal aou silicate phosphate phosphate_star 5.401470 11.862149 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem aou oxygen phosphate 5.753969 12.604734 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem aou phosphate phosphate_star 5.753969 12.604734 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem aou silicate phosphate 5.640435 12.202132 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem aou silicate phosphate_star 5.711341 12.309447 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem oxygen silicate phosphate 5.756181 12.369298 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem oxygen silicate phosphate_star 5.756181 12.369298 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (-Inf,26] sal tem silicate phosphate phosphate_star 5.756181 12.369298 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal aou oxygen silicate phosphate 3.863550 8.649393 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal aou oxygen silicate phosphate_star 3.863550 8.649393 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal aou silicate phosphate phosphate_star 3.863550 8.649393 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem aou oxygen phosphate_star 4.207868 9.190518 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem aou silicate phosphate 3.961173 8.756385 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem aou silicate phosphate_star 4.010558 8.833338 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem oxygen silicate phosphate 4.011190 8.835378 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem oxygen silicate phosphate_star 4.011190 8.835378 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem silicate phosphate phosphate_star 4.011190 8.835378 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26,26.5] sal tem silicate phosphate_star 4.012265 8.857148 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou oxygen phosphate 4.540230 9.883482 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou oxygen phosphate phosphate_star 4.540230 9.883482 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou oxygen phosphate_star 4.540230 9.883482 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou oxygen silicate phosphate 4.479259 9.821024 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou oxygen silicate phosphate_star 4.479259 9.821024 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou phosphate phosphate_star 4.540230 9.883482 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal aou silicate phosphate phosphate_star 4.479259 9.821024 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal tem aou oxygen phosphate 4.532117 9.874118 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal tem aou oxygen phosphate_star 4.532117 9.874118 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.5,26.75] sal tem aou phosphate phosphate_star 4.532117 9.874118 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] sal tem aou oxygen phosphate 4.228709 9.173889 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] sal tem aou oxygen phosphate_star 4.228709 9.173889 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] sal tem aou phosphate phosphate_star 4.228709 9.173889 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou oxygen phosphate 4.253487 9.202065 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou oxygen phosphate phosphate_star 4.253487 9.202065 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou oxygen phosphate_star 4.253487 9.202065 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou oxygen silicate phosphate 4.243043 9.162853 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou oxygen silicate phosphate_star 4.243043 9.162853 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou phosphate phosphate_star 4.253487 9.202065 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (26.75,27] tem aou silicate phosphate phosphate_star 4.243043 9.162853 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal aou oxygen silicate phosphate 4.049755 8.751922 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal aou oxygen silicate phosphate_star 4.049755 8.751922 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal aou silicate phosphate phosphate_star 4.049755 8.751922 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal tem aou oxygen phosphate 4.060442 8.751250 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal tem aou oxygen phosphate_star 4.060442 8.751250 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal tem aou phosphate phosphate_star 4.060442 8.751250 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] sal tem aou silicate phosphate 4.069790 8.777056 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] tem aou oxygen silicate phosphate 3.983696 8.633135 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] tem aou oxygen silicate phosphate_star 3.983696 8.633135 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27,27.25] tem aou silicate phosphate phosphate_star 3.983696 8.633135 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal aou oxygen silicate phosphate 3.253905 7.451890 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal aou oxygen silicate phosphate_star 3.253905 7.451890 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal aou silicate phosphate 3.299334 7.560463 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal aou silicate phosphate phosphate_star 3.253905 7.451890 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal tem aou silicate phosphate 3.257781 7.485243 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal tem aou silicate phosphate_star 3.265190 7.540092 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal tem oxygen silicate phosphate 3.263814 7.529337 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal tem oxygen silicate phosphate_star 3.263814 7.529337 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] sal tem silicate phosphate phosphate_star 3.263814 7.529337 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.25,27.5] tem aou silicate phosphate phosphate_star 3.523081 7.590607 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal aou oxygen silicate phosphate 3.049164 6.793925 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal aou oxygen silicate phosphate_star 3.049164 6.793925 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal aou silicate phosphate 3.192178 7.121087 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal aou silicate phosphate phosphate_star 3.049164 6.793925 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem aou silicate phosphate 3.048297 6.791454 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem aou silicate phosphate_star 3.048326 6.801608 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem oxygen silicate phosphate 3.048268 6.800439 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem oxygen silicate phosphate_star 3.048268 6.800439 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem silicate phosphate phosphate_star 3.048268 6.800439 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.5,27.75] sal tem silicate phosphate_star 3.135370 6.916235 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem aou silicate phosphate 2.918801 6.190708 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem aou silicate phosphate_star 2.910646 6.162704 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem oxygen silicate phosphate 2.910739 6.161407 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem oxygen silicate phosphate_star 2.910739 6.161407 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem silicate phosphate phosphate_star 2.910739 6.161407 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] sal tem silicate phosphate_star 2.911220 6.191703 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] tem aou oxygen silicate phosphate 2.964698 6.196344 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] tem aou oxygen silicate phosphate_star 2.964698 6.196344 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] tem aou silicate phosphate phosphate_star 2.964698 6.196344 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.75,27.85] tem oxygen silicate phosphate 2.968270 6.221983 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal aou oxygen silicate phosphate 2.935395 5.877770 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal aou oxygen silicate phosphate_star 2.935395 5.877770 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal tem aou silicate phosphate 2.917082 5.861625 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal tem aou silicate phosphate_star 2.908722 5.863722 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal tem oxygen silicate phosphate 2.908676 5.864860 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal tem oxygen silicate phosphate_star 2.908676 5.864860 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] sal tem silicate phosphate phosphate_star 2.908676 5.864860 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] tem aou oxygen silicate phosphate 2.934154 5.875776 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] tem aou oxygen silicate phosphate_star 2.934154 5.875776 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.85,27.95] tem aou silicate phosphate phosphate_star 2.934154 5.875776 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal aou oxygen silicate phosphate 3.078737 5.898810 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal aou oxygen silicate phosphate_star 3.078737 5.898810 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal aou silicate phosphate phosphate_star 3.078737 5.898810 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal tem aou oxygen phosphate 3.105644 5.938887 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal tem aou oxygen phosphate_star 3.105644 5.938887 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal tem aou phosphate phosphate_star 3.105644 5.938887 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] sal tem aou silicate phosphate 3.066183 5.918373 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] tem aou oxygen silicate phosphate 3.107979 5.935595 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] tem aou oxygen silicate phosphate_star 3.107979 5.935595 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (27.95,28.05] tem aou silicate phosphate phosphate_star 3.107979 5.935595 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou oxygen phosphate 2.895669 5.632681 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou oxygen phosphate phosphate_star 2.895669 5.632681 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou oxygen phosphate_star 2.895669 5.632681 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou oxygen silicate phosphate 2.892647 5.611336 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou oxygen silicate phosphate_star 2.892647 5.611336 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal aou silicate phosphate phosphate_star 2.892647 5.611336 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal tem aou oxygen phosphate 2.886269 5.622329 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal tem aou oxygen phosphate_star 2.886269 5.622329 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal tem aou phosphate phosphate_star 2.886269 5.622329 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.05,28.1] sal tem aou silicate phosphate 2.899626 5.625053 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] aou oxygen silicate phosphate 2.723831 5.826521 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] aou oxygen silicate phosphate phosphate_star 2.723831 5.826521 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] aou oxygen silicate phosphate_star 2.723831 5.826521 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] aou silicate phosphate phosphate_star 2.723831 5.826521 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] sal aou oxygen silicate phosphate 2.629551 5.728254 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] sal aou oxygen silicate phosphate_star 2.629551 5.728254 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] sal aou silicate phosphate phosphate_star 2.629551 5.728254 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] tem aou oxygen silicate phosphate 2.685645 5.729464 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] tem aou oxygen silicate phosphate_star 2.685645 5.729464 2000-2011 –> 2012-2019
Indo-Pacific 2012-2019 (28.1, Inf] tem aou silicate phosphate phosphate_star 2.685645 5.729464 2000-2011 –> 2012-2019

2.4 Correlations RMSE between eras

2.4.1 All models

max_rmse <-
  max(c(lm_all_stats_eras$rmse,
        lm_all_stats_eras$rmse_sum - lm_all_stats_eras$rmse))

lm_all_stats_eras %>%
  ggplot(aes(rmse, rmse_sum - rmse, col = gamma_slab)) +
  geom_point() +
  scale_color_viridis_d() +
  coord_equal(xlim = c(0,max_rmse),
              ylim = c(0,max_rmse)) +
  facet_grid(eras ~ basin)

Version Author Date
70bf1a5 jens-daniel-mueller 2020-12-07
7555355 jens-daniel-mueller 2020-12-07
143d6fa jens-daniel-mueller 2020-12-07
090e4d5 jens-daniel-mueller 2020-12-02
7c25f7a jens-daniel-mueller 2020-12-02
b03ddb8 jens-daniel-mueller 2020-12-02
91435ae jens-daniel-mueller 2020-12-01
196be51 jens-daniel-mueller 2020-11-30
rm(max_rmse)

2.4.2 Best models

max_rmse <-
  max(c(lm_best$rmse,
        lm_best$rmse_sum - lm_best$rmse))

lm_best %>%
  ggplot(aes(rmse, rmse_sum - rmse, col = gamma_slab)) +
  geom_point() +
  scale_color_viridis_d() +
  coord_equal(xlim = c(0,max_rmse),
              ylim = c(0,max_rmse)) +
  facet_grid(eras ~ basin)

Version Author Date
70bf1a5 jens-daniel-mueller 2020-12-07
7555355 jens-daniel-mueller 2020-12-07
143d6fa jens-daniel-mueller 2020-12-07
090e4d5 jens-daniel-mueller 2020-12-02
7c25f7a jens-daniel-mueller 2020-12-02
b03ddb8 jens-daniel-mueller 2020-12-02
91435ae jens-daniel-mueller 2020-12-01
196be51 jens-daniel-mueller 2020-11-30
rm(max_rmse)
# this code tests the rmse output of the ols_step_all_possible() function used
lm_1 <- GLODAP %>% 
  filter(basin == "Atlantic",
         gamma_slab == "(-Inf,26]",
         era == "new_era") %>% 
  lm(cstar ~ sal + tem + aou + oxygen + phosphate_star, data = .)

lm_2 <- GLODAP %>% 
  filter(basin == "Atlantic",
         gamma_slab == "(-Inf,26]",
         era == "new_era") %>% 
  lm(cstar ~ sal + tem + aou + oxygen + phosphate, data = .)

lm_1
lm_2

sqrt(mean(lm_1$residuals^2))
sqrt(mean(lm_2$residuals^2))

3 Fitting best models

After selecting 10 linear regression models with lowest summed RMSE across all eras, models are fitted again and model coefficients are saved to file.

# format model formula
lm_best <- lm_best %>% 
  mutate(lm_coeff = str_replace_all(predictors, " ", " + "),
         lm_coeff = paste("cstar ~", lm_coeff))


# create table with two era belonging to one eras
eras_forward <- lm_all_stats %>%
  arrange(era) %>% 
  group_by(basin, gamma_slab, predictors) %>% 
  mutate(eras = paste(era, lead(era), sep = " --> ")) %>% 
  ungroup() %>% 
  select(era, eras) %>% 
  unique()

eras_backward <- lm_all_stats %>%
  arrange(era) %>% 
  group_by(basin, gamma_slab, predictors) %>% 
  mutate(eras = paste(lag(era), era, sep = " --> ")) %>% 
  ungroup() %>% 
  select(era, eras) %>% 
  unique()

eras_era <- full_join(eras_backward, eras_forward) %>% 
  filter(str_detect(eras, "NA") == FALSE)

# extend best model selection from eras to era
lm_best <- lm_best %>% 
  select(-era)

lm_best <- full_join(lm_best, eras_era)
rm(eras_era, eras_forward, eras_backward, lm_all_stats, lm_all_stats_eras)
# select required columns
lm_best <- lm_best %>% 
  select(basin, gamma_slab, era, eras, predictors, lm_coeff, rmse_sum)

# run similar loop as for rmse calculation
# to get model coefficients for 10 best models
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_era <- lm_best %>%
      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_best_basin_era_slab <- lm_best_basin_era %>%
        filter(gamma_slab == i_gamma_slab)
      
      for (i_eras in unique(lm_best_basin_era_slab$eras)) {
        # i_eras <- unique(lm_best_basin_era_slab$eras)[1]
        lm_best_basin_era_slab_eras <- lm_best_basin_era_slab %>%
          filter(eras == i_eras)
        
        for (i_predictors in unique(lm_best_basin_era_slab_eras$predictors)) {
          # i_predictors <- unique(lm_best_basin_era_slab_eras$predictors)[2]
          print(i_predictors)
          
          lm_best_single <- lm_best_basin_era_slab_eras %>%
            filter(predictors == i_predictors) %>%
            select(lm_coeff) %>%
            pull()
          
          i_rmse_sum <- lm_best_basin_era_slab_eras %>%
            filter(predictors == i_predictors) %>%
            select(rmse_sum) %>%
            pull()
          
          lm_best_single_formula <- as.formula(lm_best_single)
          
          lm_fit_single <- lm(lm_best_single_formula,
                              data = GLODAP_basin_era_slab)
          

          # plotting model diagnostics
          if (params_local$plot_all_figures == "y") {
          
          p_model <- ggnostic(
            lm_fit_single,
            columnsY = c("cstar", ".fitted", ".resid"),
            title = paste("eras:", i_eras,
                          "| era:", i_era,
                          "| basin:", i_basin,
                          "| gamma slab:", i_gamma_slab,
                          "| predictors:", i_predictors)
          )

          ggsave(
            plot = p_model,
            path = paste(path_version_figures, "eMLR_diagnostics/", sep = ""),
            filename = paste(
              "MLR_residuals",
              i_eras,
              i_era,
              i_basin,
              i_gamma_slab,
              i_predictors,
              "predictors.png",
              sep = "_"
          ),
          width = 14,
          height = 8
          )
          
          rm(p_model)
          
          }

          # collect model coefficients in data frame
          coefficients <- tidy(lm_fit_single)
          coefficients <- coefficients %>%
            mutate(
              basin = i_basin,
              era = i_era,
              eras = i_eras,
              gamma_slab = i_gamma_slab,
              model = lm_best_single,
              rmse = i_rmse_sum
            )
          
          if (exists("lm_all")) {
            lm_all <- bind_rows(lm_all, coefficients)
          }
          
          if (!exists("lm_all")) {
            lm_all <- coefficients
          }
          
        }
        
        
      }
    }
    
  }
  
}


rm(lm_fit_single, coefficients, i_rmse_sum,
   GLODAP_basin_era, GLODAP_basin_era_slab,
   lm_best, lm_best_basin_era, lm_best_basin_era_slab, lm_best_basin_era_slab_eras,
   lm_best_single, lm_best_single_formula,
   i_basin, i_era, i_gamma_slab, i_predictors)

3.1 Predictor counts

The number of models where a particular predictor was included were counted for each basin, density slab and compared eras

lm_all_stats <- lm_all %>% 
  filter(term != "(Intercept)") %>% 
  group_by(basin, eras, gamma_slab) %>% 
  count(term) %>% 
  ungroup() %>% 
  pivot_wider(values_from = n, names_from = term)


lm_all_stats %>%
  gt(rowname_col = "gamma_slab",
     groupname_col = c("basin", "eras")) %>% 
  summary_rows(
    groups = TRUE,
    fns = list(total = "sum")
  )
aou oxygen phosphate phosphate_star sal silicate tem
Atlantic - 2000-2011 --> 2012-2019
(-Inf,26] 14 12 12 12 20 16 14
(26,26.5] 20 12 14 12 14 14 14
(26.5,26.75] 14 12 12 12 14 16 20
(26.75,27] 10 12 14 12 10 20 20
(27,27.25] 12 8 12 14 10 20 20
(27.25,27.5] 14 10 14 12 14 20 16
(27.5,27.75] 14 10 14 12 16 20 14
(27.75,27.85] 16 10 12 14 14 20 14
(27.85,27.95] 12 8 12 12 20 20 12
(27.95,28.05] 14 8 12 14 20 18 12
(28.05,28.1] 20 14 14 14 6 6 20
(28.1,28.15] 14 12 12 14 14 14 20
(28.15,28.2] 16 10 16 10 20 12 14
(28.2, Inf] 20 14 14 14 20 6 6
total 210.00 152.00 184.00 178.00 212.00 222.00 216.00
Indo-Pacific - 2000-2011 --> 2012-2019
(-Inf,26] 14 10 14 12 20 16 14
(26,26.5] 12 10 10 14 20 18 14
(26.5,26.75] 20 14 14 14 20 6 6
(26.75,27] 20 14 14 14 6 6 20
(27,27.25] 20 12 14 12 14 14 14
(27.25,27.5] 14 8 14 12 18 20 12
(27.5,27.75] 12 8 12 12 20 20 12
(27.75,27.85] 10 10 12 12 12 20 20
(27.85,27.95] 14 12 12 12 14 20 16
(27.95,28.05] 20 12 14 12 14 14 14
(28.05,28.1] 20 14 14 12 20 8 8
(28.1, Inf] 20 14 14 14 6 20 6
total 196.00 138.00 158.00 152.00 184.00 182.00 156.00

3.2 Prepare coeffcients

Coefficients are prepared for the mapping of cstar and cant.

# select relevant columns
lm_all <- lm_all %>% 
  select(basin, gamma_slab, era, eras, model, term, estimate)

# set coefficient to zero if not fitted (=NA)
lm_all <- lm_all %>% 
  mutate(estimate = if_else(is.na(estimate), 0, estimate))


# Prepare model coefficients for mapping of cstar
lm_all_cstar <- lm_all %>% 
  pivot_wider(values_from = estimate,
              names_from = term,
              names_prefix = "coeff_",
              values_fill = 0)


# Prepare model coefficients differences for mapping of cant
# this requires to subtract coefficients of adjacent era
lm_all_long <- lm_all %>% 
  arrange(era) %>% 
  group_by(basin, gamma_slab, eras, model, term) %>% 
  mutate(delta_coeff = estimate - lag(estimate)) %>% 
  ungroup() %>% 
  arrange(basin, gamma_slab, model, term, eras) %>% 
  drop_na() %>% 
  select(-c(era,estimate))


lm_all_cant <- lm_all_long %>%
  pivot_wider(values_from = delta_coeff,
              names_from = term,
              names_prefix = "delta_coeff_",
              values_fill = 0)

3.3 Write files

lm_all_cstar %>% write_csv(paste(path_version_data,
                                      "lm_all_cstar.csv",
                                      sep = ""))

lm_all_cant %>% write_csv(paste(path_version_data,
                                      "lm_all_cant.csv",
                                      sep = ""))

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: openSUSE Leap 15.1

Matrix products: default
BLAS:   /usr/local/R-4.0.3/lib64/R/lib/libRblas.so
LAPACK: /usr/local/R-4.0.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] gt_0.2.2         corrr_0.4.3      broom_0.7.2      kableExtra_1.3.1
 [5] knitr_1.30       olsrr_0.5.3.9000 GGally_2.0.0     lubridate_1.7.9 
 [9] metR_0.9.0       scico_1.2.0      patchwork_1.1.0  collapse_1.4.2  
[13] forcats_0.5.0    stringr_1.4.0    dplyr_1.0.2      purrr_0.3.4     
[17] readr_1.4.0      tidyr_1.1.2      tibble_3.0.4     ggplot2_3.3.2   
[21] tidyverse_1.3.0  workflowr_1.6.2 

loaded via a namespace (and not attached):
 [1] fs_1.5.0                 webshot_0.5.2            RColorBrewer_1.1-2      
 [4] httr_1.4.2               rprojroot_2.0.2          tools_4.0.3             
 [7] backports_1.1.10         R6_2.5.0                 nortest_1.0-4           
[10] DBI_1.1.0                colorspace_2.0-0         withr_2.3.0             
[13] gridExtra_2.3            tidyselect_1.1.0         curl_4.3                
[16] compiler_4.0.3           git2r_0.27.1             cli_2.2.0               
[19] rvest_0.3.6              xml2_1.3.2               sass_0.2.0              
[22] labeling_0.4.2           scales_1.1.1             checkmate_2.0.0         
[25] goftest_1.2-2            digest_0.6.27            foreign_0.8-80          
[28] rmarkdown_2.5            rio_0.5.16               pkgconfig_2.0.3         
[31] htmltools_0.5.0          highr_0.8                dbplyr_1.4.4            
[34] rlang_0.4.9              readxl_1.3.1             rstudioapi_0.13         
[37] farver_2.0.3             generics_0.0.2           jsonlite_1.7.1          
[40] zip_2.1.1                car_3.0-10               magrittr_2.0.1          
[43] Matrix_1.2-18            Rcpp_1.0.5               munsell_0.5.0           
[46] fansi_0.4.1              abind_1.4-5              lifecycle_0.2.0         
[49] stringi_1.5.3            whisker_0.4              yaml_2.2.1              
[52] carData_3.0-4            plyr_1.8.6               grid_4.0.3              
[55] blob_1.2.1               parallel_4.0.3           promises_1.1.1          
[58] crayon_1.3.4             lattice_0.20-41          haven_2.3.1             
[61] hms_0.5.3                pillar_1.4.7             reprex_0.3.0            
[64] glue_1.4.2               evaluate_0.14            RcppArmadillo_0.10.1.2.0
[67] data.table_1.13.2        modelr_0.1.8             vctrs_0.3.5             
[70] httpuv_1.5.4             cellranger_1.1.0         gtable_0.3.0            
[73] reshape_0.8.8            assertthat_0.2.1         xfun_0.18               
[76] openxlsx_4.2.3           RcppEigen_0.3.3.7.0      later_1.1.0.1           
[79] viridisLite_0.3.0        ellipsis_0.3.1           here_0.1