Summarize by year to create a time series of mean increment for each smolt year. Eliminate years with fewer than three observations.

Y1.incrs<-Carlin_full_growth %>%
  filter(SeaAge == 1) %>%
  dplyr::select(JoinID, ReleaseYear,PS.incr,FS.incr,FW.incr) %>% 
  gather(key = "incrtype",value = "incrvalue",3:5) %>% 
  group_by(ReleaseYear, incrtype) %>%
  dplyr::summarise(mean=mean(incrvalue,na.rm = TRUE),sd = sd(incrvalue,na.rm = TRUE),n=n()) %>%
  filter(n>3)

Calculate Bayesian change points using package ‘bcp’

bcplist<-list()
incrs <- c("FS.incr","FW.incr","PS.incr")
for(i in incrs){
temp<-Y1.incrs %>% 
  filter(incrtype == i) %>% 
  dplyr::select(ReleaseYear,mean)

bcp.1a <- bcp(temp$mean)
#plot(bcp.1a)
#legacyplot(bcp.1a)
bcplist[[i]]<-bcp.1a
}

Postsmolt incr

First summer incr

First winter incr

Chronological clustering with TSclust

Uses all three first year increments to cluster similar smolt years.