In agenda-setting theory, topics and issues covered by the media influence what the public considers important. Simply put, media coverage does not tell people what to think, but it is successful at telling the public what to think about. (McCombs, Shaw 1972)
Unlike media framing theory — which affects perception using embedded context cues in media coverage — agenda-setting theory suggests the public agenda and the salience of topics depend on the amount of repetition and coverage media outlets devote to a particular issue or topic.
Considering what the theory says, the number of times news outlets produce stories on a certain topic should elevate the level of importance of that topic in the public’s mind. Specifically, the frequency in which a news outlet covers the topic of immigration should influence how important this issue is for voters.
Viewers of national news outlets will assign a different priority to the topic of immigration depending on which news outlet they prefer and the frequency in which those outlets devote coverage to the topic of immigration.
Both the independent and dependent variables in the analysis are categorical. The independent variable indicates which national news outlet — CNN or Fox News — the viewer frequently views. By contrast, the dependent variable indicates whether immigration was, or was not, the issue the respondent named when asked, “What is the most important problem facing the U.S. right now?”
The responses were collected from 600 frequent Fox News or CNN viewers pulled from a larger national survey conducted in September 2023. Each response represents one viewer.
A crosstabulation was conducted to measure the counts and percentages of respondents and the differences in their answers. A chi-square test of independence was then conducted to determine whether these differences were too large to be explained by randomness.
The first table below provides a crosstabulation of responses in the survey. The crosstabulation shows there is a significant difference in the percentage of people who frequently watch Fox News — compared to CNN — who consider immigration to be the top issue facing the United States currently. Specifically, 38.3 percent of frequent Fox News viewers thought immigration was the top issue, while only 11.7 percent of frequent CNN users felt the same.
The second table below shows the results of the chi-square test of independence, which includes a p-value of 0.000. This indicates the two variables are not independent of each other, and as such, the hypothesis can be accepted with a high amount of confidence.
| Crosstabulation of DV by IV | ||
| Counts and (Column Percentages) | ||
| CNN | Fox | |
|---|---|---|
| 1 Top issue | 35 (11.7%) | 115 (38.3%) |
| 2 Not top issue | 265 (88.3%) | 185 (61.7%) |
| Chi-squared Test Results | |||
| Test of Independence between DV and IV | |||
| Test | Chi-squared Statistic | Degrees of Freedom | p-value |
|---|---|---|---|
| Chi-squared Test of Independence | 55.476 | 1 | 0.000 |
# ------------------------------
# Setup: Install and load packages
# ------------------------------
if (!require("tidyverse")) install.packages("tidyverse") # Data wrangling & plotting
if (!require("gmodels")) install.packages("gmodels") # Crosstabs
if (!require("gt")) install.packages("gt") # Table formatting
library(tidyverse)
library(gmodels)
library(gt)
# ------------------------------
# Load the data
# ------------------------------
# Replace "YOURFILENAME.csv" with your dataset name
mydata <- read.csv("TopIssue.csv") #Edit
# ------------------------------
# Define Dependent (DV) and Independent (IV) variables
# ------------------------------
# Replace YOURDVNAME and YOURIVNAME with actual column names in your data
mydata$DV <- mydata$Immigration #Edit
mydata$IV <- mydata$PreferredNetwork #Edit
# ------------------------------
# Visualization: Stacked bar chart of IV by DV
# ------------------------------
graph <- ggplot(mydata, aes(x = IV, fill = DV)) +
geom_bar(colour = "black") +
scale_fill_brewer(palette = "Paired") +
labs(
title = "Distribution of DV by IV",
x = "Independent Variable",
y = "Count",
fill = "Dependent Variable"
)
#Show the graph
graph
# ------------------------------
# Crosstabulation of DV by IV (DV = rows, IV = columns)
# ------------------------------
crosstab <- mydata %>%
count(DV, IV) %>%
group_by(IV) %>%
mutate(RowPct = 100 * n / sum(n)) %>%
ungroup() %>%
mutate(Cell = paste0(n, "\n(", round(RowPct, 1), "%)")) %>%
select(DV, IV, Cell) %>%
pivot_wider(names_from = IV, values_from = Cell)
# Format into gt table
crosstab_table <- crosstab %>%
gt(rowname_col = "DV") %>%
tab_header(
title = "Crosstabulation of DV by IV",
subtitle = "Counts and (Column Percentages)"
) %>%
cols_label(
DV = "Dependent Variable"
)
# Show the polished crosstab table
crosstab_table
# ------------------------------
# Chi-squared test of independence
# ------------------------------
options(scipen = 999) # Prevents scientific notation
chitestresults <- chisq.test(mydata$DV, mydata$IV)
# ------------------------------
# Format Chi-squared test results into a table
# ------------------------------
chitest_summary <- tibble(
Test = "Chi-squared Test of Independence",
Chi_sq = chitestresults$statistic,
df = chitestresults$parameter,
p = chitestresults$p.value
)
chitest_table <- chitest_summary %>%
gt() %>%
# Round χ² and p-value to 3 decimals, df to integer
fmt_number(columns = c(Chi_sq, p), decimals = 3) %>%
fmt_number(columns = df, decimals = 0) %>%
tab_header(
title = "Chi-squared Test Results",
subtitle = "Test of Independence between DV and IV"
) %>%
cols_label(
Test = "Test",
Chi_sq = "Chi-squared Statistic",
df = "Degrees of Freedom",
p = "p-value"
)
# Show the formatted results table
chitest_table