library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(openxlsx)
library(lubridate)
##
## Attaching package: 'lubridate'
##
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(readxl)
library(tsibble)
##
## Attaching package: 'tsibble'
##
## The following object is masked from 'package:lubridate':
##
## interval
##
## The following objects are masked from 'package:base':
##
## intersect, setdiff, union
library(dplyr)
library(tsibbledata)
library(tidyverse)
library(fable)
## Loading required package: fabletools
library(ggplot2)
gas <- readr::read_csv("C:/Users/ryanf/Downloads/gas.csv")
## Rows: 1541 Columns: 2
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): date
## dbl (1): price
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
gas_ts <- as_tibble(gas)
gas_ts
## # A tibble: 1,541 × 2
## date price
## <chr> <dbl>
## 1 5-Apr-93 1.07
## 2 12-Apr-93 1.08
## 3 19-Apr-93 1.08
## 4 26-Apr-93 1.09
## 5 3-May-93 1.09
## 6 10-May-93 1.10
## 7 17-May-93 1.11
## 8 24-May-93 1.11
## 9 31-May-93 1.11
## 10 7-Jun-93 1.10
## # … with 1,531 more rows
# index=date
#gas_fit <- gas %>%
# model(
# Seasonal_naive = SNAIVE(price),
# Naive = NAIVE(price),
# Drift = RW(price ~ drift()),
# Mean = MEAN(price)
# )
Hey Alex, it may not look like it, but I have spent the last few hours working on this.Spent a lot of time fooling around with data trying to get it imported properly, and now I can not get my date column to show up as my index(at least I think that is the problem) and as a result I cannot get the data properly formatted in tsibble to do other things. Normally, when I get behind in a class I have no problem teaching myself very quickly, but this class appears to be the exception. It is a lot of work, very technical, and hard to diagnose where I am going wrong with vague error messages. Since this strategy does not appear to be working for me I am going to change it up for the future. I am sorry I waited until this last minute to do this assignment but life has been very demanding as of late.Please dont give up on me because I promise I am trying.
I know I did not complete the majority of this assignment, but I will tell you my plan for whats its worth. I planned on modeling the data and forecasting using all four methods. I would consider all the forecasts, but I expected to choose the SNAIVE method because I think gas can be very seasonal, but also has fluctuating trends. I didnt really have the oppourtunity for thinking beyond that. Anyways, thanks for hearing me out. I plan on being in your office hours if I can make it before homework 4 is due.