Prepare Data

#aggregate game score by year
nba_year <- nba |>
  group_by(Year) |>
  summarize(AvgGmSc = mean(GmSc, na.rm = TRUE))

#convert to tsibble
nba_ts <- nba_year |> as_tsibble(index = Year)

Time Series Plot

ggplot(nba_year, aes(x = Year, y = AvgGmSc)) +
  geom_line(color = "blue") +
  labs(
    title = "Average Game Score Over Time",
    x = "Year",
    y = "Average Game Score"
  )

This time series plot shows how average Game Score changes from year to year over time. There are some pretty dramatic spikes and dips especially earlier on, suggesting player performance has not remained very stable over the years. This could be due to a number of factors including sample size or the fact that this is all data collected from unexpected performances.

Linear Trend Analysis

model_trend <- lm(AvgGmSc ~ as.numeric(Year), data = nba_year)
summary(model_trend)
## 
## Call:
## lm(formula = AvgGmSc ~ as.numeric(Year), data = nba_year)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.7865 -1.0046  0.0963  1.1918  2.7544 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)      -144.95076   45.15770  -3.210 0.002792 ** 
## as.numeric(Year)    0.08467    0.02254   3.757 0.000609 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.524 on 36 degrees of freedom
## Multiple R-squared:  0.2816, Adjusted R-squared:  0.2616 
## F-statistic: 14.11 on 1 and 36 DF,  p-value: 0.0006095

Linear Trend Visualization

ggplot(nba_year, aes(x = Year, y = AvgGmSc)) +
  geom_line(color = "gray50") +
  geom_smooth(method = "lm", color = "red") +
  theme_minimal() +
  labs(
    title = "Trend in Game Score Over Time"
  )
## `geom_smooth()` using formula = 'y ~ x'

There is a clear upward trend in average Game Score over time, and it is statistically significant. The model suggests Game Score increases slightly each year, which could reflect changes in the NBA like faster pace or better offensive scoring efficiency. That said, the R-squared value is only about 28%, so there are definitely other factors than time influencing performance that are not represented in this model. The red trend line above helps visualize the overall direction of performance over time.

Smoothing

ggplot(nba_year, aes(x = Year, y = AvgGmSc)) +
  geom_line(color = "gray70") +
  geom_smooth(span = 0.5, color = "purple") +
  theme_clean() +
  labs(
    title = "Smoothed Game Score Over Time"
  )
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

Smoothing the trend line is helpful in this case because it reduces noise and highlights underlying patterns without all of the drastic changes from year to year. It looks like the relationship is mostly positive besides the brief time period when it started to decrease between 1990 and 2000 before climbing back up again and consistently increasing ever since.

Seasonality (ACF)

acf(nba_year$AvgGmSc, main = "ACF of Average Game Score")

While we technically can illustrate the seasonality by visualizing the ACF of the average game score, there are some limitations. The data is aggregated by year, which hides game-level variation. Game Score is influenced by multiple statistics, and external factors like rule changes and pace of play are not included. The limited number of time points included reduces our ability to detect seasonality.

Further Questions

Would analyzing data at the game level reveal stronger patterns? Are playoff games showing different trends over time? How have other metrics like PTS, AST, TRB evolved individually?