{ "cells": [ { "cell_type": "markdown", "metadata": { "_uuid": "f6e52e61e4ba3ddcbd3d72403493e9553617c06f" }, "source": [ "# Time Series Modeling\n", "\n", "There are several things that are time dependent, I mean, today's values can have an effective relationship to values that have occurred in the past.\n", "\n", "Some examples related to the subject are demand of products during a certain period, harvest of commodities, stock prices and of course what we will try to predict, the climate change in Rio De Janeiro.\n", "\n", "Currently there are several types of time series forecast models, in this notebook I will try to use [Seasonal ARIMA Models](https://en.wikipedia.org/wiki/Autoregressive_integrated_moving_average)\n", "\n", "First we need to import the essential libraries:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5" }, "outputs": [], "source": [ "import numpy as np \n", "import pandas as pd \n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import statsmodels.api as sm\n", "from statsmodels.tsa.stattools import adfuller\n", "from statsmodels.graphics.tsaplots import plot_acf, plot_pacf\n", "# from sklearn.metrics import mean_squared_error\n", "from math import sqrt\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "_cell_guid": "79c7e3d0-c299-4dcb-8224-4455121ee9b0", "_uuid": "d629ff2d2480ee46fbb7e2d37f6b5fab8052498a" }, "outputs": [ { "data": { "text/html": [ "
\n", " | Temp | \n", "
---|---|
Date | \n", "\n", " |
1900-01-31 | \n", "25.780 | \n", "
1900-02-28 | \n", "26.160 | \n", "
1900-03-31 | \n", "23.868 | \n", "
1900-04-30 | \n", "23.467 | \n", "
1900-05-31 | \n", "22.667 | \n", "