Central to diagnosing the performance of a new product is the decomposition of its total sales into trial, first repeat, second repeat, and so on, components. More formally, we are interested in creating a summary of purchasing that tells us for each unit of time (e.g., week), the cumulative number of people who have made a trial (i.e., first-ever) purchase, a first repeat (i.e., secondever) purchase, a second repeat purchase, and so on. We let \(T(t)\) denote the cumulative number of people who have made a trial purchase by time \(t\), and \(R_{j}(t)\) denote the number of people who have made at least \(j\) repeat purchases of the new product by time \(t(j=1,2,3, \ldots)\).
With such a data summary in place, standard new product performance metrics such as “percent triers repeating” and “repeats per repeater” are easily computed from these data. At any point in time \(t\), percent triers repeating is computed as \(R_{1}(t)/T (t)\), while repeats per repeater is computed as \(R(t)/R_{1}(t)\), where \(R(t)\) is the total number of repeat purchases up to time \(t\):
\[
R(t)=\sum_{j=1}^{\infty} R_{j}(t)
\]
Furthermore, a simple new product sales forecasting model can easily be built around such a data summary.
we describe how to create such a sales summary from raw customer-level transaction data (typically collected via a consumer panel) using python.
A consumer panel is formed by selecting a representative sample of individuals or households (from the population of interest) and recording their complete behaviour (e.g., purchasing of FMCG products) over a fixed period of time.
For a given product category, we can construct a dataset that reports the timing of each purchase, along with details of the product purchased. A stylized representation of this is given in the figure (Purchase Histories: Total Category) below for a total of \(n\) households, in which we consider an observation period starting with the launch of a new product and ending at time \(t_{\text {end }}\). We let \(\diamond\) denote a purchase of the new product and \(\times\) denote the purchase of any other product in the category.
We see that HH 1 made three category purchases over the observation period but never purchased the new product. HH 2 made seven category purchases; the third category purchase represents a trial purchase of the new product, and no repeat purchasing activity was observed over the remainder of the observation period. HH 3 made a trial purchase of the new product and two repeat purchases. And so on.
In many analysis situations, where we are focusing on a particular product, purchase records not associated with the focal product are removed to yield a simpler (and smaller) dataset. A stylized representation of this is given in the figure (Purchase Histories: New Product Only) below. As HH 1 never bought the new product, there is no explicit record of this household in the resulting dataset.
2 Imports
2.1 Import Packages
Code
import polars as plimport numpy as npimport altair as altfrom utils import ChartTemp, layered_line_propfrom scipy.optimize import minimizefrom IPython.display import display_markdownalt.renderers.enable("html")
RendererRegistry.enable('html')
2.2 Import Panel Data
“Kiwi Bubbles” is a masked name for a shelf-stable juice drink, aimed primarily at children, which is sold as a multipack with several single-serve containers bundled together. Prior to national launch, it underwent a year-long test conducted in two of IRI’s BehaviorScan markets. The file kiwibubbles_tran.txt contains purchasing data for the new product, drawn from 1300 panelists in Market 1 and 1499 panelists in Market 2.
Each record in this file comprises five fields: Panelist ID, Market, Week, Day, and Units. The value of the Market field is either 1 or 2. The Week field gives us the week number in which the purchase occurred (the product was launched at the beginning of week 1), the Day field tells us the day of the week (1-7) in which the purchase occurred, and the Units field tells us how many units of the new product were purchased on that particular purchase occasion.
We load this dataset into python. We see that there are a total of 857 transactions across the two markets during the year-long test.
Let us consider the transaction history of panelist 20014. We note that this panelist made his/her trial purchase and first repeat purchase in week 4. Similarly, this panelist’s third and fourth repeat purchases occurred in week 7 . We also note that this panelist typically purchased several units of the product on any given purchase occasion.
Code
kiwi_lf_m2.filter(pl.col('ID') ==20014).collect()
shape: (9, 4)
ID
Week
Day
Units
u16
i16
i16
i16
20014
4
2
1
20014
4
4
1
20014
6
6
2
20014
7
2
3
20014
7
6
3
20014
12
5
2
20014
17
6
1
20014
23
4
2
20014
47
6
2
This suggests several possible versions of the desired sales by depth-of-repeat summary:
Our summary counts the number of trial, first repeat, second repeat, etc. transactions that occurred each week. The process of creating such a summary is described in section Creating a “Raw” Transactions Summary below.
Our summary reports the sales volume (e.g., units) associated with trial, first repeat, second repeat, etc. transactions that occurred each week. The process of creating such a summary is described in section Creating a “Raw” Sales Volume Summary below.
We have noted that this panelist’s trial and first repeat purchases occurred in the same week, albeit on different days. Similarly, his/her fourth and fifth repeat purchases occurred in the same week. The structure of many simple models of new product sales forecasting is such that a customer can have only one transaction per unit of time. If the unit of time is one week (as it typically the case), we clearly have a problem. One solution would be change the unit of time from week to day. However, as such purchasing behaviour tends to be rare, Eskin suggests that, “[f]or estimation purposes, second purchases within a single week are coded in the following week.” The process of creating such a “shifted” summary is described in Creating a “Shifted” Transactions Summary below.
But what happens if we observe multiple transactions on the same day? This is very rare and typically reflects bad pre-processing of the panel data. For example, as an individual’s purchases are scanned at the supermarket checkout, one six-pack of Coke could be the first item scanned with another six-pack of Coke being the last item scanned. As the raw data are “cleaned-up” these two purchases should be combined into one transaction with a quantity of two. But this doesn’t always happen. If the (very) raw panel data file contains a transaction time field, we easily determine whether the two records come from the same or different shopping trips. Even if they did come from separate shopping trips on the same day, our natural reaction would be to combine them into a single transaction with multiple units, rather than shift to an even smaller time unit (e.g., hour). we should reflect on how to determine whether we observe multiple transactions for an individual panelist on the same day once the raw panel data has been loaded into python. (Note that there are no such occurrences in the Kiwi Bubbles dataset.)
3.2 Creating a “Raw” Transactions Summary
The first thing we need to do is add a field that indicates the depth-of-repeat level associated with each record; i.e., is this a trial purchase \((\mathrm{DoR}=0)\), a first repeat purchase \((\mathrm{DoR}=1\) ), a second repeat purchase ( \(\operatorname{DoR}=2\) ), etc.
This is a straightforward exercise. If the panelist ID associated with this record does not equal that of the previous record, we are dealing with a new panelist and we set the depth-of-repeat indicator to 0 . If the panelist ID associated with this record does equal that of the previous record, we are dealing with a repeat purchase by that panelist and we increment the depth-of-repeat indicator by 1.
The corresponding records for panelist 20014 are shown below with DoR indicator:
Code
kiwi_lf_m2.filter(pl.col('ID') ==20014).collect()
shape: (9, 5)
ID
Week
Day
Units
DoR
u16
i16
i16
i16
u16
20014
4
2
1
0
20014
4
4
1
1
20014
6
6
2
2
20014
7
2
3
3
20014
7
6
3
4
20014
12
5
2
5
20014
17
6
1
6
20014
23
4
2
7
20014
47
6
2
8
The next step is to perform aggregations to the data and create two type of the same data-frame: a long-form and wide-form.
We want there to be 52 rows, one for each week of the test. It turns out, however, that this panel of 1499 households only purchased the test product in 49 weeks; no purchases occurred in weeks 25,39, and 41. How can we create a table that will contain zeros in the rows corresponding to these three weeks? We accomplish this by creating a dummy dataframe that contains the full range of combination of Week and DoR. There are should be a range of 1 to 52 weeks and a range of 0 to 11 depth-of-repeats. Next, we will join the aggregated dataframes of the main dataset with the dummy dataframe such that it preserves the size of the dummy dataframe and fills the empty combinations with null values.
Code
# Week Range: 1 to 52, DoR Range: 0 to 11 (max(DoR) = 11)week_range, dor_range = np.meshgrid(np.arange(1, 53, dtype='int16'), np.arange(0, 12, dtype='uint16'))# Create a dummy LazyFrame that contains the full range of combinations for Week & DoRdummy_lf = pl.LazyFrame({'Week': week_range.reshape(-1), 'DoR': dor_range.reshape(-1)})agg_trans = ( kiwi_lf_m2 .group_by('Week', 'DoR') .agg(pl.len().alias('Count')))week_total_trans = ( agg_trans .group_by('Week') .agg(pl.col('Count').sum().alias('Total')) )agg_trans_longform = ( dummy_lf .join(week_total_trans, on='Week', how='left') .join(agg_trans, on=['Week', 'DoR'], how='left') .fill_null(0))
The wide-form is more intuitive and easy to visualize, it tells us how many trial, first repeat, etc. purchases (columns) occurred in each week (rows).
We note that there are no entries in the rows corresponding to weeks 25, 39, and 41. Over the year-long test, 139 of the 1499 panelists made at least one purchase of the new product, with a total of 306 purchase occasions. We also note that by the end of the year, one person had made eleven repeat purchases of the new product.
A cleaned-up summary that reports these weekly transactions in cumulative form (i.e., \(T(t), R_{1}(t), R_{2}(t)\), etc.) is created created below:
Having created a weekly transaction by depth-of-repeat level summary, it is extremely easy to create an equivalent sales volume (e.g., units) summary. Here, instead of counting IDs or length of aggregated dataframe as the value item, we sum Units. We note that a total of 396 units of the product were purchased (across the 306 purchase occasions).
A cleaned-up summary that reports these weekly transactions in cumulative form is created below. We note that a total of 161 units were purchased on the 139 trial purchase occasions, an average 1.16 units per trial purchase.
We now turn our attention to the task of creating a weekly transaction by depth-of-repeat level summary under the assumption that a customer can have only one transaction per week. In other words, a second purchase within a single week is “shifted” to the next week (i.e., coded as occurring in the following week).
Referring back to panellist 20014, the field that indicates the depth-of-repeat level associated with each record (DoR) is correct. What we need to do is makes some changes to the week field: we want the week associated with the first repeat purchase to be 5, and the week associated with the fourth repeat purchase to be 8. One solution would be to create a new week variable that equals the original week variable +1 if the week associated with the current record is the same as that of the previous record. But what if we have three purchases occurring in the same week?
Code
kiwi_lf_m2.filter(pl.col('ID') ==20014).collect()
shape: (9, 5)
ID
Week
Day
Units
DoR
u16
i16
i16
i16
u16
20014
4
2
1
0
20014
4
4
1
1
20014
6
6
2
2
20014
7
2
3
3
20014
7
6
3
4
20014
12
5
2
5
20014
17
6
1
6
20014
23
4
2
7
20014
47
6
2
8
Code
kiwi_lf_m2.filter(pl.col('ID') ==20069).collect()
shape: (3, 5)
ID
Week
Day
Units
DoR
u16
i16
i16
i16
u16
20069
18
1
1
0
20069
18
5
1
1
20069
19
4
2
2
To complicate matters, consider the transaction history of panelist 20069. This person’s trial and first repeat purchases occurred in the same week. We therefore change the week associated with the first repeat purchase from 18 to 19. But this creates another problem as this person’s second repeat purchase occurred in week 19. Having shifted the first repeat purchase to week 19, we have to shift the second repeat purchase to week 20.
Our solution is to group each record by ID and pass all of an ID’s Week as an array to a custom defined function which iterates over the array to evaluates whether the array has repeating numbers. If there were purchases made in the same week, such that index \(i\) and index \(i+1\) are in the same week, \(i+1\) is incremented by 1. The loop inside the defined function also ensures that we shift purchases encroached on by the shifting of previous purchases (such as the second repeat purchase for panelist 20069).
Code
example_array = np.array([1,1,2,3,6,7,7,8])def shift(arr): arr = np.sort(arr) # Sort array to handle duplicates systematicallyfor i inrange(1, len(arr)):if arr[i] <= arr[i -1]: # If duplicate or less, increment by 1 arr[i] = arr[i -1] +1return arrshift(example_array)
array([1, 2, 3, 4, 6, 7, 8, 9])
Code
# Method 1def shift_week(group_df): week_arr = group_df["Week"].sort().to_numpy().copy() # Sort array to handle duplicates systematicallyfor i inrange(1, len(week_arr)):if week_arr[i] <= week_arr[i -1]: # If duplicate or less, increment by 1 week_arr[i] = week_arr[i -1] +1return group_df.with_columns(pl.Series("shWeek", week_arr))# Method 2# def shift_week(group_df):# seen = set()# adjusted_weeks = []# for week in group_df["Week"].to_list(): # while week in seen: # week += 1# seen.add(week)# adjusted_weeks.append(week)# return group_df.with_columns(pl.Series("shWeek", adjusted_weeks))shifted_lf = ( kiwi_lf_m2 .group_by('ID') .map_groups(shift_week, schema={'Week': pl.Int16, 'shWeek':pl.Int16,'DoR':pl.UInt16,'Units':pl.Int16,'Day':pl.Int16,'ID':pl.UInt16}))shifted_lf.filter(pl.col('shWeek') != pl.col('Week')).collect()
shape: (9, 6)
ID
Week
Day
Units
DoR
shWeek
u16
i16
i16
i16
u16
i16
20014
4
4
1
1
5
20014
7
6
3
4
8
20051
17
7
2
1
18
20057
16
4
3
2
17
20057
17
2
1
3
18
20069
18
5
1
1
19
20069
19
4
2
2
20
20117
1
4
1
1
2
20118
19
5
1
5
20
The next step is to create a table that tells us how many trial, first repeat, etc. purchases occurred in each week. We create a pivot table in which we use shWeek as the row field, DoR as the column field, and ID as the data item.
The differences between the “raw” and “shifted” cumulative transaction counts by depth-of-repeat level are small; there are only nine depth-of-repeat/week occasions on which the two sets of numbers differ, and the maximum deviation is one transaction. Perhaps the most obvious difference is with respect to first repeat. Looking at the “raw” numbers, we observe a first repeat purchase in the first week the product was on the market. Under the assumption that a trial and first repeat purchase cannot occur in the same week, this first repeat purchase is shifted to week 2 in the “shifted” numbers.
4 Generating a Sales Forecast With a Depth-of-Repeat Model
4.1 Introduction
Central to diagnosing the performance of a new product is the decomposition of its total sales into trial, first repeat, second repeat, and so on, components:
\[
S(t)=T(t)+R_{1}(t)+R_{2}(t)+R_{3}(t)+\cdots
\]
where \(S(t)\) is the cumulative sales volume up to time \(t\) (assuming that only one unit is purchased on each purchase occasion), \(T(t)\) equals the cumulative number of people who have made a trial purchase by time \(t\), and \(R_{j}(t)\) denotes the number of people who have made at least \(j\) repeat purchases of the new product by time \(t(j=1,2,3, \ldots)\).
We can decompose \(T(t)\) in the following manner:
where \(N\) is number of customers whose purchases are being monitored and \(F_{0}(t)\) is the proportion of customers who have made their trial purchase by \(t\).
We can decompose the \(R_{j}(t)\) by conditioning on the time at which the \((j-1)\) th purchase occurred:
where \(F_{j}\left(t \mid t_{j-1}\right)\) is the proportion of customers who have made a \(j\) th repeat purchase by \(t\), given that their \((j-1)\) th repeat purchase was made in period \(t_{j-1}\), and \(R_{j-1}\left(t_{j-1}\right)-R_{j-1}\left(t_{j-1}-1\right)\) is the number of individuals who made their \((j-1)\) th repeat purchase in time period \(t_{j-1}\). (Note that \(R_{0}(t)=T(t)\) and \(R_{j}(t)=0\) for \(\left.t \leq j.\right)\)
Equations (1) and (2) are simply definitional. If we specify mathematical expressions for \(F_{0}(t)\) and the \(F_{j}\left(t \mid t_{j-1}\right)\), we arrive at a model of new product sales. Our python implementation incorporates the following model, with separate submodels for trial, first repeat (denoted by \(F R(t)\) instead of \(R_{1}(t)\) ) and additional repeat \(\left(A R(t)=R_{2}(t)+R_{3}(t)+\cdots\right)\):
\[
\begin{align*}
& F R(t)=\sum_{t_{0}=1}^{t-1} P\left(\text { first repeat by } t \mid \text { trial at } t_{0}\right)\left[T\left(t_{0}\right)-T\left(t_{0}-1\right)\right] \tag{5}\\
& P\left(\text {first repeat by } t \mid \text { trial at } t_{0}\right)=p_{1}\left(1-e^{-\theta_{F R}\left(t-t_{0}\right)}\right) \tag{6}
\end{align*}
\]
For additional repeat \((j \geq 2)\), we have
\[
\begin{align*}
A R(t)= & \sum_{j=2}^{\infty} R_{j}(t) \tag{7}\\
R_{j}(t)=\sum_{t_{j-1}=j}^{t-1}\{ & P\left(j \text {th repeat by } t \mid(j-1) \text { th repeat at } t_{j-1}\right) \\
& \left.\quad \times\left[R_{j-1}\left(t_{j-1}\right)-R_{j-1}\left(t_{j-1}-1\right)\right]\right\} \tag{8}
\end{align*}
\]
\[
\begin{equation*}
P\left(j\text{th repeat by } t \mid (j-1)\text{th repeat at } t_{j-1}\right)=p_{j}\left(1-e^{-\theta_{A R}\left(t-t_{j-1}\right)}\right) \tag{9}
\end{equation*}
\]
For the Kiwi Bubbles dataset (from a panel of \(N=1499\) households) with a 24 -week calibration period, we have
\(p_{0}\)
\(\theta_{T}\)
\(p_{1}\)
\(\theta_{F R}\)
\(p_{\infty}\)
\(\gamma\)
\(\theta_{A R}\)
0.08620
0.06428
0.36346
0.46140
0.78158
1.00140
0.23094
Given these parameter estimates, we can first generate a forecast of trial, then a forecast of first repeat (conditional on the trial forecast), then a forecast of second repeat (conditional on the first-repeat forecast), and so on. For a forecast horizon of \(t_{f}\) periods, we should (in theory) allow for up to \(t_{f}-1\) levels of repeat \({ }^{1}\).
\({ }^{1}\) Under the assumption that a customer can have only one transaction per unit of time, the earliest point in time a first repeat purchase can occur is period 2. Following this logic, the summation limit in (7) should really be \(t-1\), not \(\infty\).
Using the purchasing data for the 101 households who had tried Kiwi Bubbles by the end of week 24, we wish to forecast the purchasing behavior of the whole panel (i.e., 1499 households) to the end of the year (week 52).
Modelling Trial Sales - We model the cumulative number of triers by time \(t\), \(T(t)\), by developing an expression for the probability that a randomly-chosen individual has made a trial purchase by time \(t\). - For a market comprising \(N\) individuals (i.e., the size of the panel), we have:
\[
T(t)=N \cdot P(\text {trial by } t)
\]
Characterizing \(P(\text {trial by } t)\):
Cumulative penetration curves (from controlled test-markets) tend to: - increase at a decreasing rate - towards a penetration limit < 100%
A mathematical expression that captures this is:
\[
P(\text {trial by } t)=p_{0}\left(1-e^{-\theta_{T} t}\right)
\]
Formal Derivation: Individual-Level Model:
Let \(T\) denote the random variable of interest, and \(t\) denote a particular realization.
Assume time-to-trial is distributed exponentially.
The probability that an individual has tried by time \(t\) is given by:
Our goal is to generate a (cumulative) sales forecast for the new product up to the end of the year (week 52). We start by generating a forecast of \(T(t)\), the cumulative number of trial transactions by \(t\), for \(t=1, \ldots, 52\).
Given \(\hat{p}_{0}\) and \(\hat{\theta}_{T}\), we evaluate expressions (1) and (2) by specifying the vector of time points \(t\) (up to 52 weeks).
( ChartTemp(modified_cum_trans.filter(pl.col('Week (t)')<=24)) .line_encode(x_col='Week (t)',y_col='FR(t):Q', y_scale=alt.Scale(domain=[0, 100]), y_title='Cumulative FR Sales (# of Transactions)') .line_prop('Actual Test-Market Cumulative First Repeat Sales'))
Modelling First Repeat:
How can an individual have made a first repeat purchase of the new product by the end of week 4? - she could have made a trial purchase in week 1 and made a second purchase (i.e., her first repeat purchase) somewhere in the intervening three weeks, - she could have made a trial purchase in week 2 and a second purchase sometime in the following two weeks, or - she could have made a trial purchase in week 3 and her first repeat purchase sometime in the following week.
Modelling First Repeat Sales:
\[
F R(t)=\sum_{t_{0}=1}^{t-1} P\left(\text { first repeat by } t \mid \text { trial at } t_{0}\right)\times\left[T\left(t_{0}\right)-T\left(t_{0}-1\right)\right]
\]
where \(T\left(t_{0}\right)-T\left(t_{0}-1\right)\) is the number of incremental tirers in week \(t_{0}\).
( ChartTemp(cum_fr_by_trial.filter(pl.col('Trial Week') <=10).collect()) .line_encode(x_col='FR Delta',x_title='Weeks Since Trial',y_col='Cum FR by Trial', y_title='Cum. % Making FR Purchase', color='Trial Week:N', x_range=24) .line_prop('Empirical Time-to-FR Curves by Time of Trial'))
Modelling First Repeat: - Let us assume that these empirical time-to-FR curves are realizations of the same underlying curve
\[
P\left(\text { first repeat by } t \mid \text { trial at } t_{0}\right) = P\left(\text { first repeat } t - t_{0} \text { periods after trial}\right)
\]
Specify a mathematical expression for this curve
\[
P\left(\text { first repeat by } t \mid \text { trial at } t_{0}\right) = p_{1}\left(1-e^{-\theta_{F R}\left(t-t_{0}\right)}\right)
\]
The next step is to generate a forecast of first-repeat purchasing, conditional on our forecast of trial transactions. We have generated a forecast of \(T(t)\), the cumulative number of trial transactions by \(t\), whereas our expression for \(FR(t),(5)\), requires the incremental number of triers in each period. We compute this quantity, storing it in the array eligible. At time \(t\), we use (6) to compute the probability of making a first repeat purchase \(t\) periods after a trial purchase \((t=1, \ldots, 52)\). Given these two quantities, we use (5) to compute \(FR(t)\).
( ChartTemp(modified_cum_trans.filter(pl.col('Week (t)')<=24)) .line_encode(x_col='Week (t)',y_col='AR(t):Q', y_scale=alt.Scale(domain=[0, 100]), y_title='Cumulative AR Sales (# of Transactions)') .line_prop('Actual Test-Market Cumulative Additional Repeat Sales'))
Modelling Additional Repeat:
\[
A R(t)= \sum_{j\ge2} R_{j}(t)
\]
where \(R_{j}(t)\) is the cumulative number of individuals who have made at least \(j\) repeat purchases by time \(t\). How do we characterize \(R_{j}(t)\), \(j = 2, 3, \ldots\)?
How can an individual have made a second repeat purchase by the end of week 5? - she could have made her 1st repeat purchase in week 2 (which implies her trial purchase occurred in week 1) and made a 3rd purchase of the new product (i.e., her 2nd repeat purchase) somewhere in the intervening three weeks, - she could have made her 1st repeat purchase in week 3 and a 2nd repeat purchase sometime in the following two weeks, or - she could have made her 1st repeat purchase in week 4 and her 2nd repeat purchase sometime in the following week.
\[
R_{2}(t)=\sum_{t_{1}=2}^{t-1} P\left( \text {second repeat by } t \mid \text {first repeat at } t_{1}\right) \times\left[FR\left(t_{1}\right)-FR\left(t_{1}-1\right)\right]
\]
where \(FR(t_{1}) − FR(t_{1} − 1)\) is the number of individuals who made their first repeat purchase in week \(t_{1}\).
Modelling Additional Repeat - General:
\[
R_{j}(t)=\sum_{t_{j-1}=j}^{t-1} P\left(j \text {th repeat by } t \mid(j-1) \text { th repeat at } t_{j-1}\right) \times\left[R_{j-1}\left(t_{j-1}\right)-R_{j-1}\left(t_{j-1}-1\right)\right]
\]
where \(R_{j-1}\left(t_{j-1}\right)-R_{j-1}\left(t_{j-1}-1\right)\) is the number of individuals who made their \((j-1)th\) repeat purchase in week \(t_{j-1}\)
Challenges: - Sparse data for higher orders of repeat \((j = 3, 4, 5)\) - No data for repeat levels we are likely to observe in the forecast period
Following the same logic as for trial and first repeat, \[P\left(j \text {th repeat by } t \mid(j-1) \text { th repeat at } t_{j-1}\right)=p_{j}\left(1-e^{-\theta_{AR}(t-t_{j-1})}\right),\quad t=t_{j+1}+1,\ldots\]
Evolution of \(p_{j}\):
The asymptote of the depth-of-repeat curves (i.e., ultimate conversion proportion) increases, at a decreasing rate, as j increases.
The proportion of consumers who have made their \(jth\) repeat purchase within 52 weeks of their \((j − 1)th\) repeat purchase increases with \(j\).
We model the evolution of the ultimate conversion proportions as:
To forecast additional repeat, we first compute second repeat (conditional on our forecast of first repeat), then compute third repeat (conditional on our forecast of second repeat), and so on. The code we use to accomplish this is basically the same as that for first repeat, embedded within a loop over depth-of-repeat levels. Given the assumption that a customer can have only one transaction per period, we could theoretically have up to 51 depth-of-repeat levels for a 52-week forecast horizon. Another consequence of this assumption is that the first week in which a \(j\) th repeat purchase could occur is week \(j+1\); this means \(R_{j}(t)=0\) for \(t \leq j\).
display_markdown(f'''Our forecast horizon is {endwk} weeks and we allow for up to {endwk-1} level of repeats.**Trial Model Parameters:**- $P_{0}$ = {p_0:0.4f}- $\\theta_{{T}}$ = {theta_T:0.4f}**First Repeat Model Parameters:**- $P_{1}$ = {p_1:0.4f}- $\\theta_{{FR}}$ = {theta_FR:0.4f}**Additioanl Repeat Model Parameters:**- $p_{{\\infty}}$ = {p_inf:0.4f}- $\\gamma$ = {gamma:0.4f}- $\\theta_{{AR}}$ = {theta_AR:0.4f}''', raw=True)
Our forecast horizon is 52 weeks and we allow for up to 51 level of repeats.
combined_curve = actual_curve + estimated_curvelayered_line_prop(combined_curve, 'Actual Vs Estimated Depth-of-Repeat Curves')
5 Extending the Basic Model
The trial model assumes all triers have the same underlying trial rate \(θ_{T}\) — a bit simplistic.
Allow for individual differences in (latent) trial rates across the population.
We incorporate the effects of marketing mix covariates by assuming that the probability of an individual buying in week \(t\), given she has yet to make a trial purchase, is a function of marketing activity in week \(t\).