# Setting up library and data
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.2.1     ✔ readr     2.2.0
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.3     ✔ tibble    3.3.1
## ✔ lubridate 1.9.5     ✔ tidyr     1.3.2
## ✔ purrr     1.2.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
trends <- read_csv("ATP W163.csv")
## Rows: 5097 Columns: 73
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (2): INTERVIEW_START_W163, INTERVIEW_END_W163
## dbl (71): QKEY, DEVICE_TYPE_W163, SVYMODE_W163, LANG_W163, FORM_W163, SNSUSE...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Introduction

My research question was: Is there a relationship between political party and belief that social media helps draw attention to important, underrepresented issues?

My dataset is from 2025 and contains 73 variables relating to demographic information and social/political views and 5097 responses from Americans across the country. The variables relevant to my dataset were political party and answer to social media question 9_c, which asked “How well do you think each of the following statements describes social media? Social media highlights important issues that might not get a lot of attention otherwise.” Respondents could indicate their political party to be “democrat,” “republican,” “independent,” or “other.” Respondents could respond to the social media question with an an answer of “very well,” “somewhat well,” “not too well,” or “not at all well.” I will refer to the social question media variable with the term “social media stance” moving forward.

I used the “American Trends Panel Wave 163” dataset from the Pew Research Center: https://www.pewresearch.org/dataset/american-trends-panel-wave-163/.

Data Analysis

To clean my dataset, I selected the columns for the two variables I am using and renamed them to something clearer. I mutated the values in both columns to be factors (democrat or republican) instead of numbers. I filtered out any responses with a political party other than democrat or republican and any responses that did not provide a social media stance. Because I have two categorical variables, I chose to visualize my data with a side-by-side bar chart and a two-way-table. I also made a proportions table.

# Renaming the relevant columns and selecting only them.
trends <- trends %>% 
  mutate(sm_stance = SM9_c_W163, party = F_PARTY_FINAL) %>%
  select("sm_stance", "party")

# Mutating the party column to identify democrats and republicans and all other responses as NA. Then converting the party column into factors.
trends <- trends %>%
  mutate(party = case_when(
    party == 1 ~ "Republican",
    party == 2 ~ "Democrat",
    TRUE ~ NA
  )) %>%
  mutate(party = as.factor(party)) 

# Mutating the sm_stance column to identify what response was given and converting non responses to NA. The converting the column into factors.  
trends <- trends %>%
  mutate(sm_stance = case_when(
    sm_stance == 1 ~ "Very well",
    sm_stance == 2 ~ "Somewhat well",
    sm_stance == 3 ~ "Not too well",
    sm_stance == 4 ~ "Not at all well",
    TRUE ~ NA
  )) %>%
  mutate(party = as.factor(party)) 

# Filtering out rows with NA in either column.
trends <- trends %>%
  filter(!is.na(party)) %>%
  filter(!is.na(sm_stance))
# Creating a two-way table and proportions table with my variables.
table_sm_party <- table(trends$sm_stance, trends$party)
prop_table_sm_party <- prop.table(table_sm_party)
table_sm_party
##                  
##                   Democrat Republican
##   Not at all well      133         87
##   Not too well         380        322
##   Somewhat well        937        639
##   Very well            310        250
prop_table_sm_party
##                  
##                     Democrat Republican
##   Not at all well 0.04349248 0.02844997
##   Not too well    0.12426422 0.10529758
##   Somewhat well   0.30640942 0.20896010
##   Very well       0.10137345 0.08175278
# Creating a side-by-side bar chart with my variables. I used tips in: https://rpubs.com/dvdunne/ggplot_two_bars.
ggplot(trends, aes(x=sm_stance, fill=party))+
  geom_bar(position='dodge') +
  labs(title="Social Media Stance by Party", x="Social media highlights important issues that might not get attention otherwise", y="Number of Responses", fill="Party")

Statistical Analysis

H0: party and social media stance are independent

H1: party and social media stance are associated

I used a chi-square test because I had two categorical variables, and I wanted to determine if they were associated or independent. My research question did not specifically compare proportions, so a z-test was not appropriate. Since I did not have a continuous variable, a linear model or t-test were also not appropriate. My minimum expected value for any of the categories in the chi-square test was 93, which is greater than 5, so a chi-square test is reliable for this data. I chose to use the conventional α = 0.05.

p = 0.05602, α = 0.05, df = 3, and X2 = 7.5605. We cannot reject the null hypothesis because p is not less than alpha. Therefore, we do not have enough evidence to conclude that there is a relationship between political party and social media stance.

# Using the chisq.test function and inputting the two-way table I made earlier.

chisqtest <- chisq.test(table_sm_party)
chisqtest
## 
##  Pearson's Chi-squared test
## 
## data:  table_sm_party
## X-squared = 7.5605, df = 3, p-value = 0.05602
# Using the min function and $ operator to find the minimum expected value of the test. 
min(chisqtest$expected)
## [1] 93.38129
chisqtest$expected
##                  
##                   Democrat Republican
##   Not at all well 126.6187   93.38129
##   Not too well    404.0288  297.97122
##   Somewhat well   907.0504  668.94964
##   Very well       322.3022  237.69784

Conclusion and Future Directions

My key finding was that I do not have evidence that political party and the belief that social media draws attention to important, underrepresented issues are associated. My research question is relevant because Americans increasingly get news from social media and blog posts, which sometimes address topics not covered by larger news media. If one party is more likely to have a positive opinion of these sources, that may influence how members of that party tend to get their news or how much they trust social media.

Even though I did not find an association, future research can still ask questions about the relationship between political views and trust of information on social media or amount of social media news consumption. The American Trends Panel Wave 163 has other questions about social media, such as if social media is a valuable means of political expression, and it has other questions about political views, such as the strength of one’s party affiliation and their lean towards conservative vs liberal views. Future research could explore if these other views on social media do have an association with party or if the strength of party affiliation mediates the relationship between social media stance and political party.

References

“American Trends Panel Wave 163.” Pew Research Center, 16 Sept. 2025, www.pewresearch.org/dataset/american-trends-panel-wave-163/. Accessed 16 June 2026. Dunne, Dave. “RPubs - Side by Side Bars in Ggplot.” Rpubs.com, rpubs.com/dvdunne/ggplot_two_bars.