Time-Series, Segmentation and Applied AnalyticsIntroductionOrganisations rarely analyse data only as isolated records. Sales arrive over days and months, service requests fluctuate by hour, customers differ in value and behaviour, and unusual events may signal either opportunity or risk. Time-series analysis, segmentation and applied analytics provide a practical toolkit for identifying these patterns and converting them into responsible decisions. This chapter examines trends, seasonality, change, cohorts, customer and operational segments, moving averages, index numbers, basic forecasting, clustering concepts and anomaly detection. The emphasis is not on producing apparently precise predictions, but on understanding data-generating patterns, checking assumptions and communicating uncertainty. Learning ObjectivesBy the end of this chapter, you should be able to: - Distinguish trend, seasonality, cyclical movement, irregular variation and structural change.
- Prepare time-stamped data for analysis and select appropriate time intervals.
- Calculate and interpret moving averages, growth rates and index numbers.
- Explain basic forecasting methods and evaluate their limitations.
- Construct useful cohorts and customer or operational segments.
- Describe clustering and anomaly-detection approaches at diploma level.
- Interpret analytical results without confusing association with causation.
- Apply governance, ethical and communication principles to organisational analytics.
1. The Nature of Applied Analytical DataA time series is a sequence of observations ordered by time. Let yt denote the observed value at time t. Examples include daily orders, monthly revenue, hourly electricity demand and weekly call-centre waiting time. Time order is essential: unlike a randomly shuffled cross-sectional dataset, observations may depend on earlier observations. A useful conceptual decomposition is: yt = Tt + St + Rt where Tt is the underlying trend, St is recurring seasonal movement, and Rt is residual or irregular variation. This additive form is appropriate when seasonal fluctuations have approximately constant absolute size. A multiplicative form is often more suitable when seasonal variation grows with the level: yt = Tt × St × Rt The additive and multiplicative forms are models, not universal laws. Real data may include interventions, missing observations, calendar effects, promotions, weather effects and measurement changes. A sudden permanent shift is a structural break rather than ordinary random noise. Important terminology| Term | Meaning |
|---|
| Trend | Long-run direction or movement in a series | | Seasonality | Pattern repeating at a known calendar frequency | | Cycle | Longer fluctuation whose timing is not necessarily fixed | | Irregular variation | Unsystematic short-term movement | | Level | Typical current magnitude of a series | | Lag | An earlier observation, such as yt-1 | | Forecast horizon | Number of future periods being predicted | | Cohort | Group sharing a defining starting event or period | | Segment | Group formed using meaningful common characteristics | | Anomaly | Observation substantially inconsistent with expected behaviour |
2. Preparing Data for Time-Based AnalysisGood analysis begins before calculation. Each record should have a valid timestamp, a clearly defined measure and a documented unit. Analysts should inspect duplicate timestamps, missing periods, time zones, daylight-saving changes, returns, cancellations and changes in data-collection systems. Aggregation must match the decision. Hourly data may be appropriate for staffing, while monthly data may be more useful for budgeting. Aggregating too early can hide short-lived peaks; using excessively fine intervals can create noise. A calendar table is valuable because it identifies weekdays, holidays, financial periods and promotional events. When data are missing, the analyst must distinguish between “zero activity” and “no observation”. Replacing missing values with zero can seriously understate demand. Imputation may be acceptable for some descriptive purposes, but the method and uncertainty should be documented. For financial or operational measures, it is often safer to retain a missing-value flag. A standard preparation workflow is: - Parse and validate timestamps.
- Establish the time zone and reporting calendar.
- Sort records chronologically.
- Define the observation unit and aggregation rule.
- Inspect missing, duplicated and extreme values.
- Record known interventions, promotions and system changes.
- Separate training, validation and test periods chronologically when forecasting.
Randomly splitting a time series can leak future information into the training data. A model that benefits from future observations may perform well in testing but fail in actual deployment. 3. Measuring Change and Index NumbersAbsolute and relative changeIf a measure changes from y0 to y1, absolute change is: ∆y = y1 − y0 Relative change is: r = (y1 − y0) ÷ y0 Percentage change is 100r percent. The base value y0 must not be zero, and the interpretation depends on the unit and context. For several periods, the compound growth rate is often more informative than the average of annual percentages. If a quantity changes from V0 to Vn over n equal periods, the compound annual growth rate is: CAGR = (Vn ÷ V0)^(1 ÷ n) − 1 This assumes positive beginning and ending values and describes the constant rate that would produce the same total change. It does not imply that actual growth was constant. Index numbersAn index expresses a value relative to a selected base period. A simple price or volume index is: It = (xt ÷ xb) × 100 where xt is the value in period t, xb is the base-period value, and It is the index. The base period equals 100. If monthly orders rise from 2,000 in the base month to 2,400, the index is (2400÷2000)×100 = 120, meaning orders are 20% above the base level. An index is not itself a percentage, although an index of 120 can be interpreted as 20% above a base of 100. Indexes are useful for comparing products with different units, but changing the base period or product composition can alter interpretation. 4. Moving Averages and SmoothingA moving average reduces short-term fluctuation by averaging nearby observations. A centred or trailing choice must be stated explicitly. A trailing simple moving average of window width k is: MAt = (yt + yt−1 + … + yt−k+1) ÷ k where k is a positive integer and all terms must refer to comparable periods and units. The first k−1 periods do not have a complete trailing average unless a special convention is used. For example, weekly demand over five weeks is 100, 120, 110, 130 and 140 units. The three-week trailing average for week 5 is: MA5 = (110 + 130 + 140) ÷ 3 = 126.67 units This smooths the series but is not necessarily a forecast of week 6. A moving average responds slowly to turning points, and a longer window produces more smoothing but less responsiveness. A weighted moving average assigns greater importance to selected observations: WMAt = (∑(i=1 to k) wi yt−i+1) ÷ (∑(i=1 to k) wi) where wi are non-negative weights. The denominator ensures that the result remains in the same units as y. Weights should be chosen transparently rather than merely to improve a historical fit. Exponential smoothing is another approach. Simple exponential smoothing can be written as: Ft+1 = αyt + (1 − α)Ft where 0 < α ≤ 1, yt is the latest observation and Ft is the previous smoothed estimate. It is most appropriate for a series with a reasonably stable level and no strong trend or seasonality. A high α reacts quickly; a low α produces greater smoothing. The initial value F1 must be specified, for example as the first observation or an initial average. 5. Basic Forecasting and EvaluationA forecast is an estimate of an unknown future value, not a guarantee. A baseline is essential. Common baselines include: - Naïve forecast: Ft+1=yt.
- Seasonal naïve forecast: use the observation from the equivalent previous season, such as the same month last year.
- Moving-average forecast: use a recent average.
- Trend-based forecast: extrapolate an estimated trend, subject to strong assumptions.
Forecasting should be evaluated on observations not used to construct the forecast. For errors et = yt − Ft, common measures include mean absolute error: MAE = (1 ÷ n) ∑|yt − Ft| and root mean squared error: RMSE = √[(1 ÷ n) ∑(yt − Ft)2] MAE is in the original units and is easy to explain. RMSE penalises larger errors more heavily and is also in the original units. Both require comparable evaluation periods. Percentage-based measures can become unstable or undefined when actual values are zero or near zero. Forecast comparisons should include a simple baseline. A complex model is not justified merely because it has more parameters. Forecast intervals, scenario analysis and clear statements about assumptions are particularly important when decisions involve staffing, inventory or finance. 6. Cohort AnalysisA cohort is a group defined by a shared starting event, such as customers acquired in the same month, employees joining in the same quarter or devices first activated during a release period. Cohort analysis separates customer age from calendar time. A retention table may show the proportion of a cohort active after each elapsed period. If 800 customers join in January and 520 make a purchase in February, month-one retention is: Retention = 520 ÷ 800 = 0.65 = 65% The denominator must remain clearly defined. A retention analysis should state whether “active” means login, purchase, paid subscription, usage above a threshold or another event. Cohorts can reveal that newer customers retain better after a product improvement, or that apparent overall decline is caused by a larger share of recently acquired customers. Cohort analysis is descriptive. It does not by itself prove that a campaign, product change or service intervention caused the difference. Confounding factors, acquisition channels, customer mix and seasonality must be considered. 7. Segmentation for Customers and OperationsSegmentation divides observations into groups that support different decisions. Useful segmentation is actionable: a manager should know what can be done differently for each group. Common bases include: | Basis | Example | Typical use |
|---|
| Demographic or organisational | Age band, industry, company size | Service design, subject to fairness constraints | | Behavioural | Frequency, recency, usage pattern | Engagement and retention | | Value-based | Margin, lifetime contribution, cost to serve | Resource allocation | | Needs-based | Stated problem or desired outcome | Product design | | Operational | Region, shift, queue type, failure mode | Capacity and process improvement | | Lifecycle | New, active, dormant, reactivated | Communication and support |
A frequently used behavioural framework is RFM: recency, frequency and monetary value. Recency measures time since the last transaction; frequency measures number of transactions in a chosen interval; monetary value measures revenue or, preferably where available, contribution margin. RFM scores are relative within a defined population and period. They should not be treated as intrinsic customer worth. Segmentation may be rule-based, supervised or unsupervised. Rule-based segments are transparent, such as “customers with at least three orders in 90 days”. Supervised classification predicts a known label. Unsupervised clustering searches for structure without a pre-existing label. Clustering conceptsK-means clustering partitions observations into k groups by minimising within-cluster squared Euclidean distance: J = ∑(j=1 to k) ∑(xi in Cj) ||xi − μj||² where Cj is cluster j, μj is its centroid and xi is an observation. K-means assumes numerical features, uses distance meaningfully, and is sensitive to scale, outliers and the selected k. Standardisation is often required when variables use different units: z = (x − μ) ÷ σ where μ and σ are the feature mean and standard deviation calculated from the relevant training data. Scaling should not erase meaningful business interpretation, and binary or highly skewed variables may require other methods. A practical clustering workflow is: - Define the decision the segments must support.
- Select a defensible observation unit and analysis period.
- Remove leakage and handle missing values.
- Transform or scale features where appropriate.
- Compare plausible values of k using business interpretation and diagnostics.
- Profile clusters using independent descriptive measures.
- Test stability over time and against new samples.
- Name groups descriptively rather than making unsupported psychological claims.
Clusters are mathematical groupings, not naturally occurring social categories. A cluster may be unstable, difficult to reach, or too small to justify separate treatment. 8. Anomaly DetectionAn anomaly is an observation that differs substantially from an expected pattern. It may represent fraud, a system failure, a data error, a one-time event or a genuine breakthrough. Detection is not the same as explanation. For a roughly symmetric numerical variable, a z-score is: zi = (xi − μ) ÷ σ where μ and σ are the reference mean and standard deviation. A large absolute z-score may indicate an unusual value, but mean and standard deviation are sensitive to extreme observations. Robust alternatives use the median and median absolute deviation (MAD): MAD = median(|xi − median(x)|) For time series, anomalies should often be assessed against a local or seasonal baseline rather than the overall mean. A sudden increase in sales on a public holiday may be expected seasonality, not an anomaly. Control charts, rolling residuals, isolation-based methods and density methods are other possibilities, but every method depends on thresholds and reference data. False positives impose investigation costs, while false negatives may allow harm to continue. Thresholds should therefore reflect operational risk, review capacity and the consequences of each error. Automated action should be reserved for cases where validation and governance are strong. 9. Illustrative Case: Retail Service AnalyticsBackgroundA fictional national retailer operates an online store and 18 fulfilment centres. Management observes rising monthly orders but also increasing delivery complaints and uneven warehouse workload. ProblemThe organisation must determine whether growth is broad-based, identify customer groups requiring different service, forecast near-term orders for staffing, and detect unusual operational events without overstating certainty. AnalysisAnalysts aggregate orders by day and fulfilment centre, preserve cancellation records separately, and annotate promotions and public holidays. A twelve-week trailing average reveals an upward level but also a recurring weekend pattern. A seasonal naïve baseline—using the corresponding weekday from the previous week—is compared with a three-week moving average. The seasonal baseline produces lower validation MAE, suggesting that weekday structure matters. Customers are assigned to acquisition-month cohorts. The March cohort has 62% month-one retention compared with 54% for February, but analysts check whether March included a different marketing channel and a discount. They therefore report an association rather than claiming that the discount caused higher retention. For segmentation, standardised recency, order frequency, contribution margin and support contacts are clustered. Four interpretable groups emerge: frequent high-margin customers, occasional low-support customers, discount-dependent customers and recently acquired customers. The company validates that the clusters remain broadly similar in the following month and avoids using protected characteristics as targeting variables. Anomaly monitoring compares each centre’s daily dispatch count with its expected weekday and seasonal level. A large negative residual at one centre coincides with a barcode-system outage. The event is flagged for investigation rather than automatically labelled employee underperformance. Approach and outcomeThe retailer schedules staff using a forecast range and scenario assumptions rather than a single point estimate. It prioritises service recovery for high-value customers but also audits whether the policy disadvantages customers from particular regions or accessibility groups. The operational dashboard displays actuals, forecasts, forecast errors, cohort retention, segment size, segment value and unresolved anomaly alerts. Learning pointsThe case demonstrates that applied analytics combines data preparation, descriptive analysis, forecasting, segmentation, anomaly investigation and governance. No individual method answers the management question alone. The quality of definitions, validation and decision design is as important as the algorithm. 10. Limitations, Ethics and GovernanceTime-series relationships can be distorted by changing prices, product mix, inflation, platform redesigns and reporting definitions. Forecasts fail when the future differs materially from the past. Clustering can reproduce historical bias, and customer scoring can encourage intrusive or discriminatory treatment. Anomaly systems may disproportionately flag activity from groups whose normal behaviour is poorly represented in training data. Good practice includes data minimisation, purpose limitation, access controls, retention schedules, audit trails and documented feature definitions. Analysts should explain the population, time window, missing-data treatment, threshold selection and uncertainty. Sensitive attributes should be handled according to applicable law and organisational policy; excluding a protected variable does not guarantee fairness if proxy variables remain. Human review is important where automated results affect credit, employment, essential services or customer access. Individuals should not be reduced to a score without a legitimate purpose and an opportunity for correction where appropriate. Dashboards should distinguish observed values, estimates, forecasts and alerts through labels and explanatory notes. 11. Contemporary Practice and Best PracticesModern analytics platforms support streaming data, automated feature pipelines, probabilistic forecasting, explainable anomaly alerts and model monitoring. Artificial intelligence can assist with high-dimensional patterns, but it does not remove the need for sound definitions, representative data and human accountability. Machine-learning forecasts should be benchmarked against naïve and seasonal baselines and monitored for drift. A professional analyst should: - begin with the decision, not the algorithm;
- preserve time order and prevent leakage;
- use units, denominators and time windows consistently;
- distinguish descriptive association from causal evidence;
- compare complex approaches with transparent baselines;
- report uncertainty and practical error costs;
- validate segments for stability and actionability;
- investigate anomalies with operational context;
- document assumptions, transformations and exclusions;
- review fairness, privacy, security and accessibility implications.
Chapter SummaryTime-series analysis studies ordered observations and separates level, trend, seasonality and irregular movement. Additive and multiplicative decompositions are useful conceptual models, but their assumptions must be checked. Moving averages smooth noise, while exponential smoothing updates estimates using a weighting parameter. Growth rates and index numbers make change easier to compare, provided the base and units are clear. Forecasts should be evaluated chronologically against suitable baselines using measures such as MAE and RMSE. Cohort analysis compares groups sharing a starting event and helps separate customer age from calendar time. Segmentation is valuable when groups are interpretable and actionable. Clustering, including k-means, requires appropriate features, scaling, validation and cautious interpretation. Anomaly detection identifies observations for review; it does not automatically establish error, fraud or causation. Responsible applied analytics combines technical calculation with data quality controls, uncertainty communication, privacy protection, fairness review and domain knowledge. Key TermsTime series: Ordered observations recorded over time. Trend: Long-run direction in a series. Seasonality: Repeating variation linked to a calendar cycle. Cycle: Longer-term fluctuation without a necessarily fixed period. Structural break: A persistent change in the data-generating process. Moving average: Average calculated over a moving window of observations. Exponential smoothing: Forecasting method that weights recent observations more heavily. Index number: Relative measure expressed against a base period. Forecast horizon: Number of future periods being estimated. MAE: Mean absolute error between actual and forecast values. RMSE: Root mean squared error that penalises large errors more strongly. Cohort: Group sharing a defined starting event or period. Retention: Continued activity by members of a cohort. Segmentation: Division of observations into meaningful groups. RFM: Recency, frequency and monetary-value framework. Clustering: Unsupervised grouping based on similarity. Centroid: Mean feature vector representing a k-means cluster. Anomaly: Observation inconsistent with an expected pattern. Data leakage: Use of information unavailable at the time of prediction. Drift: Change in data or relationships that reduces model validity. Review QuestionsShort Answer Questions- Distinguish trend from seasonality using an organisational example.
- Why must missing observations be distinguished from zero activity?
- What is the purpose of a base period in an index number?
- State one advantage and one limitation of a moving average.
- Why should anomaly alerts be investigated rather than automatically treated as errors?
Long Answer Questions- Explain how a time-series analyst would prepare daily operational data before forecasting.
- Compare MAE and RMSE and discuss when each may be useful.
- Explain cohort analysis and show how it differs from ordinary monthly reporting.
- Describe a responsible k-means segmentation workflow, including scaling and validation.
- Discuss ethical and governance risks in customer scoring and anomaly detection.
Analytical / Application Questions- A service receives 240, 270 and 300 requests over three consecutive weeks. Calculate the three-week moving average and explain what it does and does not imply about week four.
- A customer cohort has 1,200 members and 780 remain active after one month. Calculate retention and identify two additional definitions or checks needed before comparing it with another cohort.
- A warehouse’s dispatch count is unusually low on one day. Design an investigation that distinguishes a genuine operational anomaly from a calendar effect, data error or planned shutdown.
Multiple Choice Questions with AnswersQuestion 1Which component describes a pattern that repeats at a known calendar frequency? A. Trend B. Seasonality C. Irregular variation D. Structural break Correct Answer: B. Seasonality Question 2A base-period value is 2,000 units and the current value is 2,400 units. What is the current index using the base period as 100? A. 20 B. 80 C. 120 D. 140 Correct Answer: C. 120 Question 3What is the three-period trailing moving average for values 110, 130 and 140? A. 120 units B. 126.67 units C. 130 units D. 140 units Correct Answer: B. 126.67 units Question 4Which forecasting method uses the most recent observation as the next forecast? A. Naïve forecast B. Seasonal decomposition C. K-means forecast D. Cohort forecast Correct Answer: A. Naïve forecast Question 5Why should time-series data generally be split chronologically for forecasting evaluation? A. To increase the number of variables B. To prevent future information from leaking into training C. To remove all seasonal patterns D. To guarantee zero forecast error Correct Answer: B. To prevent future information from leaking into training Question 6A cohort begins with 800 customers, of whom 520 are active one month later. What is month-one retention? A. 35% B. 52% C. 65% D. 80% Correct Answer: C. 65% Question 7What is the primary objective of standardising variables before distance-based clustering? A. To make all observations identical B. To prevent variables with large units dominating distance C. To remove the need for choosing a cluster count D. To guarantee causal conclusions Correct Answer: B. To prevent variables with large units dominating distance Question 8In k-means clustering, a centroid is best described as: A. The largest observation in a dataset B. The mean feature vector of a cluster C. A forecast error threshold D. The first time point in a series Correct Answer: B. The mean feature vector of a cluster Question 9Which statement about an anomaly is most accurate? A. It is always a data-entry mistake B. It always proves fraud C. It is an observation that differs from an expected pattern and requires investigation D. It must be deleted before analysis Correct Answer: C. It is an observation that differs from an expected pattern and requires investigation Question 10If a forecast is 90 and the actual value is 100, what is the absolute forecast error? A. −10 units B. 0.1 units C. 10 units D. 190 units Correct Answer: C. 10 units
|