Load packages

library(conflicted)
library(MASS)
library(dplyr)
library(zooper)
library(lubridate)
library(readr)
library(tidyr)
library(ggplot2)
library(sf)
library(readxl)
library(stringr)
library(mgcv)
library(purrr)
library(deltamapr)
library(scales)
library(here)

conflict_prefer("filter", "dplyr")
conflict_prefer("select", "dplyr")

Load and wrangle data

zoop_data<-Zoopsynther(Data_type="Community", Sources=c("EMP", "STN", "20mm", "FMWT"), Time_consistency = FALSE)
## [1] "These species have no relatives in their size class common to all datasets and have been removed from one or more size classes: Ostracoda Adult (Meso), Cumacea Undifferentiated (Meso), Annelida Adult (Meso), Gammarus Adult (Meso), Orientomysis aspera Adult (Meso), Chironomidae Larva (Meso), Insecta Larva (Meso)"

Read in zoop mass conversions

zoop_mass_conversions<-read_excel(here("Data/SMSCG salinity modeling/Biomass conversions.xlsx"), sheet="Micro and Meso-zooplankton")%>%
  mutate(Taxname=case_when(Taxname=="Sinocalanus"~"Sinocalanus doerrii", # Change to help this match to zoop data
                           TRUE ~ Taxname),
         Taxlifestage=paste(Taxname, Lifestage))%>%
  select(Taxlifestage, CarbonWeight_ug)

Read in zoop groupings

zoop_groups<-read_csv(here("Data/zoopcrosswalk2.csv"), col_types=cols_only(Taxlifestage="c", IBMR="c"))%>%
  distinct()

Load Mysid biomass data

zoop_mysid<-read_excel(here("Data/1972-2020MysidBPUEMatrix.xlsx"), # EMP
                       sheet="Mysid_BPUE_matrix_1972-2020", na = "NA",
                       col_types = c(rep("numeric", 4), "date", "text", "text", rep("text", 7), rep("numeric", 8)))%>%
  select(Date=SampleDate, Station=StationNZ, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
  mutate(Source="EMP")%>%
  bind_rows(read_csv(here("Data/FMWT STN 2007to2019 Mysid BPUE.csv"), # FMWT/STN
                     col_types=cols_only(Station="c", SampleDate="c", Project="c", `Hyperacanthomysis longirostris`="d"))%>% 
              rename(Date=SampleDate, Source=Project, BPUE=`Hyperacanthomysis longirostris`)%>% # Only select Hyperacanthomysis longirostris
              mutate(Date=mdy(Date),
                     Station=recode(Station, MONT="Mont", HONK="Honk")))%>% #Get station names to match to main dataset
  mutate(BPUE_mysid=BPUE*1000, # Convert to ug
         Taxlifestage="Hyperacanthomysis longirostris Adult",
         SampleID=paste(Source, Station, Date),
         SizeClass="Macro")%>%
  select(SampleID, Taxlifestage, SizeClass, BPUE_mysid)

Start processing the zoop data

zoop_data_mass<-zoop_data%>%
  mutate(Taxlifestage=str_remove(Taxlifestage, fixed("_UnID")))%>%
  filter(
    !(SizeClass=="Meso" & #eliminating species which are counted in meso and micro and retained better in the micro net from the meso calcs
        
        Taxlifestage%in%c("Asplanchna Adult", "Copepoda Larva","Cyclopoida Juvenile", "Eurytemora Larva", "Harpacticoida Undifferentiated",
                          "Keratella Adult", "Limnoithona Adult", "Limnoithona Juvenile", "Limnoithona sinenesis Adult", "Limnoithona tetraspina
                                    Adult", "Oithona Adult", "Oithona Juvenile", "Oithona davisae Adult", "Polyarthra Adult","Pseudodiaptomus Larva", 
                          "Rotifera Adult", "Sinocalanus doerrii Larva", "Synchaeta Adult", "Synchaeta bicornis Adult", "Trichocerca Adult")) &
      
      !(SizeClass=="Micro" &Taxlifestage%in%c("Cirripedia Larva", "Cyclopoida Adult", "Oithona similis")) & #removing categories better retained in meso net from micro net matrix
      (is.na(Order) | Order!="Amphipoda") & # Remove amphipods
      (is.na(Order) | Order!="Mysida" | Taxlifestage=="Hyperacanthomysis longirostris Adult"))%>% #Only retain Hyperacanthomysis longirostris
  mutate(Taxlifestage=recode(Taxlifestage, `Synchaeta bicornis Adult`="Synchaeta Adult", # Change some names to match to biomass conversion dataset
                             `Pseudodiaptomus Adult`="Pseudodiaptomus forbesi Adult",
                             `Acanthocyclops vernalis Adult`="Acanthocyclops Adult"))%>%
  left_join(zoop_mass_conversions, by="Taxlifestage")%>% # Add biomass conversions
  left_join(zoop_mysid, by=c("SampleID", "Taxlifestage", "SizeClass"))%>% # Add mysid biomass
  left_join(zoop_groups, by="Taxlifestage")%>% # Add IBMR categories
  mutate(BPUE=if_else(Taxlifestage=="Hyperacanthomysis longirostris Adult", BPUE_mysid, CPUE*CarbonWeight_ug))%>% # Create 1 BPUE variable
  filter(!is.na(BPUE) & !is.na(Latitude) & !is.na(Longitude) & !is.na(SalSurf))%>% # Removes any data without BPUE, which is currently restricted to Rotifera Adult, Copepoda Larva, and H. longirostris from STN. Also removes 20mm and EMP EZ stations without coordinates
  group_by(IBMR)%>%
  mutate(flag=if_else(all(c("Micro", "Meso")%in%SizeClass), "Remove", "Keep"))%>% # This and the next 2 lines are meant to ensure that all categories are consistent across the surveys. Since only EMP samples microzoops, only EMP data can be used for categories that include both micro and mesozoops.
  ungroup()%>%
  filter(!(flag=="Remove" & Source!="EMP"))%>%
  select(SampleID, Station, Latitude, Longitude, SalSurf, Date, Year, IBMR, BPUE)%>%
  group_by(across(-BPUE))%>%
  summarise(BPUE=sum(BPUE), .groups="drop")%>% # Sum each IBMR categories
  st_as_sf(coords=c("Longitude", "Latitude"), crs=4326)%>%
  st_transform(crs=st_crs(deltamapr::R_DSIBM)) %>% 
  st_join(deltamapr::R_DSIBM %>%
            select(SUBREGION)) %>%
  st_drop_geometry() %>% 
  filter(SUBREGION %in% c("NW Suisun","SW Suisun","NE Suisun","SE Suisun","Confluence", "Suisun Marsh"))%>%
  mutate(doy=yday(Date), #Day of year
         Month=month(Date), # Month
         Year_fac=factor(Year), # Factor year for model random effect
         Station_fac=factor(Station), # Factor station for model random effect
         across(c(SalSurf, doy), list(s=~(.x-mean(.x))/sd(.x))), # Center and standardize predictors
         BPUE_log1p=log(BPUE+1)) # log1p transform BPUE for model

Check sample size

zoop_sample_size <- zoop_data_mass %>% 
  group_by(SampleID,Year,Month,SUBREGION,Station) %>% 
  summarise(BPUE=sum(BPUE)) %>% 
  mutate(Samplesize=1) %>%
  group_by(Year, Month, SUBREGION) %>% 
  summarise(mean_BPUE=mean(BPUE),Samplesize=sum(Samplesize)) %>%
  filter(Year>=1995)

ggplot(zoop_sample_size, aes(x=Year, y=Month, fill=Samplesize))+
  geom_tile()+
  scale_y_continuous(breaks=1:12, labels=month(1:12, label=T))+
  scale_fill_viridis_c(breaks=c(1,5,10,15,20))+
  facet_wrap(~SUBREGION)+
  theme_bw()

All the remaining brackish regions have sufficient sample size with the exception of NE Suisun. As such, NE Suisun is to be combined with SE Suisun while the rest of the regions are to be analyzed on their own.

Create a new column with IBMR edited regions to accomodate combination of NE and SE Suisun regions.

zoop_data_mass$Subregion_edit<-ifelse(zoop_data_mass$SUBREGION%in%c("NE Suisun", "SE Suisun"), "East Suisun", zoop_data_mass$SUBREGION)

Model

Prediction data

Set up prediction data for model

# Min year to start models
year_min<-1995

newdata_function<-function(region, data=zoop_data_mass, quant=0.99){
  
  lower<-(1-quant)/(2)
  upper<-1-lower
  
  data_filt<-data%>%
    filter(Subregion_edit%in%region & Year >= year_min)
  
  # Calculate monthly quantiles of salinity
  month_sal<-data_filt%>%
    group_by(Month)%>%
    summarise(l=quantile(SalSurf, lower),
              u=quantile(SalSurf, upper), .groups="drop")
  
  newdata<-expand_grid(date=mdy(paste(1:12, 15, 2001, sep="/")), # The 15th of each month on a non-leap year
                       SalSurf=seq(round(min(data_filt$SalSurf), 1), 
                                   round(max(data_filt$SalSurf), 1), by=0.1))%>% # Salinity sequence nicely rounded to 1 decimal
    mutate(Month=month(date),
           doy=yday(date), # Day of year
           SalSurf_s=(SalSurf-mean(data$SalSurf))/sd(data$SalSurf), # center and standardize salinity to match data
           doy_s=(doy-mean(data$doy))/sd(data$doy))%>% # center and standardize doy to match data
    left_join(month_sal, by="Month")%>%
    filter(SalSurf >= l & SalSurf <= u)%>% # Remove any salinity values outside the quantiles for each month
    select(Month, doy, doy_s, SalSurf, SalSurf_s)
  
}

newdata<-map(set_names(unique(zoop_data_mass$Subregion_edit)), newdata_function)

Posterior prediction function

# Function to generate posterior predictions from a gam model
# From https://stats.stackexchange.com/questions/190348/can-i-use-bootstrapping-to-estimate-the-uncertainty-in-a-maximum-value-of-a-gam
predict_posterior<-function(model, newdata, exclude, n=1e3, seed=999){
  Xp <- predict(model, newdata=newdata, type="lpmatrix", exclude=exclude, newdata.guaranteed=TRUE) ## map coefs to fitted curves
  beta <- coef(model)
  Vb   <- vcov(model) ## posterior mean and cov of coefs
  set.seed(seed)
  mrand <- mvrnorm(n, beta, Vb) ## simulate n rep coef vectors from posterior
  pred<-matrix(nrow=nrow(newdata), ncol=n)
  ilink <- family(model)$linkinv
  for (i in seq_len(n)) { 
    pred[,i]   <- ilink(Xp %*% mrand[i, ])
  }
  colnames(pred)<-paste("draw", 1:n, sep="_")
  pred<-as_tibble(pred)
  return(pred)
}

Model fitting

model

sal_model<-function(group,region,new_data=newdata){
  
  cat("<<<<<<<<<<<<<<<<<<<<<<< modeling", group, region, ">>>>>>>>>>>>>>>>>>>>>>>>>\n\n")
  
  new_data<-new_data[[region]]
  
  data<-filter(zoop_data_mass, IBMR==group & Subregion_edit==region & Year>=year_min)
  
  par(mfrow=c(2,2))
  
  if(length(unique(data$Station_fac))>1){
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re") + s(Station_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)", "s(Station_fac)")
    
  }else{
    
    model<-gam(BPUE_log1p ~ te(SalSurf_s, doy_s, k=c(5,5), bs=c("cs", "cc")) + 
                 s(Year_fac, bs="re"),
               data=data, 
               method="REML")
    
    random_effects<-c("s(Year_fac)")
  }
  
  cat("-------------gam check-------------\n")
  gam.check(model)
  
  cat("\n\n-------------summary-------------\n")
  print(summary(model))
  
  sal<-predict_posterior(model, new_data, random_effects)%>%
    bind_cols(new_data%>% # Add covariate columns before these columns
                select(-doy_s, -SalSurf_s), 
              .)
  return(sal)
}

Apply model to all groups and regions

model_factors<-expand_grid(IBMR=unique(zoop_data_mass$IBMR),
                           Subregion_edit=unique(zoop_data_mass$Subregion_edit))%>%
  mutate(IBMR=set_names(IBMR, paste(IBMR, Subregion_edit)))

sal_conversions<-pmap_dfr(model_factors, function(IBMR, Subregion_edit) sal_model(IBMR, Subregion_edit), .id = "IBMR_region")%>%
  mutate(IBMR=sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][1]),
         Region=factor(sapply(IBMR_region, function(x) str_split(x, " ", n=2)[[1]][2]),
                       levels=c("Confluence", "Suisun Marsh", "East Suisun", 
                                "NW Suisun", "SW Suisun")),
         Month=as.integer(Month))%>%
  select(-IBMR_region, -doy)%>%
  relocate(Region, Month, IBMR, SalSurf)
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0009170929,0.0007875523]
## (score 1730.771 & scale 2.616006).
## Hessian positive definite, eigenvalue range [1.342423,439.8853].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 13.11    0.98    0.24
## s(Year_fac)         28.00 23.72      NA      NA
## s(Station_fac)       5.00  3.62      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.7122     0.7226   3.754 0.000186 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 13.11     19 794.836 < 0.0000000000000002 ***
## s(Year_fac)         23.72     27   9.916 < 0.0000000000000002 ***
## s(Station_fac)       3.62      4  12.070            0.0000012 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.478   Deviance explained = 50.2%
## -REML = 1730.8  Scale est. = 2.616     n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 11 iterations.
## Gradient range [-0.000001206145,0.0000006103146]
## (score 2086.456 & scale 2.462597).
## Hessian positive definite, eigenvalue range [1.408909,536.8763].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 16.02    0.95    0.04 *
## s(Year_fac)         28.00 25.52      NA      NA  
## s(Station_fac)       5.00  3.66      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value     Pr(>|t|)    
## (Intercept)   2.6972     0.4851    5.56 0.0000000344 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 16.015     19 236.92 <0.0000000000000002 ***
## s(Year_fac)         25.516     27  21.41 <0.0000000000000002 ***
## s(Station_fac)       3.656      4  31.08 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.611   Deviance explained = 62.8%
## -REML = 2086.5  Scale est. = 2.4626    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00001940901,0.00001586249]
## (score 4148.471 & scale 2.40992).
## Hessian positive definite, eigenvalue range [2.728215,1085.712].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.46    0.87 <0.0000000000000002 ***
## s(Year_fac)         28.00 26.44      NA                  NA    
## s(Station_fac)      10.00  7.69      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    4.149      0.352   11.79 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 17.460     19 902.10 <0.0000000000000002 ***
## s(Year_fac)         26.435     27  50.54 <0.0000000000000002 ***
## s(Station_fac)       7.691      9  14.66 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.699   Deviance explained = 70.7%
## -REML = 4148.5  Scale est. = 2.4099    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0007115767,0.0005337382]
## (score 3830.95 & scale 1.893154).
## Hessian positive definite, eigenvalue range [2.64436,1071.708].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.86    0.92 <0.0000000000000002 ***
## s(Year_fac)         28.00 26.12      NA                  NA    
## s(Station_fac)      10.00  7.34      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.0351     0.2285   17.66 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.860     19 3458.87 <0.0000000000000002 ***
## s(Year_fac)         26.122     27   34.63 <0.0000000000000002 ***
## s(Station_fac)       7.343      9   12.75 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.814   Deviance explained = 81.8%
## -REML = 3830.9  Scale est. = 1.8932    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling acartela Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00003692586,0.00002931655]
## (score 3154.719 & scale 1.803668).
## Hessian positive definite, eigenvalue range [1.979754,892.7428].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.03    0.93 <0.0000000000000002 ***
## s(Year_fac)         28.00 26.10      NA                  NA    
## s(Station_fac)       8.00  5.53      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.5635     0.2191   16.27 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F             p-value    
## te(SalSurf_s,doy_s) 17.030     19 1717.891 <0.0000000000000002 ***
## s(Year_fac)         26.103     27   28.071 <0.0000000000000002 ***
## s(Station_fac)       5.528      7    9.201 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.793   Deviance explained = 79.9%
## -REML = 3154.7  Scale est. = 1.8037    n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.00005313728,0.00002650896]
## (score 1380.78 & scale 1.240564).
## Hessian positive definite, eigenvalue range [0.00005313543,439.7202].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000000 13.889105    0.85 <0.0000000000000002 ***
## s(Year_fac)         28.000000 16.907612      NA                  NA    
## s(Station_fac)       5.000000  0.000212      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  0.69553    0.06477   10.74 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.8891050     19 82.272 < 0.0000000000000002 ***
## s(Year_fac)         16.9076119     27  1.847           0.00000155 ***
## s(Station_fac)       0.0002124      4  0.000                0.611    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.578   Deviance explained = 59.3%
## -REML = 1380.8  Scale est. = 1.2406    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0001443584,0.000101751]
## (score 1665.672 & scale 1.174687).
## Hessian positive definite, eigenvalue range [1.057985,536.769].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.03     0.9 <0.0000000000000002 ***
## s(Year_fac)         28.00 20.87      NA                  NA    
## s(Station_fac)       5.00  2.41      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   0.9385     0.1135   8.271 0.000000000000000406 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 16.027     19 213.090 < 0.0000000000000002 ***
## s(Year_fac)         20.873     27   3.220 < 0.0000000000000002 ***
## s(Station_fac)       2.412      4   4.442             0.000168 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.697   Deviance explained = 70.8%
## -REML = 1665.7  Scale est. = 1.1747    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.002776364,0.01614734]
## (score 3544.361 & scale 1.425606).
## Hessian positive definite, eigenvalue range [0.003529646,1085.663].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                          k'     edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0000 17.0556    0.87 <0.0000000000000002 ***
## s(Year_fac)         28.0000 25.0323      NA                  NA    
## s(Station_fac)      10.0000  0.0903      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.3460     0.1052    12.8 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                          edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 17.05563     19 901.45 <0.0000000000000002 ***
## s(Year_fac)         25.03229     27  11.58 <0.0000000000000002 ***
## s(Station_fac)       0.09034      9   0.01               0.444    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.704   Deviance explained =   71%
## -REML = 3544.4  Scale est. = 1.4256    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00125077,0.001992025]
## (score 3950.097 & scale 2.17853).
## Hessian positive definite, eigenvalue range [0.001251247,1071.671].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00000 16.25757    0.85 <0.0000000000000002 ***
## s(Year_fac)         28.00000 24.52987      NA                  NA    
## s(Station_fac)      10.00000  0.00652      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8308     0.1149   15.93 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 16.257572     19 523.50 <0.0000000000000002 ***
## s(Year_fac)         24.529871     27  10.26 <0.0000000000000002 ***
## s(Station_fac)       0.006523      9   0.00                0.71    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.615   Deviance explained = 62.3%
## -REML = 3950.1  Scale est. = 2.1785    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling daphnia Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.003115112,0.002776406]
## (score 3060.218 & scale 1.685018).
## Hessian positive definite, eigenvalue range [1.650321,892.6881].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.98    0.92 <0.0000000000000002 ***
## s(Year_fac)         28.00 22.90      NA                  NA    
## s(Station_fac)       8.00  4.17      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   0.8766     0.1040   8.425 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.98     19 124.955 < 0.0000000000000002 ***
## s(Year_fac)         22.90     27   5.095 < 0.0000000000000002 ***
## s(Station_fac)       4.17      7   3.259            0.0000612 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.495   Deviance explained = 50.7%
## -REML = 3060.2  Scale est. = 1.685     n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00009026664,0.0000770262]
## (score 1678.902 & scale 2.436944).
## Hessian positive definite, eigenvalue range [1.454748,439.6365].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 13.27    0.95    0.05 *
## s(Year_fac)         28.00 11.62      NA      NA  
## s(Station_fac)       5.00  3.66      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)   2.9045     0.7167   4.053 0.0000553 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F             p-value    
## te(SalSurf_s,doy_s) 13.273     19 1232.626 <0.0000000000000002 ***
## s(Year_fac)         11.616     27    0.777              0.0101 *  
## s(Station_fac)       3.657      4   12.011 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.65   Deviance explained = 66.1%
## -REML = 1678.9  Scale est. = 2.4369    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0004186128,0.0003007133]
## (score 1995.305 & scale 2.168362).
## Hessian positive definite, eigenvalue range [0.1234876,536.7675].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 16.58    0.95   0.035 *
## s(Year_fac)         28.00 20.70      NA      NA  
## s(Station_fac)       5.00  0.81      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.8810     0.1069    17.6 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.5840     19 163.928 <0.0000000000000002 ***
## s(Year_fac)         20.7040     27   3.057 <0.0000000000000002 ***
## s(Station_fac)       0.8097      4   0.314               0.212    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.645   Deviance explained = 65.8%
## -REML = 1995.3  Scale est. = 2.1684    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0001771457,0.0001698712]
## (score 3948.074 & scale 2.068058).
## Hessian positive definite, eigenvalue range [1.367214,1085.668].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.13    0.77 <0.0000000000000002 ***
## s(Year_fac)         28.00 23.05      NA                  NA    
## s(Station_fac)      10.00  6.53      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.2095     0.1504   14.69 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 17.13     19 457.714 < 0.0000000000000002 ***
## s(Year_fac)         23.05     27   5.086 < 0.0000000000000002 ***
## s(Station_fac)       6.53      9   3.605            0.0000351 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.684   Deviance explained = 69.1%
## -REML = 3948.1  Scale est. = 2.0681    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 16 iterations.
## Gradient range [-0.002872656,0.003927675]
## (score 3986.964 & scale 2.250248).
## Hessian positive definite, eigenvalue range [0.09529293,1071.656].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 17.28    0.74 <0.0000000000000002 ***
## s(Year_fac)         28.00 23.05      NA                  NA    
## s(Station_fac)      10.00  1.04      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  2.29381    0.09321   24.61 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 17.280     19 282.876 <0.0000000000000002 ***
## s(Year_fac)         23.051     27   6.104 <0.0000000000000002 ***
## s(Station_fac)       1.042      9   0.142               0.289    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.669   Deviance explained = 67.5%
## -REML =   3987  Scale est. = 2.2502    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling eurytem Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.002713304,0.001997683]
## (score 3455.755 & scale 2.60385).
## Hessian positive definite, eigenvalue range [1.184171,892.7007].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.41    0.77 <0.0000000000000002 ***
## s(Year_fac)         28.00 23.57      NA                  NA    
## s(Station_fac)       8.00  5.88      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.2309     0.1955   16.53 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.408     19 484.643 <0.0000000000000002 ***
## s(Year_fac)         23.569     27   6.138 <0.0000000000000002 ***
## s(Station_fac)       5.885      7  13.745 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.709   Deviance explained = 71.6%
## -REML = 3455.8  Scale est. = 2.6039    n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00000110061,0.0000009558118]
## (score 1765.855 & scale 2.931646).
## Hessian positive definite, eigenvalue range [1.445007,439.7816].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 13.21    1.01    0.59
## s(Year_fac)         28.00 19.84      NA      NA
## s(Station_fac)       5.00  2.87      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.5363     0.3642   17.95 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.206     19 115.558 <0.0000000000000002 ***
## s(Year_fac)         19.836     27   3.367 <0.0000000000000002 ***
## s(Station_fac)       2.865      4  29.474 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.403   Deviance explained = 42.7%
## -REML = 1765.9  Scale est. = 2.9316    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0005205248,0.0003439632]
## (score 1947.714 & scale 2.036778).
## Hessian positive definite, eigenvalue range [1.695345,536.609].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 14.57    0.94    0.01 **
## s(Year_fac)         28.00 10.50      NA      NA   
## s(Station_fac)       5.00  3.91      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value         Pr(>|t|)    
## (Intercept)   5.4338     0.7873   6.902 0.00000000000889 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.569     19 547.093 <0.0000000000000002 ***
## s(Year_fac)         10.501     27   0.688              0.0141 *  
## s(Station_fac)       3.906      4  27.279 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.42   Deviance explained = 43.5%
## -REML = 1947.7  Scale est. = 2.0368    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000004831961,0.000004008069]
## (score 4223.403 & scale 2.70773).
## Hessian positive definite, eigenvalue range [1.788059,1085.647].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.46    0.92 <0.0000000000000002 ***
## s(Year_fac)         28.00 22.15      NA                  NA    
## s(Station_fac)      10.00  6.04      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.3118     0.1453   36.57 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.457     19 127.342 <0.0000000000000002 ***
## s(Year_fac)         22.153     27   5.375 <0.0000000000000002 ***
## s(Station_fac)       6.035      9   7.178 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.347   Deviance explained =   36%
## -REML = 4223.4  Scale est. = 2.7077    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000008710303,0.0000002761191]
## (score 4347.677 & scale 3.123892).
## Hessian positive definite, eigenvalue range [1.080052,1071.689].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.35    0.87 <0.0000000000000002 ***
## s(Year_fac)         28.00 25.46      NA                  NA    
## s(Station_fac)      10.00  4.65      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2327     0.1868   22.66 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 16.355     19 279.785 < 0.0000000000000002 ***
## s(Year_fac)         25.456     27  17.278 < 0.0000000000000002 ***
## s(Station_fac)       4.649      9   1.663              0.00463 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.569   Deviance explained = 57.9%
## -REML = 4347.7  Scale est. = 3.1239    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcalad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0001103899,0.0001007544]
## (score 3524.54 & scale 2.793997).
## Hessian positive definite, eigenvalue range [2.300091,892.7047].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.78    0.92 <0.0000000000000002 ***
## s(Year_fac)         28.00 23.49      NA                  NA    
## s(Station_fac)       8.00  5.54      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2402     0.1807      29 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.776     19 218.092 <0.0000000000000002 ***
## s(Year_fac)         23.488     27   8.372 <0.0000000000000002 ***
## s(Station_fac)       5.538      7  10.652 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.521   Deviance explained = 53.3%
## -REML = 3524.5  Scale est. = 2.794     n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0008135116,0.0002538109]
## (score 1445.234 & scale 1.391752).
## Hessian positive definite, eigenvalue range [1.0725,439.793].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00 14.91       1    0.45
## s(Year_fac)         28.00 19.59      NA      NA
## s(Station_fac)       5.00  3.36      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   7.2326     0.3777   19.15 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.912     19 119.399          0.000000897 ***
## s(Year_fac)         19.591     27   2.631 < 0.0000000000000002 ***
## s(Station_fac)       3.358      4  13.487 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.303   Deviance explained = 33.3%
## -REML = 1445.2  Scale est. = 1.3918    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0000004921892,0.0000004548085]
## (score 1650.722 & scale 1.119079).
## Hessian positive definite, eigenvalue range [0.1972083,536.8415].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 15.83    0.96    0.03 *
## s(Year_fac)         28.00 24.24      NA      NA  
## s(Station_fac)       5.00  2.71      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    6.696      0.153   43.76 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 15.828     19 81.948 < 0.0000000000000002 ***
## s(Year_fac)         24.237     27  8.338 < 0.0000000000000002 ***
## s(Station_fac)       2.708      4  3.784              0.00201 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.476   Deviance explained = 49.7%
## -REML = 1650.7  Scale est. = 1.1191    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.000008148751,0.000008008423]
## (score 3436.878 & scale 1.305814).
## Hessian positive definite, eigenvalue range [1.953746,1085.632].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.44    0.88 <0.0000000000000002 ***
## s(Year_fac)         28.00 19.66      NA                  NA    
## s(Station_fac)      10.00  6.43      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.2333     0.1053   59.22 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.443     19 212.842 <0.0000000000000002 ***
## s(Year_fac)         19.658     27   2.829 <0.0000000000000002 ***
## s(Station_fac)       6.429      9   6.833 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.486   Deviance explained = 49.6%
## -REML = 3436.9  Scale est. = 1.3058    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 13 iterations.
## Gradient range [-0.0003478319,0.0002293254]
## (score 3175.041 & scale 1.053499).
## Hessian positive definite, eigenvalue range [2.569585,1071.668].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.06    0.76 <0.0000000000000002 ***
## s(Year_fac)         28.00 23.12      NA                  NA    
## s(Station_fac)      10.00  7.18      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.2521     0.1129   55.39 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.056     19 803.570 <0.0000000000000002 ***
## s(Year_fac)         23.117     27   6.683 <0.0000000000000002 ***
## s(Station_fac)       7.182      9  14.445 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.654   Deviance explained = 66.1%
## -REML =   3175  Scale est. = 1.0535    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcaljuv Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0003452575,0.0002809761]
## (score 2765.36 & scale 1.195782).
## Hessian positive definite, eigenvalue range [2.237014,892.6731].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.68    0.92 <0.0000000000000002 ***
## s(Year_fac)         28.00 20.67      NA                  NA    
## s(Station_fac)       8.00  6.76      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.4269     0.2605   24.67 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.678     19 177.887 <0.0000000000000002 ***
## s(Year_fac)         20.670     27   3.598 <0.0000000000000002 ***
## s(Station_fac)       6.762      7  55.419 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.458   Deviance explained = 47.1%
## -REML = 2765.4  Scale est. = 1.1958    n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0002475734,0.0001421556]
## (score 1333.246 & scale 1.094582).
## Hessian positive definite, eigenvalue range [0.0002475605,439.8176].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value
## te(SalSurf_s,doy_s) 19.000000 11.746823    1.01    0.56
## s(Year_fac)         28.000000 21.837978      NA      NA
## s(Station_fac)       5.000000  0.000933      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  1.08664    0.08748   12.42 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 11.7468229     19 230.715 <0.0000000000000002 ***
## s(Year_fac)         21.8379776     27   3.944 <0.0000000000000002 ***
## s(Station_fac)       0.0009334      4   0.000               0.628    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.71   Deviance explained = 72.1%
## -REML = 1333.2  Scale est. = 1.0946    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.001109391,0.0009161378]
## (score 1565.784 & scale 0.9757542).
## Hessian positive definite, eigenvalue range [0.8527283,536.7975].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.93    0.86 <0.0000000000000002 ***
## s(Year_fac)         28.00 22.74      NA                  NA    
## s(Station_fac)       5.00  2.28      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.2128     0.1085   11.18 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 13.94     19 480.262 < 0.0000000000000002 ***
## s(Year_fac)         22.74     27   5.213 < 0.0000000000000002 ***
## s(Station_fac)       2.28      4   3.358              0.00132 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.773   Deviance explained = 78.1%
## -REML = 1565.8  Scale est. = 0.97575   n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00003101132,0.00002714871]
## (score 3308.63 & scale 1.140333).
## Hessian positive definite, eigenvalue range [0.9003783,1085.69].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.31    0.84 <0.0000000000000002 ***
## s(Year_fac)         28.00 25.56      NA                  NA    
## s(Station_fac)      10.00  4.69      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.7657     0.1194   14.79 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df        F              p-value    
## te(SalSurf_s,doy_s) 16.310     19 2347.378 < 0.0000000000000002 ***
## s(Year_fac)         25.555     27   16.898 < 0.0000000000000002 ***
## s(Station_fac)       4.694      9    2.048              0.00167 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.776   Deviance explained = 78.1%
## -REML = 3308.6  Scale est. = 1.1403    n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001310917,0.001036225]
## (score 3541.261 & scale 1.485982).
## Hessian positive definite, eigenvalue range [1.684147,1071.681].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.08     0.9 <0.0000000000000002 ***
## s(Year_fac)         28.00 25.01      NA                  NA    
## s(Station_fac)      10.00  6.82      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.8440     0.1409   20.18 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.077     19 1759.84 <0.0000000000000002 ***
## s(Year_fac)         25.006     27   14.33 <0.0000000000000002 ***
## s(Station_fac)       6.818      9   11.79 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.695   Deviance explained = 70.1%
## -REML = 3541.3  Scale est. = 1.486     n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling othclad Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.001111214,0.0007122973]
## (score 2874.657 & scale 1.355514).
## Hessian positive definite, eigenvalue range [1.748993,892.7126].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 13.63    0.96   0.045 *
## s(Year_fac)         28.00 24.83      NA      NA  
## s(Station_fac)       8.00  5.82      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.3241     0.1519   8.717 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 13.631     19 501.82 <0.0000000000000002 ***
## s(Year_fac)         24.830     27  11.76 <0.0000000000000002 ***
## s(Station_fac)       5.824      7  15.51 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.565   Deviance explained = 57.5%
## -REML = 2874.7  Scale est. = 1.3555    n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.0007664217,0.0006716275]
## (score 1695.621 & scale 2.443762).
## Hessian positive definite, eigenvalue range [0.6693566,439.8466].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 13.62    0.96   0.045 *
## s(Year_fac)         28.00 22.23      NA      NA  
## s(Station_fac)       5.00  3.06      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value           Pr(>|t|)    
## (Intercept)    3.079      0.395   7.794 0.0000000000000192 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 13.620     19 642.702 < 0.0000000000000002 ***
## s(Year_fac)         22.229     27   4.258 < 0.0000000000000002 ***
## s(Station_fac)       3.059      4   5.272             0.000812 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.585   Deviance explained = 60.3%
## -REML = 1695.6  Scale est. = 2.4438    n = 880
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00002930937,0.00003251366]
## (score 1988.072 & scale 2.17128).
## Hessian positive definite, eigenvalue range [0.00002931045,536.7931].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000000 10.268134    0.95    0.01 **
## s(Year_fac)         28.000000 23.320477      NA      NA   
## s(Station_fac)       5.000000  0.000199      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   3.3028     0.1325   24.93 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 10.268134     19 196.490 <0.0000000000000002 ***
## s(Year_fac)         23.320477     27   5.405 <0.0000000000000002 ***
## s(Station_fac)       0.000199      4   0.000               0.508    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.616   Deviance explained = 62.8%
## -REML = 1988.1  Scale est. = 2.1713    n = 1074
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.001154106,0.001110304]
## (score 4065.752 & scale 2.317953).
## Hessian positive definite, eigenvalue range [1.629925,1085.675].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 13.90    0.81 <0.0000000000000002 ***
## s(Year_fac)         28.00 24.48      NA                  NA    
## s(Station_fac)      10.00  6.42      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2228     0.1703    24.8 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 13.901     19 905.582 <0.0000000000000002 ***
## s(Year_fac)         24.476     27   9.701 <0.0000000000000002 ***
## s(Station_fac)       6.423      9   7.460 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.667   Deviance explained = 67.3%
## -REML = 4065.8  Scale est. = 2.318     n = 2172
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 12 iterations.
## Gradient range [-0.00001822404,0.00001686391]
## (score 3989.853 & scale 2.259605).
## Hessian positive definite, eigenvalue range [1.479661,1071.676].
## Model rank =  58 / 58 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 14.20    0.69 <0.0000000000000002 ***
## s(Year_fac)         28.00 24.44      NA                  NA    
## s(Station_fac)      10.00  6.52      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.9444     0.1525   38.99 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 14.203     19 527.558 <0.0000000000000002 ***
## s(Year_fac)         24.439     27   9.954 <0.0000000000000002 ***
## s(Station_fac)       6.523      9   7.142 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.699   Deviance explained = 70.6%
## -REML = 3989.9  Scale est. = 2.2596    n = 2144
## <<<<<<<<<<<<<<<<<<<<<<< modeling pdiapfor Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0002335782,0.0001741052]
## (score 3253.216 & scale 2.022225).
## Hessian positive definite, eigenvalue range [1.188887,892.7374].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 16.47     0.9 <0.0000000000000002 ***
## s(Year_fac)         28.00 25.62      NA                  NA    
## s(Station_fac)       8.00  6.44      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.1801     0.2655   19.51 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df       F             p-value    
## te(SalSurf_s,doy_s) 16.47     19 2202.52 <0.0000000000000002 ***
## s(Year_fac)         25.62     27   17.25 <0.0000000000000002 ***
## s(Station_fac)       6.44      7   30.42 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.698   Deviance explained = 70.6%
## -REML = 3253.2  Scale est. = 2.0222    n = 1786
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.0001218611,0.0001338777]
## (score 626.4337 & scale 2.627281).
## Hessian positive definite, eigenvalue range [0.0001218792,158.517].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value
## te(SalSurf_s,doy_s) 19.000000  7.458863    1.14       1
## s(Year_fac)         27.000000 16.996577      NA      NA
## s(Station_fac)       3.000000  0.000514      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   1.3653     0.1588   8.599 0.000000000000000502 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  7.458863     19 12.277 < 0.0000000000000002 ***
## s(Year_fac)         16.996577     26  1.952           0.00000371 ***
## s(Station_fac)       0.000514      2  0.000                 0.55    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.39   Deviance explained = 43.7%
## -REML = 626.43  Scale est. = 2.6273    n = 317
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000009243147,0.000001259638]
## (score 646.3905 & scale 3.1024).
## Hessian positive definite, eigenvalue range [0.8984986,155.2844].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0  7.8    0.95    0.12
## s(Year_fac)         27.0 20.8      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value          Pr(>|t|)    
## (Intercept)   1.7455     0.2292   7.615 0.000000000000406 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s)  7.80     19 13.147 <0.0000000000000002 ***
## s(Year_fac)         20.79     26  4.061 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.44   Deviance explained = 49.2%
## -REML = 646.39  Scale est. = 3.1024    n = 310
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.000007499786,-0.0000001106973]
## (score 1323.751 & scale 2.697066).
## Hessian positive definite, eigenvalue range [0.3087737,334.4007].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 11.94    0.95   0.025 *
## s(Year_fac)         27.00 21.21      NA      NA  
## s(Station_fac)       4.00  1.52      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   1.9571     0.1994   9.817 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 11.939     19 41.805 <0.0000000000000002 ***
## s(Year_fac)         21.212     26  4.360 <0.0000000000000002 ***
## s(Station_fac)       1.521      3  1.538              0.0487 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.502   Deviance explained = 52.8%
## -REML = 1323.8  Scale est. = 2.6971    n = 669
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0003215838,0.001616097]
## (score 1404.98 & scale 2.964505).
## Hessian positive definite, eigenvalue range [0.0003265852,347.3799].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                          k'     edf k-index p-value   
## te(SalSurf_s,doy_s) 19.0000 10.9212    0.93    0.01 **
## s(Year_fac)         27.0000 21.4066      NA      NA   
## s(Station_fac)       5.0000  0.0044      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   2.4085     0.1607   14.99 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                           edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 10.921152     19 34.558 <0.0000000000000002 ***
## s(Year_fac)         21.406627     26  4.658 <0.0000000000000002 ***
## s(Station_fac)       0.004396      4  0.001               0.391    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.477   Deviance explained = 50.1%
## -REML =   1405  Scale est. = 2.9645    n = 695
## <<<<<<<<<<<<<<<<<<<<<<< modeling allcopnaup Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.000297875,0.00006039964]
## (score 1366.52 & scale 4.182628).
## Hessian positive definite, eigenvalue range [0.0002977048,310.4781].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value  
## te(SalSurf_s,doy_s) 19.000000  7.676102    0.94    0.04 *
## s(Year_fac)         27.000000 23.310881      NA      NA  
## s(Station_fac)       2.000000  0.000717      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value             Pr(>|t|)    
## (Intercept)   2.1816     0.2619   8.331 0.000000000000000563 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s)  7.6761019     19 14.44 <0.0000000000000002 ***
## s(Year_fac)         23.3108813     26  8.87 <0.0000000000000002 ***
## s(Station_fac)       0.0007166      1  0.00               0.681    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.392   Deviance explained = 42.2%
## -REML = 1366.5  Scale est. = 4.1826    n = 621
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.00005651404,0.00005859625]
## (score 681.6302 & scale 3.422221).
## Hessian positive definite, eigenvalue range [0.00004508318,161.4539].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value   
## te(SalSurf_s,doy_s) 19.000000  9.333769    0.88   0.005 **
## s(Year_fac)         27.000000 15.551463      NA      NA   
## s(Station_fac)       3.000000  0.000172      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.6536     0.1665   33.96 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s)  9.3337692     19 7.302 < 0.0000000000000002 ***
## s(Year_fac)         15.5514628     26 1.494             0.000107 ***
## s(Station_fac)       0.0001718      2 0.000             0.583339    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.343   Deviance explained = 39.4%
## -REML = 681.63  Scale est. = 3.4222    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0003405178,0.0002167835]
## (score 600.3333 & scale 2.201127).
## Hessian positive definite, eigenvalue range [1.592647,156.5486].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index p-value
## te(SalSurf_s,doy_s) 19.0 11.7    0.98     0.3
## s(Year_fac)         27.0 16.2      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.4074     0.1397   45.85 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df     F              p-value    
## te(SalSurf_s,doy_s) 11.75     19 46.76 < 0.0000000000000002 ***
## s(Year_fac)         16.17     26  1.67            0.0000324 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   73%
## -REML = 600.33  Scale est. = 2.2011    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.000000239289,0.0000001464564]
## (score 1236.472 & scale 1.965841).
## Hessian positive definite, eigenvalue range [0.8025186,335.9462].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.16    0.85 <0.0000000000000002 ***
## s(Year_fac)         27.00 21.43      NA                  NA    
## s(Station_fac)       4.00  2.32      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)    6.765      0.245   27.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 15.158     19 123.851 < 0.0000000000000002 ***
## s(Year_fac)         21.432     26   4.426 < 0.0000000000000002 ***
## s(Station_fac)       2.319      3   5.541             0.000576 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.703   Deviance explained =   72%
## -REML = 1236.5  Scale est. = 1.9658    n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.00004884064,0.000008055068]
## (score 1346.053 & scale 2.325187).
## Hessian positive definite, eigenvalue range [1.009779,350.4133].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00 14.78    0.95    0.09 .
## s(Year_fac)         27.00 21.16      NA      NA  
## s(Station_fac)       5.00  2.34      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.4573     0.2244   24.32 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df       F              p-value    
## te(SalSurf_s,doy_s) 14.784     19 187.882 < 0.0000000000000002 ***
## s(Year_fac)         21.155     26   4.447 < 0.0000000000000002 ***
## s(Station_fac)       2.337      4   5.369            0.0000309 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.748   Deviance explained = 76.2%
## -REML = 1346.1  Scale est. = 2.3252    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling limno Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001770403,0.000001619472]
## (score 1260.551 & scale 2.853194).
## Hessian positive definite, eigenvalue range [0.472618,313.8114].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 13.889    0.96    0.13
## s(Year_fac)         27.000 16.907      NA      NA
## s(Station_fac)       2.000  0.973      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.8838     0.4269   13.78 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.8895     19 92.212 < 0.0000000000000002 ***
## s(Year_fac)         16.9071     26  1.801           0.00000818 ***
## s(Station_fac)       0.9731      1 36.476 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.693   Deviance explained = 70.8%
## -REML = 1260.6  Scale est. = 2.8532    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0003850967,0.0002974669]
## (score 800.589 & scale 4.432278).
## Hessian positive definite, eigenvalue range [0.1906857,177.1153].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000 10.192    1.03    0.71
## s(Year_fac)         26.000 19.153      NA      NA
## s(Station_fac)       4.000  0.968      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.3767     0.3914   11.18 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 10.1924     19 25.218 <0.0000000000000002 ***
## s(Year_fac)         19.1528     25  3.255 <0.0000000000000002 ***
## s(Station_fac)       0.9676      3  0.933                0.12    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.544   Deviance explained = 58.3%
## -REML = 800.59  Scale est. = 4.4323    n = 354
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0000008772582,0.0000008332563]
## (score 905.1353 & scale 3.788971).
## Hessian positive definite, eigenvalue range [0.927108,208.44].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00  9.72    0.93   0.045 *
## s(Year_fac)         26.00 17.38      NA      NA  
## s(Station_fac)       4.00  2.94      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value  Pr(>|t|)    
## (Intercept)    4.450      1.089   4.084 0.0000538 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  9.717     19 12.094              0.00571 ** 
## s(Year_fac)         17.383     25  2.461 < 0.0000000000000002 ***
## s(Station_fac)       2.942      3 93.494 < 0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.498   Deviance explained = 53.4%
## -REML = 905.14  Scale est. = 3.789     n = 417
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0009278945,0.0005095288]
## (score 1797.217 & scale 3.738696).
## Hessian positive definite, eigenvalue range [2.018086,417.8264].
## Model rank =  56 / 56 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 14.78    0.92    0.01 **
## s(Year_fac)         26.00 19.00      NA      NA   
## s(Station_fac)      10.00  8.11      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2058     0.4966   10.48 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.785     19 66.931 <0.0000000000000002 ***
## s(Year_fac)         18.997     25  3.894 <0.0000000000000002 ***
## s(Station_fac)       8.105      9 15.436 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.52   Deviance explained = 54.4%
## -REML = 1797.2  Scale est. = 3.7387    n = 836
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 5 iterations.
## Gradient range [-0.0005055385,0.0003473337]
## (score 1647.357 & scale 3.17049).
## Hessian positive definite, eigenvalue range [2.158402,397.3703].
## Model rank =  55 / 55 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.00 15.08    0.92 <0.0000000000000002 ***
## s(Year_fac)         26.00 20.56      NA                  NA    
## s(Station_fac)       9.00  5.98      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   4.2493     0.3046   13.95 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.081     19 94.522 <0.0000000000000002 ***
## s(Year_fac)         20.563     25  4.866 <0.0000000000000002 ***
## s(Station_fac)       5.975      8  8.510 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.564   Deviance explained = 58.7%
## -REML = 1647.4  Scale est. = 3.1705    n = 795
## <<<<<<<<<<<<<<<<<<<<<<< modeling mysid Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000000295379,0.0000002097751]
## (score 1484.766 & scale 3.363607).
## Hessian positive definite, eigenvalue range [1.725115,350.4737].
## Model rank =  53 / 53 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 14.96    0.92   0.005 **
## s(Year_fac)         26.00 22.50      NA      NA   
## s(Station_fac)       7.00  5.46      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.2432     0.6501   8.065 0.00000000000000347 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 14.965     19 73.968 <0.0000000000000002 ***
## s(Year_fac)         22.501     25  8.827 <0.0000000000000002 ***
## s(Station_fac)       5.455      6 18.013 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.482   Deviance explained = 51.4%
## -REML = 1484.8  Scale est. = 3.3636    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 13 iterations.
## Gradient range [-0.0002764003,0.001354068]
## (score 544.7388 & scale 1.639363).
## Hessian positive definite, eigenvalue range [0.0002765043,161.0236].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value
## te(SalSurf_s,doy_s) 19.00000  4.94606    0.98    0.29
## s(Year_fac)         27.00000  0.00327      NA      NA
## s(Station_fac)       3.00000  0.34272      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.7176     0.1956   34.35 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                          edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s) 4.946064     19 2.578 <0.0000000000000002 ***
## s(Year_fac)         0.003272     26 0.000               0.694    
## s(Station_fac)      0.342718      2 0.215               0.263    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.132   Deviance explained = 14.6%
## -REML = 544.74  Scale est. = 1.6394    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 6 iterations.
## Gradient range [-0.000003658726,0.00000007542045]
## (score 521.3249 & scale 1.443972).
## Hessian positive definite, eigenvalue range [0.3782888,156.3477].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  7.57    0.96     0.2
## s(Year_fac)         27.00 13.57      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  7.12207    0.09958   71.52 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df    F    p-value    
## te(SalSurf_s,doy_s)  7.566     19 2.91 0.00000323 ***
## s(Year_fac)         13.572     26 1.12     0.0012 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =    0.2   Deviance explained = 25.4%
## -REML = 521.32  Scale est. = 1.444     n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.0000003757979,0.00000004154148]
## (score 950.8421 & scale 0.8857205).
## Hessian positive definite, eigenvalue range [0.1253222,335.8621].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value   
## te(SalSurf_s,doy_s) 19.00 10.64    0.91   0.005 **
## s(Year_fac)         27.00 20.44      NA      NA   
## s(Station_fac)       4.00  1.13      NA      NA   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  6.69141    0.09706   68.94 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                       edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 10.64     19 10.156 <0.0000000000000002 ***
## s(Year_fac)         20.44     26  3.932 <0.0000000000000002 ***
## s(Station_fac)       1.13      3  0.795               0.122    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =   0.29   Deviance explained = 32.4%
## -REML = 950.84  Scale est. = 0.88572   n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 7 iterations.
## Gradient range [-0.000001215975,0.0000006698351]
## (score 1185.185 & scale 1.558843).
## Hessian positive definite, eigenvalue range [0.84159,350.3071].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                        k'   edf k-index p-value
## te(SalSurf_s,doy_s) 19.00  9.80       1    0.56
## s(Year_fac)         27.00 19.25      NA      NA
## s(Station_fac)       5.00  1.92      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.1623     0.1413   43.62 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  9.798     19 13.331 < 0.0000000000000002 ***
## s(Year_fac)         19.254     26  2.877 < 0.0000000000000002 ***
## s(Station_fac)       1.918      4  3.211              0.00061 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.278   Deviance explained =   31%
## -REML = 1185.2  Scale est. = 1.5588    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling othcyc Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.000007110302,0.000002166729]
## (score 949.5123 & scale 1.100501).
## Hessian positive definite, eigenvalue range [0.440909,313.748].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                         k'    edf k-index p-value
## te(SalSurf_s,doy_s) 19.000  9.614    0.96    0.21
## s(Year_fac)         27.000 16.120      NA      NA
## s(Station_fac)       2.000  0.946      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   7.3649     0.1898    38.8 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                         edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s)  9.6144     19  5.962 < 0.0000000000000002 ***
## s(Year_fac)         16.1204     26  1.615            0.0000270 ***
## s(Station_fac)       0.9463      1 17.689            0.0000184 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.191   Deviance explained = 22.6%
## -REML = 949.51  Scale est. = 1.1005    n = 628
## <<<<<<<<<<<<<<<<<<<<<<< modeling other SW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 10 iterations.
## Gradient range [-0.00004598597,0.00001909747]
## (score 485.8023 & scale 1.015095).
## Hessian positive definite, eigenvalue range [0.00004598205,161.4582].
## Model rank =  50 / 50 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index p-value
## te(SalSurf_s,doy_s) 19.000000  7.595815    0.98    0.32
## s(Year_fac)         27.000000 15.630590      NA      NA
## s(Station_fac)       3.000000  0.000146      NA      NA
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  7.70223    0.09046   85.15 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F     p-value    
## te(SalSurf_s,doy_s)  7.5958152     19 4.167 0.000000516 ***
## s(Year_fac)         15.6305898     26 1.607 0.000032234 ***
## s(Station_fac)       0.0001457      2 0.000       0.654    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.262   Deviance explained = 31.6%
## -REML =  485.8  Scale est. = 1.0151    n = 323
## <<<<<<<<<<<<<<<<<<<<<<< modeling other NW Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 19 iterations.
## Gradient range [-0.00001402973,0.0009424418]
## (score 546.4557 & scale 1.847335).
## Hessian positive definite, eigenvalue range [0.00001414472,156.0349].
## Model rank =  47 / 47 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                           k'      edf k-index p-value  
## te(SalSurf_s,doy_s) 19.00000  4.70287    0.91   0.075 .
## s(Year_fac)         27.00000  0.00265      NA      NA  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)  6.98191    0.07683   90.88 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                          edf Ref.df   F             p-value    
## te(SalSurf_s,doy_s) 4.702875     19 2.1 <0.0000000000000002 ***
## s(Year_fac)         0.002646     26 0.0               0.473    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.113   Deviance explained = 12.7%
## -REML = 546.46  Scale est. = 1.8473    n = 313
## <<<<<<<<<<<<<<<<<<<<<<< modeling other East Suisun >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 8 iterations.
## Gradient range [-0.00008235776,0.00005099789]
## (score 1209.185 & scale 1.895939).
## Hessian positive definite, eigenvalue range [0.6033779,335.8206].
## Model rank =  51 / 51 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                       k'  edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0 13.2    0.87 <0.0000000000000002 ***
## s(Year_fac)         27.0 18.3      NA                  NA    
## s(Station_fac)       4.0  2.0      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.5466     0.1817   36.04 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                        edf Ref.df      F              p-value    
## te(SalSurf_s,doy_s) 13.157     19 14.052 < 0.0000000000000002 ***
## s(Year_fac)         18.259     26  2.230          0.000000972 ***
## s(Station_fac)       2.001      3  4.279             0.000956 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.295   Deviance explained =   33%
## -REML = 1209.2  Scale est. = 1.8959    n = 672
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Confluence >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 9 iterations.
## Gradient range [-0.0003385313,0.00009444794]
## (score 1358.238 & scale 2.444334).
## Hessian positive definite, eigenvalue range [0.000338371,350.3844].
## Model rank =  52 / 52 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                            k'       edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.000000 15.040901    0.89 <0.0000000000000002 ***
## s(Year_fac)         27.000000 20.384204      NA                  NA    
## s(Station_fac)       5.000000  0.000866      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   5.8291     0.1319   44.18 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df      F             p-value    
## te(SalSurf_s,doy_s) 15.0409012     19 21.001 <0.0000000000000002 ***
## s(Year_fac)         20.3842041     26  3.124 <0.0000000000000002 ***
## s(Station_fac)       0.0008657      4  0.000               0.821    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.379   Deviance explained = 41.1%
## -REML = 1358.2  Scale est. = 2.4443    n = 701
## <<<<<<<<<<<<<<<<<<<<<<< modeling other Suisun Marsh >>>>>>>>>>>>>>>>>>>>>>>>>
## 
## -------------gam check-------------

## 
## Method: REML   Optimizer: outer newton
## full convergence after 16 iterations.
## Gradient range [-0.0008651282,0.0005539619]
## (score 1257.6 & scale 2.949765).
## Hessian positive definite, eigenvalue range [0.000009983549,313.8467].
## Model rank =  49 / 49 
## 
## Basis dimension (k) checking results. Low p-value (k-index<1) may
## indicate that k is too low, especially if edf is close to k'.
## 
##                             k'        edf k-index             p-value    
## te(SalSurf_s,doy_s) 19.0000000  5.2664342    0.87 <0.0000000000000002 ***
## s(Year_fac)         27.0000000 19.9108455      NA                  NA    
## s(Station_fac)       2.0000000  0.0000254      NA                  NA    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## 
## -------------summary-------------
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## BPUE_log1p ~ te(SalSurf_s, doy_s, k = c(5, 5), bs = c("cs", "cc")) + 
##     s(Year_fac, bs = "re") + s(Station_fac, bs = "re")
## 
## Parametric coefficients:
##             Estimate Std. Error t value            Pr(>|t|)    
## (Intercept)   6.1741     0.1432   43.12 <0.0000000000000002 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                            edf Ref.df     F             p-value    
## te(SalSurf_s,doy_s)  5.2664342     19 6.771 <0.0000000000000002 ***
## s(Year_fac)         19.9108455     26 3.289 <0.0000000000000002 ***
## s(Station_fac)       0.0000254      1 0.000               0.644    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.245   Deviance explained = 27.5%
## -REML = 1257.6  Scale est. = 2.9498    n = 628
sal_conversions
## # A tibble: 88,836 × 1,004
##    Region   Month IBMR  SalSurf draw_1 draw_2 draw_3 draw_4 draw_5 draw_6 draw_7
##    <fct>    <int> <chr>   <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
##  1 SW Suis…     1 acar…     0.1   4.37   3.52   6.17   4.09   3.46   3.69   3.43
##  2 SW Suis…     1 acar…     0.2   4.38   3.54   6.18   4.13   3.47   3.72   3.43
##  3 SW Suis…     1 acar…     0.3   4.38   3.57   6.20   4.18   3.48   3.74   3.44
##  4 SW Suis…     1 acar…     0.4   4.39   3.59   6.21   4.22   3.50   3.77   3.44
##  5 SW Suis…     1 acar…     0.5   4.39   3.61   6.23   4.26   3.51   3.80   3.44
##  6 SW Suis…     1 acar…     0.6   4.40   3.63   6.24   4.30   3.52   3.83   3.44
##  7 SW Suis…     1 acar…     0.7   4.41   3.65   6.26   4.35   3.53   3.86   3.45
##  8 SW Suis…     1 acar…     0.8   4.41   3.67   6.27   4.39   3.54   3.89   3.45
##  9 SW Suis…     1 acar…     0.9   4.42   3.69   6.29   4.43   3.55   3.92   3.45
## 10 SW Suis…     1 acar…     1     4.42   3.71   6.30   4.47   3.56   3.95   3.45
## # ℹ 88,826 more rows
## # ℹ 993 more variables: draw_8 <dbl>, draw_9 <dbl>, draw_10 <dbl>,
## #   draw_11 <dbl>, draw_12 <dbl>, draw_13 <dbl>, draw_14 <dbl>, draw_15 <dbl>,
## #   draw_16 <dbl>, draw_17 <dbl>, draw_18 <dbl>, draw_19 <dbl>, draw_20 <dbl>,
## #   draw_21 <dbl>, draw_22 <dbl>, draw_23 <dbl>, draw_24 <dbl>, draw_25 <dbl>,
## #   draw_26 <dbl>, draw_27 <dbl>, draw_28 <dbl>, draw_29 <dbl>, draw_30 <dbl>,
## #   draw_31 <dbl>, draw_32 <dbl>, draw_33 <dbl>, draw_34 <dbl>, …

Plot salinity-biomass relationships

sal_conversions_sum<-apply(select(sal_conversions, starts_with("draw_")), 1, 
                           function(x) quantile(x, c(0.025, 0.5, 0.975)))

sal_conversions_plot<-sal_conversions%>%
  select(-starts_with("draw_"))%>%
  bind_cols(tibble(l95=sal_conversions_sum["2.5%",], 
                   median=sal_conversions_sum["50%",], 
                   u95=sal_conversions_sum["97.5%",]))
plot_sal_conversions<-function(group, data=sal_conversions_plot){
  
  if(group!="All"){
    data<-filter(data, IBMR%in%group)
    
    ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95))+
      geom_ribbon(alpha=0.4, fill="chartreuse4")+
      ylab("Zooplankton biomass (log scale)")+
      facet_grid(Region~month(Month, label=T))+
      theme_bw()+
      theme(axis.text.x=element_text(angle=45, hjust=1))
  }else{
    ggplot(data, aes(x=SalSurf, y=median, ymin=l95, ymax=u95, fill=IBMR))+
      geom_ribbon(alpha=0.4)+
      ylab("Zooplankton biomass (log scale)")+
      facet_grid(Region~month(Month, label=T))+
      scale_fill_viridis_d()+
      theme_bw()+
      theme(axis.text.x=element_text(angle=45, hjust=1))
  }
}
# Create plots for each IBMR group
sal_conversion_plots <- tibble(group=c("All", unique(model_factors$IBMR)))%>%
  mutate(plot=map(group, plot_sal_conversions))

Salinity-biomass plots

All

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

Apply model

Load in SMSCG modeled salinity

scenario_file<-here("Data/CSAMP_DS_SDM_salinity_scenarios.csv")
scenario_names<-tibble(name=colnames(read.csv(scenario_file)))%>%
  filter(str_detect(name, "sal_"))%>%
  rev()

scenario_sal<-read_csv(scenario_file, guess_max=2800)%>%
  select(region, year, month, starts_with("sal_"))%>%
  mutate(across(c(year, month), as.integer),
         across(starts_with("sal_"), ~if_else(is.na(.x), sal_base, .x)))%>%
  filter(region%in%unique(zoop_data_mass$SUBREGION))%>%
  mutate(region=factor(region, 
                       levels=c("Confluence", "Suisun Marsh", "NE Suisun", 
                                "SE Suisun", "NW Suisun", "SW Suisun")))%>%
  pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="Salinity")%>% # Prepare data for easier plotting
  mutate(Scenario=factor(Scenario, 
                         levels=scenario_names$name),
         Salinity=round(Salinity, 1))

Plot SMSCG modeled salinity

ggplot(scenario_sal, 
       aes(x=year, y=Salinity, color=Scenario))+
  geom_line()+
  scale_color_viridis_d(direction=-1)+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Calculate zoop abundance difference between each scenario and the baseline

zoop_saladjusted<-scenario_sal%>%
  mutate(Salinity=as.character(Salinity),
         IBMR=unique(model_factors$IBMR)[1])%>%
  complete(region, year, month, Scenario, IBMR=unique(model_factors$IBMR))%>%
  group_by(region, year, month, Scenario)%>%
  mutate(Salinity=na.exclude(Salinity),
         region2=if_else(region%in%c("NE Suisun", "SE Suisun"), "East Suisun", as.character(region)))%>%
  ungroup()%>%
  left_join(sal_conversions%>%
              mutate(SalSurf=as.character(SalSurf)),
            by=c("region2"="Region",
                 "month"="Month",
                 "Salinity"="SalSurf",
                 "IBMR"="IBMR"))%>%
  select(-Salinity, -region2)%>%
  mutate(across(starts_with("draw_"), ~exp(.x)-1))%>%
  pivot_longer(starts_with("draw_"), names_prefix="draw_", names_to="draw", values_to="fit")%>%
  mutate(fit=if_else(fit<0, 0, fit))%>%
  pivot_wider(names_from="Scenario", values_from="fit")%>%
  mutate(across(starts_with("sal_"), ~.x/sal_base))%>%
  group_by(region, year, month, IBMR)%>%
  summarise(across(starts_with("sal_"), 
                   list(median=~median(.x, na.rm=T), 
                        l95=~quantile(.x, 0.025, na.rm=T), 
                        u95=~quantile(.x, 0.975, na.rm=T))), 
            .groups="drop")

write_csv(zoop_saladjusted, here("Outputs", "CSAMP zoop sal adjustments.csv"))

You can find the final zoop salinity adjustments here

Prepare plots

Plot the missing model results resulting from out-of-range salinity values in the inputs

missing_adjusted_data<-zoop_saladjusted%>%
  select(-ends_with("l95"), -ends_with("u95"))%>%
  filter(IBMR=="acartela")%>%
  pivot_longer(cols=starts_with("sal_"), names_to="Scenario", values_to="zoop_change")%>%
  mutate(Scenario=str_remove(Scenario, fixed("_median")))

ggplot(missing_adjusted_data,
       aes(x=year, y=Scenario, fill=is.na(zoop_change)))+
  geom_tile()+
  scale_fill_viridis_d(name="Are the model results missing due to out-of-range salinity values?")+
  facet_grid(region ~ month(month, label=T))+
  theme_bw()+
  theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))

Plot the result

Create some plotting functions

neglop1p<-trans_new("neglop1p", transform=function(x) sign(x)*log(abs(x)+1), inverse=function(x) sign(x)*(exp(abs(x))-1))
plot_scenario_result <- function(scenario, group) {
  
  plot_data<-zoop_saladjusted%>%
    filter(IBMR%in%group)
  
  ggplot(plot_data,
         aes(x=year, y=.data[[paste0(scenario, "_median")]], ymin=.data[[paste0(scenario, "_l95")]], ymax=.data[[paste0(scenario, "_u95")]]))+
    geom_ribbon(alpha=0.4, fill="darkorchid4")+
    geom_line(alpha=0.4, color="darkorchid4")+
    scale_y_continuous(trans=neglop1p, breaks=c(-1000, -100, -10, -1, 0, 1, 10, 100, 1000))+
    ylab("Scenario/baseline (log scale)")+
    facet_grid(region ~ month(month, label=T))+
    theme_bw()+
    theme(legend.position = "bottom", axis.text.x=element_text(angle=45, hjust=1))
}
# Create plots for each Parameter
scenario_result_plots <- expand_grid(Scenario=unique(scenario_sal$Scenario)[-1],
                                     IBMR=unique(model_factors$IBMR))%>%
  mutate(plot=map2(Scenario, IBMR, ~plot_scenario_result(.x, .y)))

Result plots

sal_fallX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_hi

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_SMSCG

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_1

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_2

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_3

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_sumX2_WAN_high

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_low

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_1

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_2

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_3

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_fallX2_WAN_high

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_Port2a1

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other

sal_Port2a2

acartela

daphnia

eurytem

othcalad

othcaljuv

othclad

pdiapfor

allcopnaup

limno

mysid

othcyc

other