nba_ts |>
ggplot(aes(x = game_date, y = pts_home)) +
geom_line(alpha = 0.4) +
labs(
title = "Home Points Over Time",
x = "Date",
y = "Home Points"
) +
theme_minimal()
This first plot gives us an idea of what the time series looks like. There are some general trends and ideas that come to mind, like it looks to be trending upwards overall with some aspects of seasonality, but we’ll do some more analysis to confirm these hypotheses.
trend_model <- lm(pts_home ~ game_date, data = nba_ts)
summary(trend_model)
##
## Call:
## lm(formula = pts_home ~ game_date, data = nba_ts)
##
## Residuals:
## Min 1Q Median 3Q Max
## -54.728 -9.403 -0.483 8.876 70.183
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.024e+02 2.109e-01 485.547 < 2e-16 ***
## game_date 1.249e-04 1.583e-05 7.888 3.15e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 13.61 on 45396 degrees of freedom
## Multiple R-squared: 0.001369, Adjusted R-squared: 0.001347
## F-statistic: 62.21 on 1 and 45396 DF, p-value: 3.15e-15
The model suggests that average home scoring increases by about 0.0001249 points per day, or roughly 0.046 points per year. That would project, over the roughly 40 years that we have data, there is about a growth of ~1.8 points.
nba_ts |>
ggplot(aes(game_date, pts_home)) +
geom_line(alpha = 0.3) +
geom_smooth(span = 0.2, se = FALSE, color = "blue") +
labs(title = "Smoothed Home Points Over Time")
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
Interpretation
Within‑season cycles: scoring rises mid‑season and dips late in the year
Across‑season cycles: scoring resets each October
Holiday spikes: Christmas Day games often have higher scoring
These are seasonal patterns.
acf(nba_ts$pts_home, lag.max = 50)
No strong seasonality indicators visible in ACF, however there are little bumps that might be associated with the beginning of a league season. The imperfections of the data tied to the older seasons (like the 1980s) makes this a little more challenging to see, but I think there are still a few bumps visible.
I converted the game_date column into a proper Date
object and created a tsibble containing the date and home points.
Plotting the data over time revealed substantial game‑to‑game
variability and a general upward drift in scoring across seasons. A
linear regression of points on date confirmed a statistically
significant upward trend, suggesting that NBA scoring has increased over
recent years. The ACF plot showed signs of autocorrelation and repeating
seasonal structure, consistent with the NBA’s annual schedule. These
results suggest that both long‑term trends (league‑wide scoring
increases) and seasonal cycles (within‑season scoring rhythms) shape the
distribution of home points over time. Further analysis could explore
team‑specific trends or the impact of rule changes on scoring
patterns.