Rationale

First-Level Agenda Setting Theory states that issues in media commonly end up being ever present in the minds of those who consume it. There is only so much media coverage to go around of certain topics, and that means that in certain instances, some topics or people will be covered more in comparison to others. However, the amount that certain topics or people get featured can differ depending on the time of year, and due to different circumstances. The amount of coverage on the individual topics is not beholden to a set limit. One can be higher then lower or the exact same as another media topic.

For my project, I will compare the amount of coverage or media prominence for two NBA players: Luka Donicic and LeBron James. My analysis will compare the number of stories that these two players have in a given week created by APNews.com between the dates of January 1st and September 30th.

This will help to answer the question of which of these two Los Angeles Lakers superstars receive the most media coverage at their current stage in their careers. It may also help answer who is the true face of the Los Angeles Lakers, and therefore will usually receive more media coverage.

Hypothesis

The coverage from APNews.com on LeBron James and Luka Doncic shifted depending on the week between January and September of 2025.

Variables & method

The amount of coverage of Luka Doncic and LeBron James served as the Dependent Variable in this situation. This was translated as the number of stories in a week that the two had. The independent variable was the content of the story, specifically whether it was a story about Luka or LeBron. The key words and phrases I used for Luka Doncic included: “Luka”, “Luka Lakers”, “Luka Trade”, “Luka Weight”, and “Luka Mavericks.” The key words and phrases I used for LeBron James included: “LeBron”, “LeBron Retirement”, “LeBron Bronny”, and “LeBron Lakers.”

There will be a Paired Samples T-Test that I plan to use in due time to find the statistical significance between these two story topics.

Results & discussion

The plot shows the disparity between the story coverage for Luka Doncic and LeBron James across the period from January-September. It was very back and forth between who had the most coverage, but ultimately Luka Doncic appeared to have more total coverage than LeBron James.

The peak for Luka stories was in Week 6 between February 3rd to February 9th which was the week immediately follwoing Doncic being traded to the Los Angeles Lakers from the Dallas Mavericks. However, this does not mean that LeBron James was absent from coverage either, as he reached his peak at the exact same time at with 14 stories to Luka’s 18. This was likely due to LeBron also being on the Lakers and people wondering what his reaction was to the trade.

Like I mentioned earlier, the peak for LeBron stories was also week 6 with his 14 total stories. However, LeBron did seem to get more coverage toward the end with a final spike in the offseason in Week 39 from September 22nd to 28th. That persisted into Week 40 as well. This was right around the time that LeBron retirment talks were beginning to get serious ground. Although Luka started with the edge, LeBron seems to have gotten the edge late.

These results show us that Luka and LeBron are covered on very similar levels, but they do shift depending on the time of year and what is going on with each player. It also presents the possibility that both can go up and down at the same time considering how many times they shift at similar periods. It displays how connected the two could be now.

Code:

# ============================================
# APNews text analysis (First-level agenda-setting theory version)
# ============================================

# ============================================
# --- Load required libraries ---
# ============================================

if (!require("tidyverse")) install.packages("tidyverse")
if (!require("tidytext")) install.packages("tidytext")

library(tidyverse)
library(tidytext)

# ============================================
# --- Load the APNews data ---
# ============================================

# Read the data from the web
FetchedData <- readRDS(url("https://github.com/drkblake/Data/raw/refs/heads/main/APNews.rds"))
# Save the data on your computer
saveRDS(FetchedData, file = "APNews.rds")
# remove the downloaded data from the environment
rm (FetchedData)

APNews <- readRDS("APNews.rds")

# ============================================
# --- Flag Topic1-related stories ---
# ============================================

# --- Define Topic1 phrases ---
phrases <- c(
  "Luka",
  "Luka Lakers",
  "Luka Trade",
  "Luka Weight",
  "Luka Mavericks"
)

# --- Escape regex special characters ---
escaped_phrases <- str_replace_all(
  phrases,
  "([\\^$.|?*+()\\[\\]{}\\\\])",
  "\\\\\\1"
)

# --- Build whole-word/phrase regex pattern ---
pattern <- paste0("\\b", escaped_phrases, "\\b", collapse = "|")

# --- Apply matching to flag Topic1 stories ---
APNews <- APNews %>%
  mutate(
    Full.Text.clean = str_squish(Full.Text),  # normalize whitespace
    Topic1 = if_else(
      str_detect(Full.Text.clean, regex(pattern, ignore_case = TRUE)),
      "Yes",
      "No"
    )
  )

# ============================================
# --- Flag Topic2-related stories ---
# ============================================

# --- Define Topic2 phrases ---
phrases <- c(
  "LeBron",
  "LeBron Retirement",
  "LeBron Bronny",
  "LeBron Lakers"
)

# --- Escape regex special characters ---
escaped_phrases <- str_replace_all(
  phrases,
  "([\\^$.|?*+()\\[\\]{}\\\\])",
  "\\\\\\1"
)

# --- Build whole-word/phrase regex pattern ---
pattern <- paste0("\\b", escaped_phrases, "\\b", collapse = "|")

# --- Apply matching to flag Topic2 stories ---
APNews <- APNews %>%
  mutate(
    Full.Text.clean = str_squish(Full.Text),
    Topic2 = if_else(
      str_detect(Full.Text.clean, regex(pattern, ignore_case = TRUE)),
      "Yes",
      "No"
    )
  )

# ============================================
# --- Visualize weekly counts of Topic1- and Topic2-related stories ---
# ============================================

# --- Load plotly if needed ---
if (!require("plotly")) install.packages("plotly")
library(plotly)

# --- Summarize weekly counts for Topic1 = "Yes" ---
Topic1_weekly <- APNews %>%
  filter(Topic1 == "Yes") %>%
  group_by(Week) %>%
  summarize(Count = n(), .groups = "drop") %>%
  mutate(Topic = "Luka") # Note custom Topic1 label

# --- Summarize weekly counts for Topic2 = "Yes" ---
Topic2_weekly <- APNews %>%
  filter(Topic2 == "Yes") %>%
  group_by(Week) %>%
  summarize(Count = n(), .groups = "drop") %>%
  mutate(Topic = "LeBron") # Note custom Topic2 label

# --- Combine both summaries into one data frame ---
Weekly_counts <- bind_rows(Topic2_weekly, Topic1_weekly)

# --- Fill in missing combinations with zero counts ---
Weekly_counts <- Weekly_counts %>%
  tidyr::complete(
    Topic,
    Week = full_seq(range(Week), 1),  # generate all week numbers
    fill = list(Count = 0)
  ) %>%
  arrange(Topic, Week)

# --- Create interactive plotly line chart ---
AS1 <- plot_ly(
  data = Weekly_counts,
  x = ~Week,
  y = ~Count,
  color = ~Topic,
  colors = c("steelblue", "firebrick"),
  type = "scatter",
  mode = "lines+markers",
  line = list(width = 2),
  marker = list(size = 6)
) %>%
  layout(
    title = "Weekly Counts of Topic1- and Topic2-Related AP News Articles",
    xaxis = list(
      title = "Week Number (starting with Week 1 of 2025)",
      dtick = 1
    ),
    yaxis = list(title = "Number of Articles"),
    legend = list(title = list(text = "Topic")),
    hovermode = "x unified"
  )

# ============================================
# --- Show the chart ---
# ============================================

AS1