Introduction

This Data Dive explores the IPL Player Performance Dataset by:-

  • Selecting the time‑based column (date) and a response variable to analyze over time

  • Creating a tsibble object

  • Plotting the time series across different windows of time

  • linear regression to detect upward or downward trends

  • rolling averages and LOESS

  • ACF and PACF

ipl_raw<-read_csv("C:/mayangup/SP26/ipl-data_Dataset 1.csv")
## Rows: 24044 Columns: 22
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr   (5): player, team, match_outcome, opposition_team, venue
## dbl  (16): match_id, runs, balls_faced, fours, sixes, wickets, overs_bowled,...
## date  (1): date
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Note: Data Preparation: The data set includes only 5 matches of year 2025 that is not complete and this would distort all calculations, so to avoid this, filtered out all rows from 2025 and used a clean dataset for further analysis including complete seasons only

IPL <- ipl_raw |>
  mutate(
    date = as.Date(date),
    season = year(date)
  ) |>
  filter(season < 2025)

Selecting response variable and creating tsibble

In this analysis, the IPL’s calendar‑date structure was transformed into a season‑compressed time series to correctly study scoring patterns. Since the IPL is played only during a fixed window each year, the raw data contains long off‑season gaps with no matches, which could distort trend and seasonality detection. To remove this artifact, all off‑season days were excluded and the match dates were re‑indexed into a continuous match‑day sequence, where the final match of one season directly precedes the first match of the next. This produces a clean, uninterrupted time series that accurately reflects within‑season scoring dynamics, enabling meaningful analysis of trends, peaks, and autocorrelation patterns.

The response variable for the time‑series analysis is \(total\_runs\) which is created by aggregating the player‑level \(runs\) column into daily totals.

ipl_daily <- IPL |>
  group_by(date) |>
  summarise(total_runs = sum(runs), .groups = "drop") |>
  arrange(date) |>
  mutate(match_day = row_number()) |>
  as_tsibble(index = match_day)

Plotting response variable over time

ipl_daily |>
  ggplot(aes(match_day, total_runs)) +
  geom_line(color = "steelblue") +
  labs(
    title = "IPL Total Runs Over Compressed Match Days (2008–2024)",
    x = "Match Day (Season-Compressed)",
    y = "Total Runs"
  )

The season‑compressed plot of daily total runs reveals a much clearer picture of IPL scoring dynamics. With off‑season gaps removed, the time series forms a continuous sequence of match days, allowing the underlying structure to emerge cleanly. Distinct within‑season peaks become sharply visible, reflecting periods of intensified scoring during match‑dense stretches. These peaks are now far more interpretable without the long zero‑run intervals that previously obscured the pattern. Notably, the height of these peaks increases in later portions of the series, indicating that modern IPL seasons tend to be substantially more high‑scoring than earlier ones. Overall, the compressed timeline highlights strong within‑season variability and a gradual rise in scoring intensity across the league’s history.

Different windows of time

To consider different windows of time, plotting the early IPL seasons (2008–2013) and the modern era (2018–2024) separately.

Early IPL seasons (2008–2013)

ipl_daily |>
  filter(match_day <= 350) |>   # approx first 6 seasons
  ggplot(aes(match_day, total_runs)) +
  geom_line(color = "navy") +
  labs(title = "Early IPL Scoring Patterns (Compressed)")

Modern IPL era (2018–2024)

ipl_daily |>
  filter(match_day >= 700) |>   # approx last 6 seasons
  ggplot(aes(match_day, total_runs)) +
  geom_line(color = "firebrick") +
  labs(title = "Modern IPL Scoring Patterns (Compressed)")

When comparing the two compressed windows of time, a clear evolution in IPL scoring behavior becomes evident. In the early seasons, total‑run peaks generally fall within the 400–450 run range, with only occasional surges approaching 500 runs. The fluctuations are present but relatively contained, reflecting a more conservative scoring environment with fewer explosive match clusters. This pattern suggests that early IPL seasons were characterized by steadier scoring rhythms and less extreme variability from one match day to the next.

In contrast, the modern era displays much sharper and more frequent peaks, with several match‑day totals rising into the 500–550 run range. These elevated spikes, combined with greater volatility across consecutive match days, highlight the increasingly aggressive batting strategies and higher scoring intensity that define recent IPL seasons. Together, the two windows reveal a pronounced upward shift in scoring amplitude over time, underscoring how the league has evolved toward more dynamic, high‑impact run production.

Rolling averages and LOESS

ipl_daily <- ipl_daily |>
  mutate(roll5 = slide_dbl(total_runs, mean, .before = 4))

ipl_daily |>
  ggplot(aes(match_day)) +
  geom_line(aes(y = total_runs), alpha = 0.3) +
  geom_line(aes(y = roll5), color = "orange") +
  geom_smooth(aes(y = total_runs), method = "loess", span = 0.2, color = "red") +
  labs(title = "Smoothed IPL Scoring Patterns (Compressed)")
## `geom_smooth()` using formula = 'y ~ x'

The smoothed scoring plot reveals the underlying structure of IPL run production once off‑season gaps are removed. The faint raw line shows substantial match‑to‑match volatility, but the 5‑day rolling average (orange) highlights short‑term scoring cycles that rise and fall within each season. The LOESS curve (red) provides an even clearer long‑term pattern: scoring levels oscillate consistently across the compressed timeline, forming repeated within‑season waves rather than drifting steadily upward or downward. While the overall trend remains relatively stable, the peaks of these smoothed cycles gradually become higher in the later portions of the series, reflecting the increased scoring intensity seen in modern IPL seasons. Together, the rolling mean and LOESS smoothing make the seasonal rhythm of IPL scoring much more interpretable than the raw series alone.

ACF and PACF

acf(ipl_daily$total_runs)

The ACF plot for the season‑compressed series shows strong positive autocorrelation at the first few lags, indicating that total runs on a given match day are closely related to scoring on nearby match days. This reflects the natural clustering of high‑ and low‑scoring matches within each IPL season. The autocorrelation then declines gradually rather than dropping sharply, suggesting the presence of longer‑range dependence in scoring patterns. Several smaller bumps appear at intermediate lags, which correspond to repeated within‑season scoring cycles rather than off‑season gaps—an effect that becomes visible only after compressing the timeline. Overall, the ACF confirms that IPL scoring exhibits meaningful short‑term dependence and recurring seasonal structure, even though the long‑term linear trend remains weak.

The presence of repeated bumps at intermediate lags confirms that the ACF captures clear within‑season seasonality in IPL scoring

pacf(ipl_daily$total_runs)

The PACF plot shows a strong and statistically significant spike at lag 1, indicating that the previous match day has a direct and meaningful influence on the current day’s total runs. Beyond lag 1, the partial autocorrelations drop sharply and remain within the confidence bounds, suggesting that higher‑order lags do not contribute substantial additional predictive power once the immediate prior day is accounted for. This pattern is characteristic of an AR(1)‑type dependence structure, where short‑term scoring momentum carries over from one match day to the next but does not persist far into the future. The absence of large spikes at higher lags also confirms that the season‑compressed series does not exhibit long‑range partial autocorrelation, reinforcing the idea that IPL scoring dynamics are driven primarily by short‑term match clusters rather than extended multi‑day dependencies.

Further question :- Given the strong seasonality and weak global trend, would a seasonal ARIMA model capture IPL scoring patterns more effectively than a simple linear trend model?