Rationale

Agenda-setting theory proposes that issues emphasized in news coverage can become more prominent in audiences’ perceptions of what matters. News organizations have limited attention to devote to competing issues, but major events can also draw attention to related topics. This project examines whether average weekly coverage of U.S. economic concerns changed after the February 28, 2026, outbreak of the Iran war. It does not assume that the war caused any observed change.

Research Question and Hypothesis

Research question: Did average weekly coverage of U.S. economic concerns differ between the 30 weeks before and the 30 weeks after the Iran war began?

Hypothesis: Average weekly coverage of U.S. economic concerns differs between the two periods.

Variables and Method

The independent variable is the period (Before or After). The dependent variable is the weekly number of stories matching the same U.S. economic concerns query in the MediaCloud United States–National collection. The analysis includes 60 complete Saturday–Friday weeks: August 2, 2025–February 27, 2026 (30 before), and February 28–September 25, 2026 (30 after). The outbreak date is included in the After group.

Following Dr. Blake’s independent-samples template, I use Welch’s independent-samples t-test, which does not require equal group variances. Each row represents one week; weeks are not paired. I inspect group distributions and Shapiro-Wilk tests and include the template’s Wilcoxon rank-sum comparison. With 30 weeks per group, normality and outliers require attention. The Wilcoxon test compares distributions rather than directly testing equality of arithmetic means.

Adjacent weeks may be related, which can violate the independence assumption of both tests. Seasonality, other events, changing outlet participation, and changes in overall news volume may affect raw story counts. These are limitations of this exploratory before-and-after analysis.

Data Retrieval

Set MEDIACLOUD_KEY in your .Renviron file, restart R, and knit this document. Do not publish your key. The API retrieval is custom preparation; the statistical analysis below adapts Dr. Blake’s guide. Missing daily rows trigger an error rather than being treated as zero stories.

Results

Weekly Economic Coverage

The dotted line marks the outbreak. Each point represents a complete week.

Distributions and Descriptive Statistics

Weekly Economic Coverage: Descriptive Statistics
IV count mean sd min max
Before 30 1,828.50 388.31 1,029.00 2,652.00
After 30 2,175.73 502.32 1,259.00 3,108.00

Normality Check

Shapiro-Wilk Normality Tests by Period
IV W_statistic p_value
Before 0.9862 0.9558
After 0.9744 0.6652
With fewer than 40 weeks per group, inspect normality and outliers before interpreting the t-test. A nonsignificant Shapiro-Wilk test does not prove normality.

Independent-Samples t-Test

Welch's Independent-Samples t-Test
Group 1 = Before; Group 2 = After; confidence interval = Before minus After
estimate1 estimate2 statistic parameter p.value conf.low conf.high
1,828.5000 2,175.7333 −2.9955 54.5396 0.0041 −579.5831 −114.8835

Wilcoxon Rank-Sum Comparison

Wilcoxon Rank-Sum Test
statistic p.value method
278.0000 0.0112 Wilcoxon rank sum test with continuity correction

The Wilcoxon test is included as a nonparametric comparison, following the guide. It does not resolve dependence between adjacent weeks.

Interpretation and Discussion

Economic coverage averaged 1828.5 stories per week before the outbreak and 2175.73 afterward. The change (After minus Before) was 347.23 stories per week. Welch’s test produced t(54.54) = -3, p = 0.00412. The test table reports the opposite subtraction, Before minus After, for its confidence interval.

Neither Shapiro-Wilk test had p < .05. This does not establish normality or independence; inspect the histograms for outliers before interpreting Welch’s test.

Subject to its assumptions, Welch’s test indicates a statistically significant difference in average weekly coverage. The Wilcoxon rank-sum comparison produced W = 278, p = 0.0112.

Higher economic coverage after the outbreak would be consistent with increased attention to economic issues during wartime; lower coverage would be consistent with reduced attention. Neither pattern proves competition or reinforcement between war and economic coverage. This analysis does not directly measure military coverage, audience priorities, or the economic share of all news. Other events and time trends could explain a difference, and serial dependence could make the reported p-values too optimistic.

Weekly Data

Complete Saturday–Friday Weeks
week Period stories days_observed
2025-08-02 Before 1898 7
2025-08-09 Before 2149 7
2025-08-16 Before 1795 7
2025-08-23 Before 1841 7
2025-08-30 Before 1612 7
2025-09-06 Before 2197 7
2025-09-13 Before 1797 7
2025-09-20 Before 1773 7
2025-09-27 Before 2003 7
2025-10-04 Before 1564 7
2025-10-11 Before 1793 7
2025-10-18 Before 2267 7
2025-10-25 Before 2113 7
2025-11-01 Before 2652 7
2025-11-08 Before 2272 7
2025-11-15 Before 2507 7
2025-11-22 Before 1599 7
2025-11-29 Before 1801 7
2025-12-06 Before 2328 7
2025-12-13 Before 2135 7
2025-12-20 Before 1153 7
2025-12-27 Before 1029 7
2026-01-03 Before 1591 7
2026-01-10 Before 2026 7
2026-01-17 Before 1555 7
2026-01-24 Before 1615 7
2026-01-31 Before 1347 7
2026-02-07 Before 1498 7
2026-02-14 Before 1293 7
2026-02-21 Before 1652 7
2026-02-28 After 2277 7
2026-03-07 After 2987 7
2026-03-14 After 2676 7
2026-03-21 After 2453 7
2026-03-28 After 2831 7
2026-04-04 After 2164 7
2026-04-11 After 2605 7
2026-04-18 After 2218 7
2026-04-25 After 2655 7
2026-05-02 After 2703 7
2026-05-09 After 3108 7
2026-05-16 After 2927 7
2026-05-23 After 1991 7
2026-05-30 After 2282 7
2026-06-06 After 2622 7
2026-06-13 After 2315 7
2026-06-20 After 1899 7
2026-06-27 After 1430 7
2026-07-04 After 1259 7
2026-07-11 After 1522 7
2026-07-18 After 1701 7
2026-07-25 After 1757 7
2026-08-01 After 1728 7
2026-08-08 After 1508 7
2026-08-15 After 1549 7
2026-08-22 After 1857 7
2026-08-29 After 2121 7
2026-09-05 After 1999 7
2026-09-12 After 2060 7
2026-09-19 After 2068 7

Code Used

# Edit this one setting if the study window changes.
weeks_each_side <- 30L
event_date <- as.Date("2026-02-28")
start_date <- event_date - 7L * weeks_each_side
end_date <- event_date + 7L * weeks_each_side - 1L
collection_id <- 34412234

if (end_date >= Sys.Date()) {
  stop("The selected window contains an unfinished or future day. Choose fewer weeks.")
}
if (!nzchar(Sys.getenv("MEDIACLOUD_KEY"))) {
  stop("No MEDIACLOUD_KEY found. Set your MediaCloud API key and knit again.")
}
mc_key <- Sys.getenv("MEDIACLOUD_KEY")

economy_query <- paste0(
  'language:en AND ("United States" OR "U.S." OR American',
  ' OR Trump OR "Federal Reserve" OR "Bureau of Labor Statistics")',
  ' AND (inflation OR "cost of living" OR "consumer prices"',
  ' OR "gas prices" OR "gasoline prices" OR "food prices"',
  ' OR "grocery prices" OR unemployment OR "job market")'
)
mc_counts_over_time <- function(query, start_date, end_date,
                                collection_id = 34412234) {
  response <- request(
    "https://search.mediacloud.org/api/search/count-over-time"
  ) %>%
    req_headers(Authorization = paste("Token", mc_key)) %>%
    req_url_query(
      q = query,
      start = as.character(start_date),
      end = as.character(end_date + 1),
      platform = "onlinenews-mediacloud",
      cs = collection_id
    ) %>%
    req_timeout(120) %>%
    req_retry(max_tries = 3) %>%
    req_perform()

  rows <- resp_body_json(response)$count_over_time$counts
  if (is.null(rows) || length(rows) == 0) {
    stop("MediaCloud returned no daily rows. Check the query and dates.")
  }
  daily <- map_dfr(rows, as_tibble) %>%
    transmute(date = as.Date(date), count = as.numeric(count)) %>%
    filter(date >= start_date, date <= end_date) %>%
    arrange(date)

  expected_dates <- seq(start_date, end_date, by = "day")
  if (anyNA(daily) || any(!is.finite(daily$count)) || any(daily$count < 0) ||
      anyDuplicated(daily$date) > 0 ||
      !setequal(daily$date, expected_dates)) {
    stop("Daily rows are missing, duplicated, or invalid.")
  }
  daily
}

economic_daily <- mc_counts_over_time(
  economy_query, start_date, end_date, collection_id
)
weekly_counts <- economic_daily %>%
  mutate(week = floor_date(date, unit = "week", week_start = 6)) %>%
  group_by(week) %>%
  summarise(stories = sum(count), days_observed = n(), .groups = "drop") %>%
  mutate(Period = factor(if_else(week < event_date, "Before", "After"),
                         levels = c("Before", "After"))) %>%
  arrange(week)

stopifnot(nrow(weekly_counts) == 2L * weeks_each_side,
          all(weekly_counts$days_observed == 7L),
          all(table(weekly_counts$Period) == weeks_each_side))

# Define DV and IV following Dr. Blake's independent-samples template.
mydata <- weekly_counts %>% mutate(DV = stories, IV = Period)
options(scipen = 999)
group_means <- mydata %>% group_by(IV) %>%
  summarise(mean_DV = mean(DV), .groups = "drop")
Graphic <- ggplot(mydata, aes(x = DV)) +
  geom_histogram(bins = 10, color = "black", fill = "#1f78b4") +
  geom_vline(data = group_means, aes(xintercept = mean_DV),
             color = "red", linetype = "dashed") +
  facet_grid(IV ~ .) +
  labs(title = "Weekly Economic Coverage by Period",
       x = "Weekly economic stories", y = "Number of weeks") +
  theme_minimal()
Graphic
Descriptives <- mydata %>% group_by(IV) %>%
  summarise(count = n(), mean = mean(DV), sd = sd(DV),
            min = min(DV), max = max(DV), .groups = "drop")
DescriptivesTable <- Descriptives %>% gt() %>%
  fmt_number(columns = c(mean, sd, min, max), decimals = 2) %>%
  tab_header(title = "Weekly Economic Coverage: Descriptive Statistics")
DescriptivesTable
shapiro_summary <- mydata %>% group_by(IV) %>%
  summarise(W_statistic = shapiro.test(DV)$statistic,
            p_value = shapiro.test(DV)$p.value, .groups = "drop")
ShapiroTable <- shapiro_summary %>% gt() %>%
  fmt_number(columns = c(W_statistic, p_value), decimals = 4) %>%
  tab_header(title = "Shapiro-Wilk Normality Tests by Period") %>%
  tab_source_note(source_note = "With fewer than 40 weeks per group, inspect normality and outliers before interpreting the t-test. A nonsignificant Shapiro-Wilk test does not prove normality.")
ShapiroTable
t_res <- t.test(DV ~ IV, data = mydata, var.equal = FALSE)
t_table <- tidy(t_res) %>%
  select(estimate1, estimate2, statistic, parameter, p.value, conf.low, conf.high) %>%
  gt() %>%
  fmt_number(columns = everything(), decimals = 4) %>%
  tab_header(title = "Welch's Independent-Samples t-Test",
             subtitle = "Group 1 = Before; Group 2 = After; confidence interval = Before minus After")
t_table
wilcox_res <- wilcox.test(DV ~ IV, data = mydata, exact = FALSE)
WilcoxonTable <- tidy(wilcox_res) %>%
  select(statistic, p.value, method) %>% gt() %>%
  fmt_number(columns = c(statistic, p.value), decimals = 4) %>%
  tab_header(title = "Wilcoxon Rank-Sum Test")
WilcoxonTable

Code reference: Dr. Ken Blake’s R Data Analysis Guide, independent-samples t-test section. API retrieval and date validation are custom additions.