---
title: "Decomposition"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Decomposition}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup}
library(StructuralDecompose)
```
# Introduction

All univariate time series data can be broken down into three major components. A cyclic repeated motion, A general growth pattern and the remaining unexplained portion. Popularly they are Seasonality/Cyclicity, Trend and Residuals respectively. Each component can be treated separately, and then summed together to get the final time series. 


# Trend
Trend is the underlying motion of the time series and can have a variety of forms. It can be increasing, decreasing or it can have highly random movements. In StructuralDecompose, we assume that the trend can be broken up into many different parts based upon breakpoints that we have identified in the series. 
```{r eval = FALSE}
data <- StructuralDecompose::Nile_dataset[,1]

x <- StructuralDecompose(data)
x$trend 
```
Here we have a few different versions of Trend 

# Seasonality 
Seasonality is a repeated motion of the time series. Seasonality can very broadly be either Additive or multiplicative. StructuralDecompose automatically identifies the seasonality type and treats it accordingly. 

```{r eval = FALSE}
x <- StructuralDecompose(data)
x$seasonality 
```
Here we have two different types of seasonality 

<!-- ```{r eval = FALSE} -->
<!-- plot_obj <- StructuralDecompose(Data)$Graph_plot -->
<!-- plot(plot_obj) -->
<!-- ``` -->

.
