rm(list=ls())
library(MASS)
library(tidyverse)
## ── Attaching packages ─────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.2.1 ✔ purrr 0.3.2
## ✔ tibble 2.1.3 ✔ dplyr 0.8.3
## ✔ tidyr 1.0.0 ✔ stringr 1.4.0
## ✔ readr 1.3.1 ✔ forcats 0.4.0
## ── Conflicts ────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::select() masks MASS::select()
library(corrplot)
## corrplot 0.84 loaded
library(interactions)
library(BayesFactor)
## Loading required package: coda
## Loading required package: Matrix
##
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
##
## expand, pack, unpack
## ************
## Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
##
## Type BFManual() to open the manual.
## ************
df_raw <- read_csv("/Users/ashish/files/research/perab/data/raw/PerabW1_V4_Transformed_IntuitiveNames.csv")
## Parsed with column specification:
## cols(
## .default = col_double(),
## recentpol_open = col_character(),
## news_open1 = col_character(),
## news_open2 = col_character(),
## news_open3 = col_character(),
## jail_repclassinfo = col_character(),
## jail_partviolprotest = col_character(),
## jail_corruption = col_character(),
## jail_unclassinfo = col_character(),
## jail_orgviolrally = col_character(),
## jail_engageviolspeech = col_character(),
## jail_advocateviolspeech = col_character(),
## jail_harrassofficial = col_character(),
## punish_comey = col_character(),
## punish_govofficials = col_character(),
## punish_offobstruct = col_character(),
## libcon_self = col_character(),
## libcon_trump = col_character(),
## partisan_fam = col_character(),
## partisan_friends = col_character(),
## race_other = col_character()
## # ... with 174 more columns
## )
## See spec(...) for full column specifications.
These columns have the stem: > “In the past six months, how often have you…?”
The columns are:
direct_action_cols <- c("action_contofficial",
"action_petition",
"action_rally",
"action_joingroup",
"action_encourage")
This column has the stem: > “Since the election last November, would you say that your are…?”
The answer values are categorical and correspond to:
pol_activity_cf_cols <- c("pol_activity")
These columns most directly correspond to items on the ERQ. The question stem is: > “Think about how you dealt with recent political news that was upsetting to you. How often, if at all, did you use the following strategies to manage or control your emotions to feel better? Some of the questions may seem similar but they are different in important ways so please consider each one carefully.”
The columns are:
reappraisal_basic_cols <- c("per_posreapp",
"per_negreapp")
These columns I selected based on an exploratory factor analysis where three factors emerged. I interpreted this set of columns to all be attempting to engage in some type of cognitive change. (The other two factors were avoidance and social strategies.) The stem for these columns are the same as the previous section. The indidivual items are as follows:
reappraisal_like_cols <- c("per_posreapp",
"per_negreapp",
"per_longterm",
"per_objective",
"per_accept",
"per_understand",
"per_seekinfo")
These columns had the stem:
“When you think about recent political news, how much do you feel the following emotion?”
pos_emo_cols <- c("emo_excited", "emo_proud")
neg_emo_cols <- c("emo_angry", "emo_disgusted", "emo_anxious", "emo_shock", "emo_sad")
These are all the emotion regulation strategies queried.
er_strategy_cols <- c("per_avoid", "per_distract", "per_expressed",
"per_posreapp", "per_negreapp", "per_longterm",
"per_objective", "per_keeptoself", "per_notexpress",
"per_accept", "per_understand", "per_socialsupport", "per_seekinfo")
This was an attention check that 30% of the sample failed. The results look nearly the same when you omit the failures.
attention_check <- c("NCC3_6_5", "NCC3_7_5")
Here I am making columns that aggregate the
df <- df_raw %>%
mutate(
direct_action = rowMeans(df_raw[,direct_action_cols], na.rm = T),
neg_emo_mean = rowMeans(df_raw[,neg_emo_cols], na.rm = T),
reappraisal_basic = rowMeans(df_raw[,reappraisal_basic_cols], na.rm = T),
reappraisal_like = rowMeans(df_raw[,reappraisal_like_cols], na.rm = T),
pol_activity_cf = fct_recode(as.factor(pol_activity),
"more"= "1",
"less" = "2",
"same" = "3"),
pol_activity_cf_more = (pol_activity_cf == "more"),
pol_activity_cf_less = (pol_activity_cf == "less"),
pol_extremity = abs(as.numeric(libcon_self) - 4)
)# %>% filter(NCC3_6_5 == 2 | NCC3_7_5 == 2)
## Warning: NAs introduced by coercion
df_lib <- df %>%
filter(libcon_self %in% 1:3)
df_conservative <- df %>%
filter(libcon_self %in% 5:7)
df_lib %>%
pivot_longer(cols = direct_action_cols, names_to = "action_type", values_to = "action_amount") %>%
ggplot(aes(x = action_amount, fill = action_type)) +
geom_histogram(position = position_dodge(), binwidth = .2) +
scale_x_continuous(labels = c("Never", "Once or twice", "Several times", "Many times"))
df_lib %>%
ggplot(aes(x = direct_action)) +
geom_histogram(binwidth = .2)
140 students who voted for Clinton.
Are the two general reappraisal items predictive of the mean of the action columns?
df_lib %>%
ggplot(aes(x = reappraisal_basic, y = direct_action)) +
geom_jitter(alpha = .2) +
geom_smooth(method="loess") +
geom_smooth(method="lm", linetype="dotted")
df_lib %>%
lm(direct_action ~ reappraisal_basic, .) %>%
summary
##
## Call:
## lm(formula = direct_action ~ reappraisal_basic, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.8495 -0.6340 -0.2223 0.5660 2.1816
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.810621 0.060473 29.941 <2e-16 ***
## reappraisal_basic 0.007782 0.024669 0.315 0.752
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7615 on 1162 degrees of freedom
## Multiple R-squared: 8.563e-05, Adjusted R-squared: -0.0007749
## F-statistic: 0.0995 on 1 and 1162 DF, p-value: 0.7525
with(df_lib,
correlationBF(direct_action, reappraisal_basic))
## Bayes factor analysis
## --------------
## [1] Alt., r=0.333 : 0.07223411 ±0%
##
## Against denominator:
## Null, rho = 0
## ---
## Bayes factor type: BFcorrelation, Jeffreys-beta*
df_lib %>%
ggplot(aes(x = reappraisal_like, y = direct_action)) +
geom_jitter(width = .05, alpha = .2) +
geom_smooth(method="loess") +
geom_smooth(method = "lm", linetype = "dotted")
df_lib %>%
lm(direct_action ~ reappraisal_like, .) %>%
summary
##
## Call:
## lm(formula = direct_action ~ reappraisal_like, data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.0638 -0.6537 -0.1891 0.5342 2.2433
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.51430 0.09200 16.459 < 2e-16 ***
## reappraisal_like 0.11314 0.03217 3.517 0.000453 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7575 on 1162 degrees of freedom
## Multiple R-squared: 0.01053, Adjusted R-squared: 0.009683
## F-statistic: 12.37 on 1 and 1162 DF, p-value: 0.0004527
with(df_lib,
cor.test(direct_action, reappraisal_like))
##
## Pearson's product-moment correlation
##
## data: direct_action and reappraisal_like
## t = 3.5174, df = 1162, p-value = 0.0004527
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.04544896 0.15915904
## sample estimates:
## cor
## 0.1026393
with(df_lib,
correlationBF(direct_action, reappraisal_like))
## Bayes factor analysis
## --------------
## [1] Alt., r=0.333 : 31.32176 ±0%
##
## Against denominator:
## Null, rho = 0
## ---
## Bayes factor type: BFcorrelation, Jeffreys-beta*
df_lib %>%
lm(as.formula(paste("direct_action ~ ", paste(reappraisal_like_cols, collapse = "+"))), .) %>%
summary
##
## Call:
## lm(formula = as.formula(paste("direct_action ~ ", paste(reappraisal_like_cols,
## collapse = "+"))), data = .)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.5331 -0.5433 -0.1434 0.4346 2.3583
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.4355771 0.0881546 16.285 < 2e-16 ***
## per_posreapp -0.0007294 0.0266495 -0.027 0.9782
## per_negreapp -0.0065992 0.0258421 -0.255 0.7985
## per_longterm 0.0318169 0.0234097 1.359 0.1744
## per_objective 0.0020786 0.0241064 0.086 0.9313
## per_accept -0.1553631 0.0205102 -7.575 7.33e-14 ***
## per_understand 0.0473567 0.0236916 1.999 0.0459 *
## per_seekinfo 0.1911902 0.0210027 9.103 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.7047 on 1156 degrees of freedom
## Multiple R-squared: 0.148, Adjusted R-squared: 0.1428
## F-statistic: 28.68 on 7 and 1156 DF, p-value: < 2.2e-16