Load the chinook salmon data
library(atsalibrary)
## Warning: package 'atsalibrary' was built under R version
## 4.4.3
## Loading required package: broom
## Loading required package: corrplot
## corrplot 0.95 loaded
## Loading required package: dplyr
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Loading required package: forecast
## Loading required package: fpp2
## ── Attaching packages ────────────────────────── fpp2 2.5 ──
## ✔ fma 2.5 ✔ expsmooth 2.3
##
## Loading required package: ggmap
## ℹ Google's Terms of Service: <https://mapsplatform.google.com>
## Stadia Maps' Terms of Service: <https://stadiamaps.com/terms-of-service/>
## OpenStreetMap's Tile Usage Policy: <https://operations.osmfoundation.org/policies/tiles/>
## ℹ Please cite ggmap if you use it! Use `citation("ggmap")` for details.
## Loading required package: grid
##
## Loading required package: Hmisc
##
##
## Attaching package: 'Hmisc'
##
##
## The following objects are masked from 'package:dplyr':
##
## src, summarize
##
##
## The following objects are masked from 'package:base':
##
## format.pval, units
##
##
## Loading required package: kableExtra
##
##
## Attaching package: 'kableExtra'
##
##
## The following object is masked from 'package:dplyr':
##
## group_rows
##
##
## Loading required package: knitr
##
## Loading required package: loo
##
## This is loo version 2.8.0
##
## - Online documentation and vignettes at mc-stan.org/loo
##
## - As of v2.0.0 loo defaults to 1 core but we recommend using as many as possible. Use the 'cores' argument or set options(mc.cores = NUM_CORES) for an entire session.
##
##
## Attaching package: 'loo'
##
##
## The following object is masked from 'package:fma':
##
## milk
##
##
## Loading required package: magrittr
##
##
## Attaching package: 'magrittr'
##
##
## The following object is masked from 'package:ggmap':
##
## inset
##
##
## Loading required package: MARSS
##
## Loading required package: quantmod
##
## Loading required package: xts
##
## Loading required package: zoo
##
##
## Attaching package: 'zoo'
##
##
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
##
##
## ######################### Warning from 'xts' package ##########################
## # #
## # The dplyr lag() function breaks how base R's lag() function is supposed to #
## # work, which breaks lag(my_xts). Calls to lag(my_xts) that you type or #
## # source() into this session won't work correctly. #
## # #
## # Use stats::lag() to make sure you're not using dplyr::lag(), or you can add #
## # conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## # #
## # Code in packages is not affected. It's protected by R's namespace mechanism #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## ###############################################################################
##
##
## Attaching package: 'xts'
##
##
## The following objects are masked from 'package:dplyr':
##
## first, last
##
##
## Loading required package: TTR
##
##
## Attaching package: 'quantmod'
##
##
## The following object is masked from 'package:Hmisc':
##
## Lag
##
##
## Loading required package: RCurl
##
## Loading required package: readr
##
## Loading required package: rmarkdown
##
## Loading required package: stringr
##
## Loading required package: tidyr
##
##
## Attaching package: 'tidyr'
##
##
## The following object is masked from 'package:RCurl':
##
## complete
##
##
## The following object is masked from 'package:magrittr':
##
## extract
##
##
## The following object is masked from 'package:reshape2':
##
## smiths
chinook <- chinook.month %>% subset(State == "WA")
chinookts <- ts(chinook$log.metric.tons, start=c(1990,1),
frequency=12)