The file DepartmentStoreSales.csv contains data about the quarterly sales of a departamental store during a 6 year period.
On this code chunk read the file csv:
#Write your code here
store <- read.csv("DepartmentStoreSales.csv", header = TRUE)
head(store)
## Quarter Sales
## 1 1 50147
## 2 2 49325
## 3 3 57048
## 4 4 76781
## 5 5 48617
## 6 6 50898
Create a time series object for the data. For this you must define the starting date, ending date and frequency:
#Write your code here
store.ts <- ts(store$Sales, start = c(2020, 1), end = c(2025, 4), frequency = 4)
store.ts
## Qtr1 Qtr2 Qtr3 Qtr4
## 2020 50147 49325 57048 76781
## 2021 48617 50898 58517 77691
## 2022 50862 53028 58849 79660
## 2023 51640 54119 65681 85175
## 2024 56405 60031 71486 92183
## 2025 60800 64900 76997 103337
Plot the time series: watch out for all details, like scale, labels of the axis, title of the plot.
#Write your code here
plot(store.ts,
main = "Quarterly Sales",
xlab = "Year",
ylab = "Sales",
col = "pink",
lwd = 2)
Write here your observations about the time series(trend, seasonality): Looking at the time series, we can observe a positive trend, indicating an overall increase in sales volume. The data also exhibits a recurring seasonal pattern, with a noticeable peak in the fourth quarter followed by a decline during the first quarter of each year.
Chatfield, C., & Xing, H. (2019). The Analysis of Time Series: An Introduction with R (7th ed.). Chapman and Hall/CRC.
Masaaki Horikoshi and Yuan Tang (2016). ggfortify: Data Visualization Tools for Statistical Analysis Results. https://CRAN.R-project.org/package=ggfortify
Sarkar, Deepayan (2008) Lattice: Multivariate Data Visualization with R. Springer, New York. ISBN 978-0-387-75968-5