Rationale

In agenda-setting theory, specifically in the first and second levels, involves the media tell people what to think about (first level) and how to think about it (second level). While the first and second levels of agenda-setting theory are similar to framing, there are some main differences, including: agenda-setting focuses on which topic attributes the media directs public attention toward, while framing focuses on different characterizations of the same topic that evoke different interpretive contexts for the object.  In second-level agenda setting, repetition puts a perception of an object into your head or puts it at the top of your mind, while framing has context cues that pull a perception of the object out of your head and more deeply embed the repetition.

Considering what agenda-setting theory says, depending on where and how the person consumes media, it could influence how they view specific topics. A sample of 600 people was asked to focus on the subject of immigration (whether it was a top issue or not), with preferred networks being CNN or Fox News.

Hypothesis

Media viewers will have differing opinions on whether or not immigration is a top issue, depending on which news network (CNN or Fox News) they consume. I believe people whose preferred news network is CNN will be less likely to consider immigration as a top issue, while people whose preferred news network is Fox News will be more likely to consider immigration as a top issue.

Variables and method

The dependent variable (DV) in the chi-squared test was the topic of immigration — was it a top issue or not.

The test’s independent variable (IV) was the viewers’ preferred network. The two networks include CNN and Fox News.

The 600 participants in the chi-square test will rank whether the DV is a topic issue based on their preferred networks mentioned previously.

Results and discussion

The graph and crosstabulation table below summarize the association between the dependent and independent variables. The chi-squared results are shown as well.

The hypothesis was proven true. The chi-squared statistic for this test equaled 55.4%.

When looking at the chart created when performing the test, of the 300 people who watched CNN as their preferred network, more than 250 people did not view immigration as a top issue.

In comparison, the 300 people who viewed Fox News as their preferred network, almost 200 of those viewers found immigration to be the top issue.  

The chi-squared test found the association statistically significant since the p-value was less than 0.05.


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%)

Code

Here is the R script that gathered the data and produced the results.

{r, include=FALSE}
# ------------------------------
# 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