In agenda setting theory, a consumer’s public agenda is formed through exposure to and a melding of various medias, including traditional, social and personal. As McCombs and Shaw concluded in 1972, elements in mass media, if prominent, can become prominent in the public’s mind.
With that in mind, it would be expected that if a particular news network frequently ran stories about a particular issue, then when viewers of that network were asked about their top concern affecting the nation, viewers of that network would be more likely to mention the issue that had been highlighted in a substantial number of reports.
Fox and CNN viewers will have significantly different views on whether immigration is the most important problem facing the U.S. right now, due to a substantial difference in the number of stories focusing on immigration on the two networks. More specifically, Fox viewers will be more likely to name immigration as the top problem than CNN viewers. This is based on a GDELT analysis of Fox and CNN coverage mentioning “immigration” in the months leading up to the survey found that Fox consistently devoted more coverage to “immigration” than CNN had.
The dependent variable in this analysis was immigration and whether those surveyed named it as the top issue facing the U.S. right now or something else . The categorical independent variable was whether the person being surveyed was typically a Fox News or CNN viewer.
600 people, evenly divided between frequent Fox News or CNN viewers, were polled for a larger national survey conducted in September of 2023, asking them, “What do you think is the top issue facing the U.S. right now?” If the person answered “immigration,” it would be categorized as “top issue.” If they answered something else, then it would be categorized as “not top issue.”
A chi-square(d) t-test was used to test for a statistically significant difference between the answers provided by the Fox and CNN viewers.
The graph below contrasts the group distributions and averages, and the table shows the results of the chi-square(d)-test. You will see that the hypothesis was validated as a majority of the CNN viewers gave an answer other than immigration while more than a third of the Fox viewers stated immigration was the top issue.
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 |
Here is the R-script that gathered the data and produced the three graphs/charts:
# ------------------------------
# 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