<jupyter_start><jupyter_text>___ ___*Copyright <NAME> 2017**For more information, visit us at www.pieriandata.com*<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
airline = pd.read_csv('airline_passengers.csv',
                      index_col = "Month")
airline.head()
airline.plot(figsize = (12, 8))<jupyter_output><empty_output><jupyter_text>ETSWe can use an additive model when it seems that the trend is more linear and the seasonality and trend components seem to be constant over time (e.g. every year we add 10,000 passengers). A multiplicative model is more appropriate when we are increasing (or decreasing) at a non-linear rate (e.g. each year we double the amount of passengers).Based off this chart, it looks like the trend in these earlier days is slightly increasing at a higher rate than just linear (although it is a  bit hard to tell from this one plot).<jupyter_code># Get data in correct format
airline.dropna(inplace=True)
airline.index = pd.to_datetime(airline.index)
airline.head()
from statsmodels.tsa.seasonal import seasonal_decompose

result = seasonal_decompose(airline['Thousands of Passengers'], 
                            model = 'multiplicative')
result.plot()
# You may accidentally see two of the same plots here, not to worry,
# just a small bug with statsmodels function.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07394113424264179, 'fraction_numerical': 0.008614501076812634, 'mean_word_length': 4.620967741935484, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '77979', 'license': 'Apache-2.0', 'n_tokens_mistral': 416, 'n_tokens_neox': 394, 'n_words': 163, 'path': '08-Time-Series-Analysis/3-ETS-Decomposition.ipynb', 'repo_name': 'funeconomist/algorithmic-trading', 'size': '1399'}