library(readxl)
crudeoil <- read_excel("Desktop/BC 22Spr/crudeoil.xlsx")
View(crudeoil)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.1.2
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tsibble)
##
## Attaching package: 'tsibble'
## The following objects are masked from 'package:base':
##
## intersect, setdiff, union
library(ggplot2)
library(forecast)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(seasonal)
crudeoil<-ts(crudeoil,frequency=12,start=c(2009,1))
crudeoil
## Jan Feb Mar Apr May Jun Jul Aug Sep Oct
## 2009 317275 262339 303897 285934 281147 284093 287569 279111 289561 272678
## 2010 274568 253150 299033 302836 310396 310153 318991 309053 284192 272415
## 2011 296158 235122 292010 265822 289106 285572 295338 287633 273698 284594
## 2012 257536 242560 271697 258417 272766 270684 266782 263945 250160 250303
## 2013 245715 203162 231414 231621 238809 231912 245724 251079 237699 230822
## 2014 234969 201572 225487 226639 222177 212025 236534 231649 224851 221600
## 2015 222315 198807 235360 216229 224604 219618 228160 239212 216838 220171
## 2016 236065 229492 248383 228344 245749 226802 250986 248482 241213 234666
## 2017 262811 220558 253114 246132 264554 242677 245369 245611 219708 238109
## 2018 248552 209942 236216 247608 242857 254283 246671 247656 227795 227975
## 2019 234307 178257 210276 209958 221259 214563 215083 215273 194485 193493
## 2020 198663 189060 195181 165586 188693 191919 183087 168406 161926 164494
## 2021 181197
## Nov Dec
## 2009 273248 265615
## 2010 271185 279096
## 2011 268189 279359
## 2012 244987 235120
## 2013 222248 240519
## 2014 218845 223978
## 2015 221130 244965
## 2016 240691 242213
## 2017 230230 241245
## 2018 226251 219240
## 2019 174531 211837
## 2020 168655 178597
## 2021
plot.ts(crudeoil)

plot(decompose(crudeoil,type=("additive")))

plot(decompose(crudeoil,type=("multiplicative")))
