{ "cells": [ { "cell_type": "markdown", "id": "eaecfe93", "metadata": {}, "source": [ "# Testing `pmdarima` for auto ARIMA\n", "\n", "Playing around with the `pmdarima` library for basic ARIMA and ARIMAX models in python - a nice alternative to `statsmodels`. Time series modeling in Python in general seems very scattered compared to the experience in `R` unfortunately." ] }, { "cell_type": "markdown", "id": "163e6a7b-be90-497c-8779-beb2b3bddb8e", "metadata": {}, "source": [ "From `pmdarima` toy datasets: https://alkaline-ml.com/pmdarima/modules/datasets.html" ] }, { "cell_type": "code", "execution_count": 1, "id": "ec8956a6-add3-42a4-84a8-e4e7adfb3af2", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import pmdarima as pm\n", "from pmdarima import model_selection\n", "\n", "import matplotlib.pyplot as plt\n", "import plotly.express as px\n", "import plotly.graph_objects as go" ] }, { "cell_type": "code", "execution_count": 2, "id": "d8df665f-e0e2-4c87-8f69-3736475d7900", "metadata": {}, "outputs": [], "source": [ "# Load a local helper file with the data cleaning and all that\n", "from create_dataset import load_combined_dataset" ] }, { "cell_type": "markdown", "id": "d1e8ee60-27a6-4e34-893b-bdf7ff1768b6", "metadata": {}, "source": [ "Using the sample datasets from the `pmdarima` library we can create a combined dataframe with data from 1980 to 1994 covering Australian beer production (in megaliters), residents, and wine sales (in bottles)" ] }, { "cell_type": "code", "execution_count": 3, "id": "622adf44-f7d7-405d-8773-42fce585758f", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | timeperiod | \n", "Wine | \n", "Residents | \n", "Beer | \n", "
---|---|---|---|---|
0 | \n", "19801 | \n", "51885.0 | \n", "14515.7 | \n", "513.0 | \n", "
1 | \n", "19802 | \n", "54954.0 | \n", "14554.9 | \n", "427.0 | \n", "
2 | \n", "19803 | \n", "67765.0 | \n", "14602.5 | \n", "473.0 | \n", "
3 | \n", "19804 | \n", "79117.0 | \n", "14646.4 | \n", "526.0 | \n", "
4 | \n", "19811 | \n", "53013.0 | \n", "14695.4 | \n", "548.0 | \n", "