{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Multivariate ITS model for unsaturated markets\n", "\n", "This notebook showcases how to use the Multivariate Interrupted Time Series (MVITS) model to estimate where new product sales came from in the case of an unsaturated market. That is, when a new product can lead to (some) reductions in sales of existing products, but some of the new product sales are in the form of growing the market.\n", "\n", "We will also see a scenario like this which the MVITS model is (at least currently) not able to handle. It is important to be aware of the limitations of the model and whether your dataset fits the assumptions of the model." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Notebook setup" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import arviz as az\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "\n", "from pymc_marketing.customer_choice import (\n", " MVITS,\n", " generate_unsaturated_data,\n", " plot_product,\n", ")\n", "\n", "rng = np.random.default_rng(123)\n", "\n", "az.style.use(\"arviz-darkgrid\")\n", "plt.rcParams[\"figure.figsize\"] = [12, 7]\n", "plt.rcParams[\"figure.dpi\"] = 100\n", "plt.rcParams.update({\"figure.constrained_layout.use\": True})\n", "\n", "\n", "%load_ext autoreload\n", "%autoreload 2\n", "%config InlineBackend.figure_format = \"retina\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## An unsaturated market example\n", "\n", "Let's explore a situation where a new product is released, and it sells reasonably well. _Some_ of those new product sales are coming from existing products, but _some_ are coming from new customers.\n", "\n", "So the total sales increase, but importantly, those additional sales are directed to the new product. This is likely a pretty common scenario in the real world. A new product is released and perhaps it is far better than existing products. So if it sells 1000 units, then some of those sales will be 'taken' from sales of existing products, but the new product is so good that it attracts new customers that would not have purchased any of the existing products. This could happen if the new product falls below a psychologically significant price point, or is associated with new marketing, or simply has a new feature that attracts new customers." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
product | \n", "competitor | \n", "own | \n", "new | \n", "pre | \n", "
---|---|---|---|---|
day | \n", "\n", " | \n", " | \n", " | \n", " |
0 | \n", "497 | \n", "293 | \n", "0 | \n", "True | \n", "
1 | \n", "471 | \n", "325 | \n", "0 | \n", "True | \n", "
2 | \n", "522 | \n", "290 | \n", "0 | \n", "True | \n", "
3 | \n", "497 | \n", "304 | \n", "0 | \n", "True | \n", "
4 | \n", "509 | \n", "300 | \n", "0 | \n", "True | \n", "