anonymous-submission-acl2025's picture
add 36
b1a2e61
---
title: "Replication Code for Lucid Survey Data Analysis"
author: "Brian Guay & Christopher Johnston"
date: "6/18/2020"
output:
html_document:
number_sections: yes
toc: yes
pdf_document:
toc: yes
subtitle: Ideological Asymmetries and the Determinants of Politically-Motivated Reasoning
(American Journal of Political Science, 2020)
---
```{r knitr setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Introduction
This markdown file contains the code necessary to run the analysis using data collected from the 2018 Lucid survey (Studies 1 and 2).
When compiling in markdown, verify that this markdown file is saved in the same folder as the other replication. R Markdown will set the working directory to this folder by default. When running the code line-by-line, set the working directory to the same location as these materials are located.
# Setup
```{r setup, warning = F, echo = T, message = F, include = T}
# Clear working environment
rm(list = ls())
# Log output
sink(file = "lucid_code_log.txt")
# Create folder to store figures
dir.create("lucid_figures")
# Install required packages
install.packages(c("grDevices", "ggplot2", "dplyr", "estimatr", "psych", "knitr"))
# Load packages
library(grDevices) # for plotting
library(ggplot2) # for plotting
library(dplyr) # for data cleaning
library(estimatr) # for robust standard errors
library(psych) # for calculating measures of internal consistency
library(knitr) # for compiling markdown
# Load post functions (see README file for description)
source("post.R")
source("postSim.R")
# Function for running lm function with common set of controls
quick_lm <- function(outcome = my_outcome, keepers = my_keepers,
new = NULL, data = my_data){
keepers <- paste(keepers, collapse = " + ")
new <- paste(new, collapse = " + ")
rhs <- paste(keepers, new, sep = " + ")
model <- paste0(outcome, " ~ ", rhs)
fit <- lm(as.formula(model), data = data)
}
# Function for running glm function with common set of controls
quick_glm <- function(outcome = my_outcome, keepers = my_keepers,
new = NULL, data = my_data){
keepers <- paste(keepers, collapse = " + ") # character string of IVs separated by "+"
new <- paste(new, collapse = " + ") # new variables
rhs <- paste(keepers, new, sep = " + ") #paste keepers and new
model <- paste0(outcome, " ~ ", rhs) #
fit <- glm(as.formula(model), data = data, family = binomial(link = "logit"))
}
# Function to make colors in base R plots transparent
makeTransparent<-function(someColor, alpha=100)
{
newColor<-col2rgb(someColor)
apply(newColor, 2, function(curcoldata){rgb(red=curcoldata[1], green=curcoldata[2],
blue=curcoldata[3],alpha=alpha,
maxColorValue=255)})
}
# Standard error
std_error <- function(var){
sd(var, na.rm = T) / sqrt(length(var[!is.na(var)]))
}
# Function to put variables on a 0-1 scale
rescale_01 <- function(x, max){
(x-1)/(max-1)
}
# Set seed
set.seed(4453)
# Set number of simulations for post-estimation to 10000
nsims <- 10000
# Import data
data_original <- read.csv("lucid_data.csv", na.strings=c("","NA"))
```
# Data Cleanining
## Attention Checks
As discussed in the manuscript, respondents who failed at least one of the two attention checks were prevented from completing the remainder of the survey. Additionally, respondents who proceeded to use a mobile device for the survey (despite being instructed that they would be unable to complete the survey) were prevented from completing the survey. 1.4% of respondents were removed for using a mobile device, 5.9\% were removed for failing the Trump attention check (correctly identifying Trump as the president of the United States), and 6.9\% were removed for failing the numeracy attention check (correctly adding 2 + 2).
```{r, warning = F, echo = F, message = F, include = T}
# Breakdown of respondents who were kicked off survey
table(data_original$kickoff)
prop.table(table(data_original$kickoff, useNA = "always"))*100
# 1.37% kicked off for using a mobile device
# 5.87% kicked off for failing Trump attention check
# 6.86% kicked off for failing numeracy attention check
# Exclude respondents who were kicked off survey
data <- data_original[is.na(data_original$kickoff),]
nrow(data) # 1,816 respondents in analytical sample
```
## Party ID and Ideology
```{r}
# Political Party ------------------------------------------------------------------------
data$pid7 <- ifelse(data$pid_gen == 1, data$demstr,
ifelse(data$pid_gen == 2, data$repstr,
ifelse(data$pid_gen > 2, data$pidlean, NA)))
# Indicator for Republican (vs. Democrat) ------------------------------------------------
# where Republican = 1, Democrat = 0, and Independent = NA
data$rep_dem <- ifelse(data$pid7 < 4, 0,
ifelse(data$pid7 > 4, 1, NA))
table(data$pid7, data$rep_dem, useNA = "always")
# Ideology -------------------------------------------------------------------------------
data$ideo7 <- data$ideo
data$ideo7[data$ideo7 == -99] <- NA
table(data$ideo, data$ideo7, useNA = "always")
# Indicator for Conservative (vs. Liberal) -----------------------------------------------
data$con_lib <- ifelse(data$ideo7 < 4, 0,
ifelse(data$ideo7 > 4, 1, NA))
table(data$ideo7, data$con_lib, useNA = "always")
```
## Experiment 1 (Evidence Interpretation Task)
Respondents were randomly assigned to received evidence about one of five salient political issues (\textit{issue}: a concealed handgun ban, a minimum wage increase, affirmative action, sanctuary cities, or abortion. Respondents were also randomized to receive evidence that supported the liberal or conservative position on the assigned issue, which was achieved by changing the words “increase” and “decrease” in the column names in the evidence table (\textit{evidence direction}, see Appendix for full question wording).
### Create Variables Indicating Issue and Evidence Direction Condition Assignment
```{r}
# Create variable for evidence direction condition ---------------------------------------
data$exp1_condition <-
ifelse(data$DO.BR.FL_133 == "Direction Experiments--Condition A", "A",
ifelse(data$DO.BR.FL_133 == "Direction Experiments-- Condition B", "B", "foo"))
table(data$exp1_condition, data$DO.BR.FL_133, useNA = "always")
# Create variable for issue condition assignment -----------------------------------------
table(data$pol_issue, useNA = "always") # distribution of issue asssignment variable
# Create character versoion of issue assignment variable
data$pol_issue.ch <- as.character(data$pol_issue)
table(data$pol_issue, data$pol_issue.ch, useNA = "always")
# drop original pol_issue variable
data <- select(data, -c(pol_issue))
# create final issue assignment variable with abbreviated level names
data$exp1_issue <-
ifelse(data$pol_issue.ch == "abortion", "abort",
ifelse(data$pol_issue.ch == "affirmative action", "aa",
ifelse(data$pol_issue.ch == "sanctuary cities", "imm",
ifelse(data$pol_issue.ch == "raising the minimum wage", "wage",
ifelse(data$pol_issue.ch == "carrying concealed handguns", "gun",
"foo")))))
table(data$exp1_issue, data$pol_issue.ch, useNA = "always")
# remove pol_issue.ch
data <- select(data,-c(pol_issue.ch))
# Create indicator for whether evidence points toward liberal position -------------------
data$exp1_liberal_evidence <-
ifelse(data$exp1_condition == "A" & data$exp1_issue %in% c("gun", "wage", "imm"), 1,
ifelse(data$exp1_condition == "B" & data$exp1_issue %in% c("aa", "abort"), 1, 0))
table(data$exp1_liberal_evidence, data$exp1_condition, data$exp1_issue)
```
### Combine Outcome Measure Colummns Into Single Variable
Which survey questions respondents answer is dependent on the experimental condition each is assigned to. For instance, a respondent assigned to the gun control condition received questions about gun control and not, for instance, immigration. Therefore, responses to experimental outcomes are recorded in different columns in the data set. To combine to different outcome measures responses into a single column, we sum across all outcome measures (regardless of whether the respondent was assigned to answer each measure). Because the rowSums() function ignores missing values (i.e., NAs), and outcome measures which respondents were not assigned to answer contain NAs, the column containing the sum contains the appropriate outcome response for each respondent.
There are 10 columns in which the experimental outcome can be recorded, as there are 10 experimental conditions: 5 (issue condition = abortion, affirmative action, gun control, minimum wage, or immigration) X 2 (evidence direction condition = A or B). In the code below we use the following shorthand to refer to each issue: abort = abortion, aa = affirmative action, gun = gun control, wage = minimum wage, imm = immigration.
```{r}
# Combine Experiment 1 Outcomes Into Single Variable (ex)
# Create vector of outcome variable names from survey
# (A = direction condition A, B = direction condition B)
exp1_A <- c("exp1_abort_A", "exp1_aa_A", "exp1_gun_A", "exp1_wage_A", "exp1_imm_A")
exp1_B <- c("exp1_abort_B", "exp1_aa_B", "exp1_gun_B", "exp1_wage_B", "exp1_imm_B")
# all outcome variables are integer vectors
apply(data[,c(exp1_A, exp1_B)], 2, class)
# 4 unique values of outcome variables
apply(data[,c(exp1_A, exp1_B)], 2, unique)
# Sum across columns for respondents in evidence direction condition A
data$response_1A <- rowSums(data[,exp1_A], na.rm=T)
data$response_1A[data$response_1A == -99] <- NA # recode skipped responses as NA
data$response_1A[data$response_1A == 0] <- NA # recode 0 as NA, since NA + NA = 0
head(data[1:200,c(exp1_A, "response_1A")]) # verify method
# Sum across columns for respondents in evidence direction condition B
data$response_1B <- rowSums(data[,exp1_B], na.rm=T)
data$response_1B[data$response_1B == -99] <- NA # recode skipped, but seen responses as NA
data$response_1B[data$response_1B == 0] <- NA # recode 0 as NA, since NA + NA = 0
head(data[1:200,c(exp1_B, "response_1B")]) # verify method
# Create one response variable for experiment 1, combining direction conditions A and B.
data$exp1_response <-
ifelse(data$exp1_condition == "A", data$response_1A,
ifelse(data$exp1_condition == "B", data$response_1B, 9999))
# Verify method
table(data$exp1_response, data$response_1A, useNA = "always")
table(data$exp1_response, data$response_1B, useNA = "always")
```
### Create Indicator for Correct Response for Experiment 1
1 indicates correct interpretation of the evidence and 0 indicates incorrect interpretation. In direction condition A, the 2nd response option is correct. In direction condition B, the 1st response option is correct.
```{r}
data$exp1_correct <-
ifelse(data$exp1_condition == "A" & data$exp1_response == 2, 1,
ifelse(data$exp1_condition == "A" & data$exp1_response == 1, 0,
ifelse(data$exp1_condition == "B" & data$exp1_response == 2, 0,
ifelse(data$exp1_condition == "B" & data$exp1_response == 1, 1,
9999))))
table(data$exp1_correct, useNA = "always")
```
## Experiment 2
For Experiment 2, respondents were randomly assigned to receive evidence about one of the four remaining issues that they were not assigned to in the Experiment 1 (i.e., if a respondent in Experiment 1 received information about gun control, they were randomly assigned to receive information about either a minimum wage increase, affirmative action, sanctuary cities, or abortion in Experiment 2). Respondents were again randomized to receive evidence that supported either the liberal or conservative position on the assigned issue. Below we follow the same approach as followed in Experiment 1, above.
### Create Variables Indicating Issue and Evidence Direction Condition Assignment
```{r}
# Create variable for experimental condition
data$exp2_condition <-
ifelse(data$DO.BR.FL_137 == "Quality Experiments-- Condition A", "A",
ifelse(data$DO.BR.FL_137 == "Quality Experiments-- Condition B", "B", NA))
table(data$DO.BR.FL_137, data$exp2_condition)
# Create variable indicating the issue each respondent received
data$pol_issue_2.ch <- as.character(data$pol_issue_2)
table(data$pol_issue_2, data$pol_issue_2.ch)
# Drop original pol_issue variable
data <- select(data, -c(pol_issue_2))
data$exp2_issue <-
ifelse(data$pol_issue_2.ch == "abortion", "abort",
ifelse(data$pol_issue_2.ch == "affirmative action", "aa",
ifelse(data$pol_issue_2.ch == "sanctuary cities", "imm",
ifelse(data$pol_issue_2.ch == "raising the minimum wage", "wage",
ifelse(data$pol_issue_2.ch == "carrying concealed handguns",
"gun", NA)))))
table(data$pol_issue_2.ch, data$exp2_issue)
# Drop original pol_issue.ch variable
data <- select(data, -c(pol_issue_2.ch))
# Create indicator for whether evidence points toward liberal position
data$exp2_liberal_evidence <- ifelse(data$exp2_condition == "A" &
data$exp2_issue %in% c("aa", "abort"), 1,
ifelse(data$exp2_condition == "B" &
data$exp2_issue %in% c("gun", "wage", "imm"), 1, 0))
```
### Aggregate Outcome Responses Across Conditions
Following the same procedure used in Experiment 1, we create a common response variable for Experiment 2 below. Because there are two outcomes in Experiment 2, the 'sample size' and 'causal claim' outcomes, we create two common response variables.
```{r}
# Exp 2 (Condition A, Sample Size)
exp2_A_sample <- c("exp2_abort_A_1", "exp2_aa_A_1", "exp2_gun_A_1",
"exp2_wage_A_1", "exp2_imm_A_1")
# Exp 2 (Condition B, Sample Size)
exp2_B_sample <- c("exp2_abort_B_1", "exp2_aa_B_1", "exp2_gun_B_1",
"exp2_wage_B_1", "exp2_imm_B_1")
# Exp 2 (Condition A, Causal)
exp2_A_causal <- c("exp2_abort_A_2", "exp2_aa_A_2", "exp2_gun_A_2",
"exp2_wage_A_2", "exp2_imm_A_2")
# Exp 2 (Condition B, Causal)
exp2_B_causal <- c("exp2_abort_B_2", "exp2_aa_B_2", "exp2_gun_B_2",
"exp2_wage_B_2", "exp2_imm_B_2")
# Collapse response variable for sample size question
data$exp2_sample <- rowSums(data[,c(exp2_A_sample, exp2_B_sample)], na.rm=T)
data$exp2_sample[data$exp2_sample == 0] <- NA
data$exp2_sample[data$exp2_sample == -99] <- NA
head(data[1:200,c(exp2_A_sample, exp2_B_sample, "exp2_sample")]) # verify method
# Reverse code sample size outcome, such that high values indicate size is sufficient
# (note: causal outcome is already coded such that higher values indicate that a causal
# claim can be made)
table(data$exp2_sample)
data$exp2_goodSample <- 8 - data$exp2_sample
table(data$exp2_sample, data$exp2_goodSample)
# Create response variable for causal inference outcome
data$exp2_goodCausal <- rowSums(data[,c(exp2_A_causal, exp2_B_causal)], na.rm=T)
data$exp2_goodCausal[data$exp2_goodCausal == 0] <- NA #recode unseen skipped responses as NA
data$exp2_goodCausal[data$exp2_goodCausal == -99] <- NA #recode seen skipped responses as NA
head(data[1:200,c(exp2_A_causal, exp2_B_causal, "exp2_goodCausal")]) # verify method
```
## Create Congeniality Variables For Experiments 1 and 2
Now that we have collapsed outcome variables into a single outcome variable for Experiment 1 and two outcome variables for Experiment 2 (sample size and causal claim outcomes), we next determine whether each respondent received congenial or uncongenial information, based upon both the direction of the information they were randomly assigned to receive and their prior beliefs. As explained in the manuscript and appendix, we operationalize prior beliefs separately in three ways: the respondent's party identification, self-reported ideology, and position on the issue they received information about. For each operationalization, we create two congeniality variables: a continuous version (e.g., 1 = very uncongenial, 7 = very congenial) and a binary version (e.g., 0 = uncongenial, 1 = congenial). For the binary measure, moderates and non-leaning Independents (for the party ID and ideology operationalizations of congeniality, respectively), are coded as NA. For the continuous measures, they are coded as 4, at the center of the continuous measures, which range from 1-7. Issue positions are measured on a 6-point scale, so the issue position operationalization of congeniality does not face a similar issue.
### Experiment 1
```{r}
# Party ID -------------------------------------------
# Binary
data$exp1_congenial_pid_binary <-
ifelse(data$pid7 < 4 & data$exp1_liberal_evidence == 1, 1,
ifelse(data$pid7 > 4 & data$exp1_liberal_evidence == 0, 1,
ifelse(data$pid7 == 4, NA, 0)))
head(data[,c("exp1_congenial_pid_binary", "exp1_liberal_evidence", "pid7")]) # verify
# Continuous
data$exp1_congenial_pid_cont <-
ifelse(data$exp1_liberal_evidence == 1, 8 - data$pid7,
ifelse(data$exp1_liberal_evidence == 0, data$pid7, NA))
data$exp1_congenial_pid_cont.s <- as.numeric(scale(data$exp1_congenial_pid_cont))
head(data[,c("exp1_congenial_pid_cont", "exp1_liberal_evidence", "pid7")]) # verify
# Ideology ---------------------------------------------------
# Binary
data$exp1_congenial_ideo_binary <-
ifelse(data$ideo7 < 4 & data$exp1_liberal_evidence == 1, 1,
ifelse(data$ideo7 > 4 & data$exp1_liberal_evidence == 0, 1,
ifelse(data$ideo7 == 4, NA, 0)))
data[1:10,c("exp1_congenial_ideo_binary", "exp1_liberal_evidence", "ideo7")] # verify
# Continuous
data$exp1_congenial_ideo_cont <-
ifelse(data$exp1_liberal_evidence == 1, 8 - data$ideo7,
ifelse(data$exp1_liberal_evidence == 0, data$ideo7, NA))
data$exp1_congenial_ideo_cont.s <- as.numeric(scale(data$exp1_congenial_ideo_cont))
data[1:10,c("exp1_congenial_ideo_cont", "exp1_liberal_evidence", "ideo7")] # verify
# Issue Position -------------------------------------------------------------------------
# Continuous
# distributions of issue position variables (note that skipped responses = -99)
apply(data[,c("issue_gun", "issue_aa", "issue_abort", "issue_imm", "issue_wage")],
2, function(x) table(x, useNA = "always"))
# recode NAs
data$issue_gun[data$issue_gun == -99] <- NA
data$issue_aa[data$issue_aa == -99] <- NA
data$issue_abort[data$issue_abort == -99] <- NA
data$issue_imm[data$issue_imm == -99] <- NA
data$issue_wage[data$issue_wage == -99] <- NA
# verify
apply(data[,c("issue_gun", "issue_aa", "issue_abort", "issue_imm", "issue_wage")],
2, function(x) table(x, useNA = "always"))
# recode such that higher values indicate liberal positions
data$gun_lib <- 7 -data$issue_gun
data$wage_lib <- data$issue_wage # already coded in correct direction
data$aa_lib <- data$issue_aa # already coded in correct direction
data$imm_lib <- 7 - data$issue_imm
data$abort_lib <- 7 - data$issue_abort
issue_vars <- c("gun_lib", "wage_lib", "aa_lib", "imm_lib", "wage_lib")
psych::alpha(data[,issue_vars]) # verify all load in same direction
# Initialize continuous issue congeniality measure
data$exp1_congenial_issue_cont <- NA
# note that the logic of the creation of this continuous congeniality measure is
# similar to that of the continuous pid and ideology congeniality measures, though
# in this case the issue positions are coded such that liberal values are larger
# (for pid and ideology, larger values indicated more conservative views). This difference
# is taken into account below.
data$exp1_congenial_issue_cont <-
ifelse(data$exp1_issue == "gun" & data$exp1_liberal_evidence == 1, data$gun_lib,
ifelse(data$exp1_issue == "gun" & data$exp1_liberal_evidence == 0, 7 - data$gun_lib,
ifelse(data$exp1_issue == "wage" & data$exp1_liberal_evidence == 1, data$wage_lib,
ifelse(data$exp1_issue == "wage" & data$exp1_liberal_evidence == 0, 7 - data$wage_lib,
ifelse(data$exp1_issue == "aa" & data$exp1_liberal_evidence == 1, data$aa_lib,
ifelse(data$exp1_issue == "aa" & data$exp1_liberal_evidence == 0, 7 - data$aa_lib,
ifelse(data$exp1_issue == "imm" & data$exp1_liberal_evidence == 1, data$imm_lib,
ifelse(data$exp1_issue == "imm" & data$exp1_liberal_evidence == 0, 7 - data$imm_lib,
ifelse(data$exp1_issue == "abort" & data$exp1_liberal_evidence == 1, data$abort_lib,
ifelse(data$exp1_issue == "abort" & data$exp1_liberal_evidence == 0, 7 - data$abort_lib,
NA))))))))))
data$exp1_congenial_issue_cont.s <- as.numeric(scale(data$exp1_congenial_issue_cont))
# Binary
data$exp1_congenial_issue_binary <- ifelse(data$exp1_congenial_issue_cont >= 4, 1,
ifelse(data$exp1_congenial_issue_cont < 4, 0, NA))
table(data$exp1_congenial_issue_binary, data$exp1_congenial_issue_cont) # verify
# Check correlations between continuous pid, ideology, and issue measures of congeniality
cor(data$exp1_congenial_pid_cont.s,
data$exp1_congenial_ideo_cont.s,
use = "complete.obs")
cor(data$exp1_congenial_pid_cont.s,
data$exp1_congenial_issue_cont.s,
use = "complete.obs")
cor(data$exp1_congenial_ideo_cont.s,
data$exp1_congenial_issue_cont.s,
use = "complete.obs")
```
### Experiment 2
```{r}
# Party ID -------------------------------------------------------------------------------
# Binary
data$exp2_congenial_pid_binary <-
ifelse(data$pid7 < 4 & data$exp2_liberal_evidence == 1, 1,
ifelse(data$pid7 > 4 & data$exp2_liberal_evidence == 0, 1,
ifelse(data$pid7 == 4, NA, 0)))
# Continous
data$exp2_congenial_pid_cont <-
ifelse(data$exp2_liberal_evidence == 1, 8 - data$pid7,
ifelse(data$exp2_liberal_evidence == 0, data$pid7, NA))
data$exp2_congenial_pid_cont.s <- as.numeric(scale(data$exp2_congenial_pid_cont))
# Ideology -------------------------------------------------------------------------------
# Binary
data$exp2_congenial_ideo_binary <-
ifelse(data$ideo7 < 4 & data$exp2_liberal_evidence == 1, 1,
ifelse(data$ideo7 > 4 & data$exp2_liberal_evidence == 0, 1,
ifelse(data$ideo7 == 4, NA, 0)))
# Continuous ideo congeniality measure ---------------------------------------------------
data$exp2_congenial_ideo_cont <-
ifelse(data$exp2_liberal_evidence == 1, 8 - data$ideo7,
ifelse(data$exp2_liberal_evidence == 0, data$ideo7, NA))
data$exp2_congenial_ideo_cont.s <- as.numeric(scale(data$exp2_congenial_ideo_cont))
# Issue Position -------------------------------------------------------------------------
# Continuous
# Initialize continuous congeniality measure
data$exp2_congenial_issue_cont <- NA
data$exp2_congenial_issue_cont <-
ifelse(data$exp2_issue == "gun" & data$exp2_liberal_evidence == 1, data$gun_lib,
ifelse(data$exp2_issue == "gun" & data$exp2_liberal_evidence == 0, 7 - data$gun_lib,
ifelse(data$exp2_issue == "wage" & data$exp2_liberal_evidence == 1, data$wage_lib,
ifelse(data$exp2_issue == "wage" & data$exp2_liberal_evidence == 0, 7 - data$wage_lib,
ifelse(data$exp2_issue == "aa" & data$exp2_liberal_evidence == 1, data$aa_lib,
ifelse(data$exp2_issue == "aa" & data$exp2_liberal_evidence == 0, 7 - data$aa_lib,
ifelse(data$exp2_issue == "imm" & data$exp2_liberal_evidence == 1, data$imm_lib,
ifelse(data$exp2_issue == "imm" & data$exp2_liberal_evidence == 0, 7 - data$imm_lib,
ifelse(data$exp2_issue == "abort" & data$exp2_liberal_evidence == 1, data$abort_lib,
ifelse(data$exp2_issue == "abort" & data$exp2_liberal_evidence == 0, 7 - data$abort_lib,
NA))))))))))
data$exp2_congenial_issue_cont.s <- as.numeric(scale(data$exp2_congenial_issue_cont))
# Binary
data$exp2_congenial_issue_binary <-
ifelse(data$exp2_congenial_issue_cont >= 4, 1,
ifelse(data$exp2_congenial_issue_cont < 4, 0, NA))
```
## Standardize Outcomes for Experiment 2
```{r}
# Unstandardized version of DVs
data$exp2_goodSample_uns <- data$exp2_goodSample
data$exp2_goodCausal_uns <- data$exp2_goodCausal
# Drop original variables
data <- data %>% dplyr::select(-exp2_goodSample, -exp2_goodCausal)
colnames(data)[grep(colnames(data), pattern = "good")] # verify
# Standardize DVs
data$exp2_goodSample <- as.numeric(scale(data$exp2_goodSample_uns))
data$exp2_goodCausal <- as.numeric(scale(data$exp2_goodCausal_uns))
table(data$exp2_goodSample, data$exp2_goodSample_uns)
table(data$exp2_goodCausal, data$exp2_goodCausal_uns)
```
## Put Continuous Congeniality Measures on 0-1 Scale
```{r}
data$exp1_congenial_issue_cont.01 <- (data$exp1_congenial_issue_cont -1)/5
data$exp1_congenial_ideo_cont.01 <- (data$exp1_congenial_ideo_cont -1)/6
data$exp1_congenial_pid_cont.01 <- (data$exp1_congenial_pid_cont -1)/6
data$exp2_congenial_issue_cont.01 <- (data$exp2_congenial_issue_cont -1)/5
data$exp2_congenial_ideo_cont.01 <- (data$exp2_congenial_ideo_cont -1)/6
data$exp2_congenial_pid_cont.01 <- (data$exp2_congenial_pid_cont -1)/6
with(data,table(exp1_congenial_pid_cont.01, exp1_congenial_pid_cont))
with(data,table(exp1_congenial_ideo_cont.01, exp1_congenial_ideo_cont))
with(data,table(exp1_congenial_issue_cont.01, exp1_congenial_issue_cont))
with(data,table(exp2_congenial_pid_cont.01, exp2_congenial_pid_cont))
with(data,table(exp2_congenial_ideo_cont.01, exp2_congenial_ideo_cont))
with(data,table(exp2_congenial_issue_cont.01, exp2_congenial_issue_cont))
```
## Need for Closure
```{r}
# Original coding: low values = open, high values = closed
nfc_vars <- paste("nfc", 1:10, sep = "_")
apply(data[,nfc_vars], 2, function(x) table(x, useNA = "always"))
data[,nfc_vars][data[,nfc_vars] == -99] <- NA
data$nfc_mean <- rowMeans(data[,nfc_vars], na.rm=T)
data$nfc_mean.s <- as.numeric(scale(data$nfc_mean))
psych::alpha(data[,nfc_vars])
```
## 5-item Mini IPIP
```{r}
pip_vars_original <- paste("pip", 1:5, sep = "_")
apply(data[,pip_vars_original], 2, function(x) table(x, useNA = "always"))
# Recode NAs
data[,pip_vars_original][data[,pip_vars_original] == -99] <- NA
# Verify
apply(data[,pip_vars_original], 2, function(x) table(x, useNA = "always"))
# Reverse code two of the PIP variables
# pip_1: 5 = have vivid imagination
data$pip_1.r <- 6 - data$pip_1
table(data$pip_1, data$pip_1.r) #check
# pip_5: 5 = love to think up new ways of doing things
data$pip_5.r <- 6 - data$pip_5
table(data$pip_5, data$pip_5.r) #check
# Variables that do not need to be recoded:
# pip_2: 5 = not interested in abstract ideas
# pip_3: 5 = have difficulty understanding abstract ideas
# pip_4: 5 = do not have good imagination
pip_vars <- c("pip_1.r", "pip_2", "pip_3", "pip_4", "pip_5.r")
psych::alpha(data[,pip_vars]) # verify that items load in same direction
# Create mean mini-IPIP score
data$pip_mean <- rowMeans(data[,pip_vars], na.rm=T)
```
## Schwartz Values
```{r}
# Direction of original coding: higher values correspond to...
# sv1 = open
# sv2 = closed
# sv3 = closed
# sv4 = open
# sv5 = closed
sv_vars_original <- c("sv_1", "sv_2", "sv_3", "sv_4", "sv_5")
apply(data[,sv_vars_original], 2, table)
data[,sv_vars_original][data[,sv_vars_original] == -99] <- NA
apply(data[,sv_vars_original], 2, table) # verify
# Variables that need to be recoded are 1 and 4:
data$sv_1.r <- 6 - data$sv_1
table(data$sv_1, data$sv_1.r)
data$sv_4.r <- 6 - data$sv_4
table(data$sv_4, data$sv_4.r)
sv_vars <- c("sv_1.r", "sv_2", "sv_3", "sv_4.r", "sv_5")
psych::alpha(data[,sv_vars])
# Create mean variable
data$sv_mean <- rowMeans(data[,sv_vars], na.rm=T)
```
## Create Openness Index (NFC, IPIP, & Schwartz)
We create a mean openness trait index by averaging all items from each scale.
```{r}
# Check consistency among 3 mean variables
psych::alpha(data[,c("nfc_mean", "pip_mean", "sv_mean")])
# put mean indices on 0-1 scale
data$nfc_mean.01 <- rescale_01(data$nfc_mean, max = 6)
data$pip_mean.01 <- rescale_01(data$pip_mean, max = 5)
data$sv_mean.01 <- rescale_01(data$sv_mean, max = 5)
# create mean trait index
data$trait_index <- rowMeans(data[,c("nfc_mean.01", "pip_mean.01", "sv_mean.01")], na.rm=T)
data$trait_index.s <- as.numeric(scale(data$trait_index))
```
## Political Identity
```{r}
# recode NAs
data[,paste("pol_id_", 1:4, sep = "")][data[,paste("pol_id_", 1:4, sep = "")] == -99] <- NA
# high values correspond to strong political identity for items 2 and 4. So recode items
# 1 and 3.
data$pol_id_1.r <- 6 - data$pol_id_1
data$pol_id_2.r <- data$pol_id_2
data$pol_id_3.r <- 6 - data$pol_id_3
data$pol_id_4.r <- data$pol_id_4
pol_id_vars <- c("pol_id_1.r", "pol_id_2.r", "pol_id_3.r", "pol_id_4.r")
psych::alpha(data[,pol_id_vars]) #good
# create mean score
data$pol_id <- rowMeans(data[,pol_id_vars], na.rm=T)
data$pol_id.s <- as.numeric(scale(data$pol_id))
```
## Partisan Identity
```{r new}
# 4 = being party member is extremely important to me
data$huddy_import <- ifelse(data$pid7 < 4, data$dem_import,
ifelse(data$pid7 > 4, data$rep_import, NA))
# 4 = party describes me extremely well
data$huddy_describe <- ifelse(data$pid7 < 4, data$dem_describe,
ifelse(data$pid7 > 4, data$rep_describe, NA))
# 5 = use "we" all the time to talk about party
data$huddy_we <- ifelse(data$pid7 < 4, data$dem_we,
ifelse(data$pid7 > 4, data$rep_we, NA))
# 4 = think about myself as party member a great deal
data$huddy_think <- ifelse(data$pid7 < 4, data$dem_think,
ifelse(data$pid7 > 4, data$rep_think, NA))
huddy_vars <- c("huddy_import", "huddy_describe", "huddy_we", "huddy_think")
# distribution of responses
apply(data[,huddy_vars], 2, function(x) table(x, useNA = "always"))
# recode NAs
data[,huddy_vars][data[,huddy_vars] < 0] <- NA
# create standardized mean scale
data$huddy_import.01 <- rescale_01(data$huddy_import, max = 4)
data$huddy_describe.01 <- rescale_01(data$huddy_describe, max = 4)
data$huddy_we.01 <- rescale_01(data$huddy_we, max = 5)
data$huddy_think.01 <- rescale_01(data$huddy_think, max = 4)
# verify
apply(data[,paste(huddy_vars, ".01", sep = "")], 2, range, na.rm=T)
psych::alpha(data[,c("huddy_import.01", "huddy_describe.01",
"huddy_we.01", "huddy_think.01")])
data$huddy_id <- rowMeans(data[,c("huddy_import.01", "huddy_describe.01",
"huddy_we.01", "huddy_think.01")], na.rm=T)
data$huddy_id.s <- as.numeric(scale(data$huddy_id))
```
## Numeracy
```{r}
rasch_vars <- c("rasch_1", "rasch_2", "rasch_3", "rasch_4",
"rasch_5", "rasch_6", "rasch_7")
#apply(data[,rasch_vars], 2, function(x) table(x, useNA = "always"))
apply(data[,rasch_vars], 2, class)
# recode character vectors as numeric vectors
data$rasch_1.r <- as.numeric(as.character(data$rasch_1))
data$rasch_2.r <- as.numeric(as.character(data$rasch_2))
data$rasch_3.r <- as.numeric(as.character(data$rasch_3))
data$rasch_4.r <- as.numeric(as.character(data$rasch_4))
data$rasch_5.r <- as.numeric(as.character(data$rasch_5))
data$rasch_6.r <- as.numeric(as.character(data$rasch_6))
data$rasch_7.r <- as.numeric(as.character(data$rasch_7))
rasch_vars.r <- paste(rasch_vars, ".r", sep = "")
# recode NAs
data[,rasch_vars.r][data[,rasch_vars.r] == -99] <- NA
# create indicators for correct responses
data$rasch_1_corr <- ifelse(data$rasch_1.r == 10, 1, 0)
data$rasch_2_corr <- ifelse(data$rasch_2.r == .1, 1, 0)
data$rasch_6_corr <- ifelse(data$rasch_6.r == 20, 1, 0)
data$rasch_5_corr <- ifelse(data$rasch_5.r == 100, 1, 0)
data$rasch_3_corr <- ifelse(data$rasch_3.r == 4, 1, 0)
data$rasch_4_corr <- ifelse(data$rasch_4.r == 29, 1, 0)
data$rasch_7_corr <- ifelse(data$rasch_7.r == 500, 1, 0)
rasch_corr_vars <- c("rasch_1_corr", "rasch_2_corr", "rasch_3_corr", "rasch_4_corr",
"rasch_5_corr", "rasch_6_corr", "rasch_7_corr")
apply(data[,rasch_corr_vars], 2, function(x)
round(prop.table(table(x)),2))
psych::alpha(data[,rasch_corr_vars])
# create mean numeracy score
data$numeracy <- rowMeans(data[,rasch_corr_vars], na.rm=T)
data$numeracy.s <- as.numeric(scale(data$numeracy))
```
## Political Knowledge
```{r}
apply(data[,c("pk_speaker", "pk_senterm", "pk_cj", "pk_merkel", "pk_putin")], 2,
function(x) table(x, useNA = "always"))
data$pk_speaker_corr <- ifelse(data$pk_speaker == 4, 1,
ifelse(data$pk_speaker == -99, NA, 0))
data$pk_senterm_corr <- ifelse(data$pk_senterm == 3, 1,
ifelse(data$pk_senterm == -99, NA, 0))
data$pk_cj_corr <- ifelse(data$pk_cj == 3, 1,
ifelse(data$pk_cj == -99, NA, 0))
data$pk_merkel_corr <- ifelse(data$pk_merkel == 2, 1,
ifelse(data$pk_merkel == -99, NA, 0))
data$pk_putin_corr <- ifelse(data$pk_putin == 2, 1,
ifelse(data$pk_putin == -99, NA, 0))
pk_vars <- c("pk_speaker_corr", "pk_senterm_corr", "pk_cj_corr",
"pk_merkel_corr", "pk_putin_corr")
apply(data[,pk_vars], 2, function(x) prop.table(table(x)))
data$pk_mean <- rowMeans(data[,pk_vars])
data$pk_mean.s <- as.numeric(scale(data$pk_mean))
cor(data$pk_mean, data$pk_mean.s, use = "complete.obs")
psych::alpha(data[,pk_vars])
```
## Demographics
```{r}
# Gender
table(data$gender, useNA = "always")
data$female <- ifelse(data$gender == 2, 1, 0)
data$female[data$female == -99] <- NA
table(data$female, useNA = "always")
table(data$gender, data$female)
# Race
# note: respondents were instructed to check all that apply: 1 = White, 2 = Black,
# 3 = Hispanic, 4 = Asian, 5 = Native American, 6 = Middle Eastern,
# 7 = Mixed race, 8 = Other
# recode NAs
data$race_1[data$race_1 == -99] <- NA
data$race_2[data$race_2 == -99] <- NA
data$race_3[data$race_3 == -99] <- NA
data$race_4[data$race_4 == -99] <- NA
data$race_5[data$race_5 == -99] <- NA
data$race_6[data$race_6 == -99] <- NA
data$race_7[data$race_7 == -99] <- NA
data$race_white <- ifelse(data$race_1 == 1, 1, 0)
data$race_black <- ifelse(data$race_2 == 1, 1, 0)
data$race_other <- ifelse(data$race_4 == 1 | data$race_5 == 1 | data$race_6 == 1 |
data$race_7 == 1 | data$race_8 == 1, 1, 0)
data$hispanic <- ifelse(data$race_3 == 1, 1, 0)
data$nonhisp_black <- ifelse(data$race_2 == 1 & data$race_3 != 1, 1, 0)
# Education
# 1 = < HS, 2 = HS, 3 = some college, 4 = 2-yr college, 5 = 4-yr college, 6 = postgrad
data$education <- data$educatt
data$education[data$education == -99] <- NA
data$edu_lesshs <- ifelse(data$education == 1, 1, 0)
data$edu_hs <- ifelse(data$education == 2, 1, 0)
data$edu_somecollege <- ifelse(data$education == 3 | data$education == 4, 1, 0)
data$edu_college <- ifelse(data$education == 5, 1, 0)
data$edu_grad <- ifelse(data$education == 6, 1, 0)
# Age
data$age <- 2018-data$birthyr
data$age.s <- as.numeric(scale(data$age))
# Income
# 1-13 scale, where 1 = < 10k, 13 = > 150k
data$income <- data$faminc
data$income[data$income == -99] <- NA
data$income.s <- as.numeric(scale(data$income))
```
# Analysis: Ideological Asymmetries in PMR
## Model Nominclature
The following naming syntax is used when running models and calculating quantities of interest below.
- mx = model x (where m1 = asymmetry model and m2 = moderation model)
- ex = experiment x
- where:
- e1 = experiment 1
- e2ss = experiment 2, sample size outcome
- e2cc = experiment 2, causal claim outcome
- iss/ideo/pid/ = operationalization of R's L/R dimension
- where, iss = issue; ideo = ideology; pid = party id.
- lib/con = data is subsetted to those individuals who received either
- liberal (lib) or conservative (con) -leaning evidence
- Example: m1_e1_iss_lib
- m1 = model 1 (asymmetry model)
- e1 = experiment 1
- iss = L/R dimension defined by R's issue position
- lib = R received liberal-leaning evidence in experiment 1
The first set of models ("Asymmetry Models") explore the extent to which there exists an asymmetry in how liberals and conservatives engage in politically motivated reasoning. In total, there are 18 models (3 (interpretation DV, sample size DV, causal claim DV) X 3 (L/R dimension = issue stance, ideology, party ID) X 2 (liberal, conservative evidence)): we run separate models for each of the 3 experimental outcomes: Experiment 1 (interpretation outcome), Experiment 2 (sample size outcome), and Experiment 2 (causal claim outcome), each operationalization of the respondent's L/R dimension (issue stance, self-reported ideology, and self-reported party ID), and respondents' who were randomly assigned to receive liberal- or conservative-leaning evidence. \\
Order of Asymmetry Models:
- Models for Experiment 1
- L/R = issue position, liberal evidence
- L/R = issue position, conservative evidence
- L/R = ideology, liberal evidence
- L/R = ideology, conservative evidence
- L/R = party ID, liberal evidence
- L/R = party ID, conservative evidence
- Models for Experiment 2 (Sample Size outcome)
- L/R = issue position, liberal evidence
- L/R = issue position, conservative evidence
- L/R = ideology, liberal evidence
- L/R = ideology, conservative evidence
- L/R = party ID, liberal evidence
- L/R = party ID, conservative evidence
- Models for Experiment 2 (Causal Claim outcome)
- L/R = issue position, liberal evidence
- L/R = issue position, conservative evidence
- L/R = ideology, liberal evidence
- L/R = ideology, conservative evidence
- L/R = party ID, liberal evidence
- L/R = party ID, conservative evidence
## Create common set of controls for all models
```{r warning = F, echo = F, message = F, include = T}
# asymmetry models, experiment 1
m1_e1_controls <- "exp1_issue"
# assymetry models, experiment 2
m1_e2_controls <- "exp2_issue"
# moderation models, experiment 1
m2_e1_controls <- "age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + exp1_issue"
# moderation models, experiment 2
m2_e2_controls <- "age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + exp2_issue"
```
## Create Variable for Whether R Has Liberal or Conservative View on the Issue They Received Evidence About
Higher values indicate more conservative-leaning evidence.
```{r}
# Experiment 1 ---------------------------------------------------------------------------
# continuous
data$exp1_issue_lr <- ifelse(data$exp1_issue == "gun", 7 - data$gun_lib,
ifelse(data$exp1_issue == "aa", 7 - data$aa_lib,
ifelse(data$exp1_issue == "wage", 7 - data$wage_lib,
ifelse(data$exp1_issue == "abort", 7 - data$abort_lib,
ifelse(data$exp1_issue == "imm", 7 - data$imm_lib, NA)))))
table(data$exp1_issue_lr, useNA = "always")
# binary
data$exp1_issue_lr_binary <- ifelse(data$exp1_issue_lr <= 3, 0,
ifelse(data$exp1_issue_lr >= 4, 1, NA))
table(data$exp1_issue_lr, data$exp1_issue_lr_binary, useNA = "always")
# Experiment 2 ---------------------------------------------------------------------------
# continuous
data$exp2_issue_lr <- ifelse(data$exp2_issue == "gun", 7 - data$gun_lib,
ifelse(data$exp2_issue == "aa", 7 - data$aa_lib,
ifelse(data$exp2_issue == "wage", 7 - data$wage_lib,
ifelse(data$exp2_issue == "abort", 7 - data$abort_lib,
ifelse(data$exp2_issue == "imm", 7 - data$imm_lib, NA)))))
# binary
data$exp2_issue_lr_binary <- ifelse(data$exp2_issue_lr <= 3, 0,
ifelse(data$exp2_issue_lr >= 4, 1, NA))
table(data$exp2_issue_lr, data$exp2_issue_lr_binary, useNA = "always")
```
## Binary Models (For Main Analysis)
```{r warning = F, echo = F, message = F, include = T}
# Experiment 1 ---------------------------------------------------------------------------
#L/R = issue
m1_e1_iss_lib <- quick_glm(outcome = "exp1_correct",
new = "exp1_issue_lr_binary",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_iss_con <- quick_glm(outcome = "exp1_correct",
new = "exp1_issue_lr_binary",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
#L/R = ideology
m1_e1_ideo_lib <- quick_glm(outcome = "exp1_correct",
new = "con_lib",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_ideo_con <- quick_glm(outcome = "exp1_correct",
new = "con_lib",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
#L/R = party id
m1_e1_pid_lib <- quick_glm(outcome = "exp1_correct",
new = "rep_dem",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_pid_con <- quick_glm(outcome = "exp1_correct",
new = "rep_dem",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
#L/R = issue
m1_e2ss_iss_lib <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_issue_lr_binary",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_iss_con <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_issue_lr_binary",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = ideology
m1_e2ss_ideo_lib <- quick_lm(outcome = "exp2_goodSample",
new = "con_lib",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_ideo_con <- quick_lm(outcome = "exp2_goodSample",
new = "con_lib",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = party id
m1_e2ss_pid_lib <- quick_lm(outcome = "exp2_goodSample",
new = "rep_dem",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_pid_con <- quick_lm(outcome = "exp2_goodSample",
new = "rep_dem",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
#L/R = issue
m1_e2cc_iss_lib <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_issue_lr_binary",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_iss_con <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_issue_lr_binary",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = ideology
m1_e2cc_ideo_lib <- quick_lm(outcome = "exp2_goodCausal",
new = "con_lib",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_ideo_con <- quick_lm(outcome = "exp2_goodCausal",
new = "con_lib",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = party id
m1_e2cc_pid_lib <- quick_lm(outcome = "exp2_goodCausal",
new = "rep_dem",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_pid_con <- quick_lm(outcome = "exp2_goodCausal",
new = "rep_dem",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
```
## Binary Post-Estimation
```{r warning = F, echo = F, message = F, include = T}
# Experiment 1 ---------------------------------------------------------------------------
p_m1_e1_iss_lib <- post(model = m1_e1_iss_lib,
x1name = "exp1_issue_lr_binary", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e1_iss_con <- post(model = m1_e1_iss_con,
x1name = "exp1_issue_lr_binary",x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e1_ideo_lib <- post(model = m1_e1_ideo_lib,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e1_ideo_con <- post(model = m1_e1_ideo_con,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e1_pid_lib <- post(model = m1_e1_pid_lib,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e1_pid_con <- post(model = m1_e1_pid_con,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
p_m1_e2ss_iss_lib <- post(model = m1_e2ss_iss_lib,
x1name = "exp2_issue_lr_binary", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2ss_iss_con <- post(model = m1_e2ss_iss_con,
x1name = "exp2_issue_lr_binary", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2ss_ideo_lib <- post(model = m1_e2ss_ideo_lib,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2ss_ideo_con <- post(model = m1_e2ss_ideo_con,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2ss_pid_lib <- post(model = m1_e2ss_pid_lib,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2ss_pid_con <- post(model = m1_e2ss_pid_con,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
p_m1_e2cc_iss_lib <- post(model = m1_e2cc_iss_lib,
x1name = "exp2_issue_lr_binary", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2cc_iss_con <- post(model = m1_e2cc_iss_con,
x1name = "exp2_issue_lr_binary", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2cc_ideo_lib <- post(model = m1_e2cc_ideo_lib,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2cc_ideo_con <- post(model = m1_e2cc_ideo_con,
x1name = "con_lib", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2cc_pid_lib <- post(model = m1_e2cc_pid_lib,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
p_m1_e2cc_pid_con <- post(model = m1_e2cc_pid_con,
x1name = "rep_dem", x1vals = c(0, 1),
n.sims = nsims, digits = 5)
# Calculate Mean Differences and Confidence Intervals ------------------------------------
# Experiment 1
d_m1_e1_iss <- (p_m1_e1_iss_con@sims[,ncol(p_m1_e1_iss_con@sims)] -
p_m1_e1_iss_lib@sims[,ncol(p_m1_e1_iss_lib@sims)]) -
(p_m1_e1_iss_lib@sims[,1] -
p_m1_e1_iss_con@sims[,1])
d_m1_e1_ideo <- (p_m1_e1_ideo_con@sims[,ncol(p_m1_e1_ideo_con@sims)] -
p_m1_e1_ideo_lib@sims[,ncol(p_m1_e1_ideo_lib@sims)]) -
(p_m1_e1_ideo_lib@sims[,1] -
p_m1_e1_ideo_con@sims[,1])
d_m1_e1_pid <- (p_m1_e1_pid_con@sims[,ncol(p_m1_e1_pid_con@sims)] -
p_m1_e1_pid_lib@sims[,ncol(p_m1_e1_pid_lib@sims)]) -
(p_m1_e1_pid_lib@sims[,1] -
p_m1_e1_pid_con@sims[,1])
# Experiment 2 (Sample Size)
d_m1_e2ss_iss <- (p_m1_e2ss_iss_con@sims[,ncol(p_m1_e2ss_iss_con@sims)] -
p_m1_e2ss_iss_lib@sims[,ncol(p_m1_e2ss_iss_lib@sims)]) -
(p_m1_e2ss_iss_lib@sims[,1] -
p_m1_e2ss_iss_con@sims[,1])
d_m1_e2ss_ideo <- (p_m1_e2ss_ideo_con@sims[,ncol(p_m1_e2ss_ideo_con@sims)] -
p_m1_e2ss_ideo_lib@sims[,ncol(p_m1_e2ss_ideo_lib@sims)]) -
(p_m1_e2ss_ideo_lib@sims[,1] -
p_m1_e2ss_ideo_con@sims[,1])
d_m1_e2ss_pid <- (p_m1_e2ss_pid_con@sims[,ncol(p_m1_e2ss_pid_con@sims)] -
p_m1_e2ss_pid_lib@sims[,ncol(p_m1_e2ss_pid_lib@sims)]) -
(p_m1_e2ss_pid_lib@sims[,1] -
p_m1_e2ss_pid_con@sims[,1])
# Experiment 2 (Causal Claim)
d_m1_e2cc_iss <- (p_m1_e2cc_iss_con@sims[,ncol(p_m1_e2cc_iss_con@sims)] -
p_m1_e2cc_iss_lib@sims[,ncol(p_m1_e2cc_iss_lib@sims)]) -
(p_m1_e2cc_iss_lib@sims[,1] -
p_m1_e2cc_iss_con@sims[,1])
d_m1_e2cc_ideo <- (p_m1_e2cc_ideo_con@sims[,ncol(p_m1_e2cc_ideo_con@sims)] -
p_m1_e2cc_ideo_lib@sims[,ncol(p_m1_e2cc_ideo_lib@sims)]) -
(p_m1_e2cc_ideo_lib@sims[,1] -
p_m1_e2cc_ideo_con@sims[,1])
d_m1_e2cc_pid <- (p_m1_e2cc_pid_con@sims[,ncol(p_m1_e2cc_pid_con@sims)] -
p_m1_e2cc_pid_lib@sims[,ncol(p_m1_e2cc_pid_lib@sims)]) -
(p_m1_e2cc_pid_lib@sims[,1] -
p_m1_e2cc_pid_con@sims[,1])
# Create table of differences and means --------------------------------------------------
# as dataframe
d_names <- as.data.frame(cbind(d_m1_e1_iss, d_m1_e1_ideo, d_m1_e1_pid,
d_m1_e2ss_iss, d_m1_e2ss_ideo, d_m1_e2ss_pid,
d_m1_e2cc_iss, d_m1_e2cc_ideo, d_m1_e2cc_pid))
# as numeric vector
d_names_r <- c(d_m1_e1_iss, d_m1_e1_ideo, d_m1_e1_pid,
d_m1_e2ss_iss, d_m1_e2ss_ideo, d_m1_e2ss_pid,
d_m1_e2cc_iss, d_m1_e2cc_ideo, d_m1_e2cc_pid)
# calculate means and 95% confidence intervals
dtbl <- data.frame(name = colnames(d_names),
mean = apply(d_names, 2, mean),
ci.lo = apply(d_names, 2, quantile, probs = .025),
ci.hi = apply(d_names, 2, quantile, probs = .975))
```
## Binary Figures
We create separate figures for each experimental outcome (Experiment 1; Experiment 2 Sample Size outcome; and Experiment 2 Causal Claim outcome). For each of these experimental outcomes, we create separate figures for each operationalization of a respondent's L/R dimension (issue position, ideology, and party ID). This results in 9 figures. For the sake of simplicity, the 3 figures for each experimental outcome are horizontally arranged in a single pdf file.
```{r warning = F, echo = F, message = F, include = T}
# ----------------------------------------------------------------------------------------
# Experiment 1 ---------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_b_asym_1.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,2,1.1,1))
# Issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(.20, .70),
xlab = "Issue Position",
ylab = "Pr(Correct)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e1_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e1_iss_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e1_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e1_iss_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_iss_lib@est[1:2,2],
y1 = p_m1_e1_iss_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_iss_con@est[1:2,2],
y1 = p_m1_e1_iss_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
legend("topleft", legend = c("Left", "Right"),
# lty = , lwd = 4,
col = c("deepskyblue3", "firebrick2"),
pch = c(16,15),
bty = "n", cex = 2, title = "Evidence:")
# Ideology--------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(.20, .70),
xlab = "Ideology",
ylab = "Pr(Correct)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e1_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e1_ideo_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e1_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e1_ideo_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_ideo_lib@est[1:2,2],
y1 = p_m1_e1_ideo_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_ideo_con@est[1:2,2],
y1 = p_m1_e1_ideo_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
legend(.5, 1, legend = c("Left", "Right"),
lty = 1, lwd = 4, col = c("deepskyblue3", "firebrick2"),
pch = 16,
bty = "n", cex = 2, title = "Evidence:")
mtext("Pr(Correct Interpretation of Evidence)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID ------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(.20, .70),
xlab = "Party ID",
ylab = "Pr(Correct)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e1_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e1_pid_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e1_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e1_pid_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_pid_lib@est[1:2,2],
y1 = p_m1_e1_pid_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e1_pid_con@est[1:2,2],
y1 = p_m1_e1_pid_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
dev.off()
# ----------------------------------------------------------------------------------------
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
# ----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_b_asym_2.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,1,1.1,1))
# Issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Issue Position",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2ss_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2ss_iss_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2ss_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2ss_iss_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_iss_lib@est[1:2,2],
y1 = p_m1_e2ss_iss_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_iss_con@est[1:2,2],
y1 = p_m1_e2ss_iss_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
# Ideology -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Ideology",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2ss_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2ss_ideo_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2ss_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2ss_ideo_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_ideo_lib@est[1:2,2],
y1 = p_m1_e2ss_ideo_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_ideo_con@est[1:2,2],
y1 = p_m1_e2ss_ideo_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
mtext("Sample Size is Sufficient (in SDs)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Party ID",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2ss_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2ss_pid_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2ss_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2ss_pid_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_pid_lib@est[1:2,2],
y1 = p_m1_e2ss_pid_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2ss_pid_con@est[1:2,2],
y1 = p_m1_e2ss_pid_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
dev.off()
# ----------------------------------------------------------------------------------------
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
# ----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_b_asym_3.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,1,1.1,1))
# issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Issue Position",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2cc_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2cc_iss_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2cc_iss_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2cc_iss_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_iss_lib@est[1:2,2],
y1 = p_m1_e2cc_iss_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_iss_con@est[1:2,2],
y1 = p_m1_e2cc_iss_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
# Ideology -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Ideology",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2cc_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2cc_ideo_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2cc_ideo_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2cc_ideo_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_ideo_lib@est[1:2,2],
y1 = p_m1_e2cc_ideo_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_ideo_con@est[1:2,2],
y1 = p_m1_e2cc_ideo_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
mtext("Can Make Causal Claim (in SDs)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(-.2, 1.2), ylim = c(-.5, .5),
xlab = "Party ID",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
axis(1, at = c(0, 1), labels = c("", ""), cex.axis = 1.5)
points(0:1, p_m1_e2cc_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
cex = 4)
points(0:1, p_m1_e2cc_pid_con@est[1:2,1], pch = 15, col = "firebrick2", cex = 4)
points(0:1, p_m1_e2cc_pid_lib@est[1:2,1], pch = 16, col = "deepskyblue3",
type = "l", lwd = 4, lty = 2)
points(0:1, p_m1_e2cc_pid_con@est[1:2,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4, lty = 2)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_pid_lib@est[1:2,2],
y1 = p_m1_e2cc_pid_lib@est[1:2,3],
col = makeTransparent( "deepskyblue3"), lwd = 7)
segments(x0 = c(0, 1), x1 = c(0, 1),
y0 = p_m1_e2cc_pid_con@est[1:2,2],
y1 = p_m1_e2cc_pid_con@est[1:2,3],
col = makeTransparent("firebrick2"), lwd = 7)
dev.off()
# ----------------------------------------------------------------------------------------
# Difference in Differences Plot ---------------------------------------------------------
# ----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_b_asym_4.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,6,1,0), mar = c(4.1,1,1.1,1), xpd = NA)
x_vals <- c(1,3,5)
# Experiment 1 ---------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Evidence Interpretation",
ylab = "", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
points(x_vals, dtbl$mean[1:3], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl$ci.lo[1:3], y1 = dtbl$ci.hi[1:3],
lwd = 7, col = makeTransparent("black", 150))
mtext("(Conservative - Liberal)", side = 2, outer = T, padj = -1.8, cex = 1.7)
# Experiment 2 (SS) ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Sample Size",
ylab = "", cex.lab = 2, cex.axis = 1.7, yaxt = "n", xaxt = "n")
points(x_vals, dtbl$mean[4:6], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl$ci.lo[4:6], y1 = dtbl$ci.hi[4:6],
lwd = 7, col = makeTransparent("black", 150))
# Experiment 2 (CC) ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Causality",
ylab = "", cex.lab = 2, cex.axis = 1.7, yaxt = "n", xaxt = "n")
points(x_vals, dtbl$mean[7:9], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl$ci.lo[7:9], y1 = dtbl$ci.hi[7:9],
lwd = 7, col = makeTransparent("black", 150) )
# cross-plot axis
axis(1, at = -17:6, lwd.tick=0, labels=FALSE)
segments(x0 = -17, x1 = -17,
y0 = -1.08, y1 = -1.12)
segments(x0 = 6, x1 = 6,
y0 = -1.08, y1 = -1.12)
# horizontal line at y = 0
segments(x0 = -17.5, x1 = 6,
y0 = 0, y1 = 0, lty = 2)
legend("topright", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
bty = "n", cex = 3)
dev.off()
```
## Continuous Models (For Appendix)
```{r warning = F, echo = F, message = F, include = T}
# Experiment 1 ---------------------------------------------------------------------------
#L/R = issue
m1_e1_iss_lib_cnt <- quick_glm(outcome = "exp1_correct",
new = "exp1_issue_lr",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_iss_con_cnt <- quick_glm(outcome = "exp1_correct",
new = "exp1_issue_lr",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
#L/R = ideology
m1_e1_ideo_lib_cnt <- quick_glm(outcome = "exp1_correct",
new = "ideo7",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_ideo_con_cnt <- quick_glm(outcome = "exp1_correct",
new = "ideo7",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
#L/R = party id
m1_e1_pid_lib_cnt <- quick_glm(outcome = "exp1_correct",
new = "pid7",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 1,])
m1_e1_pid_con_cnt <- quick_glm(outcome = "exp1_correct",
new = "pid7",
keepers = m1_e1_controls,
data = data[data$exp1_liberal_evidence == 0,])
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
#L/R = issue
m1_e2ss_iss_lib_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_issue_lr",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_iss_con_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_issue_lr",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = ideology
m1_e2ss_ideo_lib_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "ideo7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_ideo_con_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "ideo7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = party id
m1_e2ss_pid_lib_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "pid7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2ss_pid_con_cnt <- quick_lm(outcome = "exp2_goodSample",
new = "pid7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
#L/R = issue
m1_e2cc_iss_lib_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_issue_lr",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_iss_con_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_issue_lr",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = ideology
m1_e2cc_ideo_lib_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "ideo7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_ideo_con_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "ideo7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
#L/R = party id
m1_e2cc_pid_lib_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "pid7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 1,])
m1_e2cc_pid_con_cnt <- quick_lm(outcome = "exp2_goodCausal",
new = "pid7",
keepers = m1_e2_controls,
data = data[data$exp2_liberal_evidence == 0,])
```
## Continuous Post-Estimation
```{r warning = F, echo = F, message = F, include = T}
# Experiment 1 ---------------------------------------------------------------------------
p_m1_e1_iss_lib_cnt <- post(model = m1_e1_iss_lib_cnt,
x1name = "exp1_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e1_iss_con_cnt <- post(model = m1_e1_iss_con_cnt,
x1name = "exp1_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e1_ideo_lib_cnt <- post(model = m1_e1_ideo_lib_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e1_ideo_con_cnt <- post(model = m1_e1_ideo_con_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e1_pid_lib_cnt <- post(model = m1_e1_pid_lib_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e1_pid_con_cnt <- post(model = m1_e1_pid_con_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
p_m1_e2ss_iss_lib_cnt <- post(model = m1_e2ss_iss_lib_cnt,
x1name = "exp2_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e2ss_iss_con_cnt <- post(model = m1_e2ss_iss_con_cnt,
x1name = "exp2_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e2ss_ideo_lib_cnt <- post(model = m1_e2ss_ideo_lib_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2ss_ideo_con_cnt <- post(model = m1_e2ss_ideo_con_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2ss_pid_lib_cnt <- post(model = m1_e2ss_pid_lib_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2ss_pid_con_cnt <- post(model = m1_e2ss_pid_con_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
p_m1_e2cc_iss_lib_cnt <- post(model = m1_e2cc_iss_lib_cnt,
x1name = "exp2_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e2cc_iss_con_cnt <- post(model = m1_e2cc_iss_con_cnt,
x1name = "exp2_issue_lr", x1vals = 1:6,
n.sims = nsims, digits = 5)
p_m1_e2cc_ideo_lib_cnt <- post(model = m1_e2cc_ideo_lib_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2cc_ideo_con_cnt <- post(model = m1_e2cc_ideo_con_cnt,
x1name = "ideo7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2cc_pid_lib_cnt <- post(model = m1_e2cc_pid_lib_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
p_m1_e2cc_pid_con_cnt <- post(model = m1_e2cc_pid_con_cnt,
x1name = "pid7", x1vals = 1:7,
n.sims = nsims, digits = 5)
# Calculate Mean Differences and Confidence Intervals ------------------------------------
# Experiment 1
d_m1_e1_iss_cnt <- (p_m1_e1_iss_con_cnt@sims[,ncol(p_m1_e1_iss_con_cnt@sims)] -
p_m1_e1_iss_lib_cnt@sims[,ncol(p_m1_e1_iss_lib_cnt@sims)]) -
(p_m1_e1_iss_lib_cnt@sims[,1] -
p_m1_e1_iss_con_cnt@sims[,1])
d_m1_e1_ideo_cnt <- (p_m1_e1_ideo_con_cnt@sims[,ncol(p_m1_e1_ideo_con_cnt@sims)] -
p_m1_e1_ideo_lib_cnt@sims[,ncol(p_m1_e1_ideo_lib_cnt@sims)]) -
(p_m1_e1_ideo_lib_cnt@sims[,1] -
p_m1_e1_ideo_con_cnt@sims[,1])
d_m1_e1_pid_cnt <- (p_m1_e1_pid_con_cnt@sims[,ncol(p_m1_e1_pid_con_cnt@sims)] -
p_m1_e1_pid_lib_cnt@sims[,ncol(p_m1_e1_pid_lib_cnt@sims)]) -
(p_m1_e1_pid_lib_cnt@sims[,1] -
p_m1_e1_pid_con_cnt@sims[,1])
# Experiment 2 (Sample Size)
d_m1_e2ss_iss_cnt <- (p_m1_e2ss_iss_con_cnt@sims[,ncol(p_m1_e2ss_iss_con_cnt@sims)] -
p_m1_e2ss_iss_lib_cnt@sims[,ncol(p_m1_e2ss_iss_lib_cnt@sims)]) -
(p_m1_e2ss_iss_lib_cnt@sims[,1] -
p_m1_e2ss_iss_con_cnt@sims[,1])
d_m1_e2ss_ideo_cnt <- (p_m1_e2ss_ideo_con_cnt@sims[,ncol(p_m1_e2ss_ideo_con_cnt@sims)] -
p_m1_e2ss_ideo_lib_cnt@sims[,ncol(p_m1_e2ss_ideo_lib_cnt@sims)]) -
(p_m1_e2ss_ideo_lib_cnt@sims[,1] -
p_m1_e2ss_ideo_con_cnt@sims[,1])
d_m1_e2ss_pid_cnt <- (p_m1_e2ss_pid_con_cnt@sims[,ncol(p_m1_e2ss_pid_con_cnt@sims)] -
p_m1_e2ss_pid_lib_cnt@sims[,ncol(p_m1_e2ss_pid_lib_cnt@sims)]) -
(p_m1_e2ss_pid_lib_cnt@sims[,1] -
p_m1_e2ss_pid_con_cnt@sims[,1])
# Experiment 2 (Causal Claim)
d_m1_e2cc_iss_cnt <- (p_m1_e2cc_iss_con_cnt@sims[,ncol(p_m1_e2cc_iss_con_cnt@sims)] -
p_m1_e2cc_iss_lib_cnt@sims[,ncol(p_m1_e2cc_iss_lib_cnt@sims)]) -
(p_m1_e2cc_iss_lib_cnt@sims[,1] -
p_m1_e2cc_iss_con_cnt@sims[,1])
d_m1_e2cc_ideo_cnt <- (p_m1_e2cc_ideo_con_cnt@sims[,ncol(p_m1_e2cc_ideo_con_cnt@sims)] -
p_m1_e2cc_ideo_lib_cnt@sims[,ncol(p_m1_e2cc_ideo_lib_cnt@sims)]) -
(p_m1_e2cc_ideo_lib_cnt@sims[,1] -
p_m1_e2cc_ideo_con_cnt@sims[,1])
d_m1_e2cc_pid_cnt <- (p_m1_e2cc_pid_con_cnt@sims[,ncol(p_m1_e2cc_pid_con_cnt@sims)] -
p_m1_e2cc_pid_lib_cnt@sims[,ncol(p_m1_e2cc_pid_lib_cnt@sims)]) -
(p_m1_e2cc_pid_lib_cnt@sims[,1] -
p_m1_e2cc_pid_con_cnt@sims[,1])
# Create table of differences and means
# as dataframe
d_names_cnt <- as.data.frame(cbind(d_m1_e1_iss_cnt, d_m1_e1_ideo_cnt, d_m1_e1_pid_cnt,
d_m1_e2ss_iss_cnt, d_m1_e2ss_ideo_cnt, d_m1_e2ss_pid_cnt,
d_m1_e2cc_iss_cnt, d_m1_e2cc_ideo_cnt, d_m1_e2cc_pid_cnt))
# as numeric vector
d_names_r_cnt <- c(d_m1_e1_iss_cnt, d_m1_e1_ideo_cnt, d_m1_e1_pid_cnt,
d_m1_e2ss_iss_cnt, d_m1_e2ss_ideo_cnt, d_m1_e2ss_pid_cnt,
d_m1_e2cc_iss_cnt, d_m1_e2cc_ideo_cnt, d_m1_e2cc_pid_cnt)
dtbl_cnt <- data.frame(name = colnames(d_names_cnt),
mean = apply(d_names_cnt, 2, mean),
ci.lo = apply(d_names_cnt, 2, quantile, probs = .025),
ci.hi = apply(d_names_cnt, 2, quantile, probs = .975))
```
## Continuous Figures
We create separate figures for each experimental outcome (Experiment 1; Experiment 2, Sample Size outcome; and Experiment 2, Causal Claim outcome). For each of these experimental outcomes, we create separate figures for each operationalization of a respondent's L/R dimension (issue position, ideology, and party ID). This results in 9 figures. For simplicity, the 3 figures for each experimental outcome are horizontally arranged in a single pdf file. Each of the 3 figures in each PDF uses a different operationalization of a respondent's L/R orientation.
```{r warning = F, echo = F, message = F, include = T}
#-----------------------------------------------------------------------------------------
# Experiment 1 ---------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_c_asym_1.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,2,1.1,1))
# Issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,6), ylim = c(0, 1),
xlab = "Issue Position",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:6, p_m1_e1_iss_lib_cnt@est[1:6,1], pch = 16, col = "deepskyblue3",
lty = 2, type = "l", lwd = 4)
points(1:6, p_m1_e1_iss_con_cnt@est[1:6,1], pch = 15, col = "firebrick2", type = "l",
lwd = 4)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e1_iss_lib_cnt@est[1:6,2], rev(p_m1_e1_iss_lib_cnt@est[1:6,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e1_iss_con_cnt@est[1:6,2], rev(p_m1_e1_iss_con_cnt@est[1:6,3])),
col= adjustcolor("firebrick2", .1), border=NA)
legend(1.5, 1, legend = c("Left", "Right"),
lty = c(2,1), lwd = 4, col = c("deepskyblue3", "firebrick2"),
bty = "n", cex = 2, title = "Evidence:")
# Ideology -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(0, 1),
xlab = "Ideology",
ylab = "Pr(Correct)", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e1_ideo_lib_cnt@est[1:7,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e1_ideo_con_cnt@est[1:7,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e1_ideo_lib_cnt@est[1:7,2], rev(p_m1_e1_ideo_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e1_ideo_con_cnt@est[1:7,2], rev(p_m1_e1_ideo_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
mtext("Pr(Correct Interpretation of Evidence)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(0, 1),
xlab = "Party ID",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e1_pid_lib_cnt@est[1:7,1], pch = 16, col = "deepskyblue3",
lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e1_pid_con_cnt@est[1:7,1], pch = 15, col = "firebrick2",
type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e1_pid_lib_cnt@est[1:7,2], rev(p_m1_e1_pid_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e1_pid_con_cnt@est[1:7,2], rev(p_m1_e1_pid_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
dev.off()
#-----------------------------------------------------------------------------------------
# Experiment 2 (Sample Size outcome) -----------------------------------------------------
#-----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_c_asym_2.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,1,1.1,1))
# Issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,6), ylim = c(-1, 1),
xlab = "Issue Position",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:6, p_m1_e2ss_iss_lib_cnt@est[1:6,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:6, p_m1_e2ss_iss_con_cnt@est[1:6,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e2ss_iss_lib_cnt@est[1:6,2], rev(p_m1_e2ss_iss_lib_cnt@est[1:6,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e2ss_iss_con_cnt@est[1:6,2], rev(p_m1_e2ss_iss_con_cnt@est[1:6,3])),
col= adjustcolor("firebrick2", .1), border=NA)
# Ideology -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(-1, 1),
xlab = "Ideology",
ylab = "Sample Size is Sufficient (in SDs)", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e2ss_ideo_lib_cnt@est[1:7,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e2ss_ideo_con_cnt@est[1:7,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2ss_ideo_lib_cnt@est[1:7,2], rev(p_m1_e2ss_ideo_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2ss_ideo_con_cnt@est[1:7,2], rev(p_m1_e2ss_ideo_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
mtext("Sample Size is Sufficient (in SDs)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(-1, 1),
xlab = "Party ID",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e2ss_pid_lib_cnt@est[1:7,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e2ss_pid_con_cnt@est[1:7,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2ss_pid_lib_cnt@est[1:7,2], rev(p_m1_e2ss_pid_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2ss_pid_con_cnt@est[1:7,2], rev(p_m1_e2ss_pid_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
dev.off()
#-----------------------------------------------------------------------------------------
# Experiment 2 (Causal Claim outcome) ----------------------------------------------------
#-----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_c_asym_3.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,5,1,0), mar = c(4.1,1,1.1,1))
# Issue Positions ------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,6), ylim = c(-1, 1),
xlab = "Issue Position",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:6, p_m1_e2cc_iss_lib_cnt@est[1:6,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:6, p_m1_e2cc_iss_con_cnt@est[1:6,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e2cc_iss_lib_cnt@est[1:6,2], rev(p_m1_e2cc_iss_lib_cnt@est[1:6,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,6,1), rev(seq(1,6,1))),
c(p_m1_e2cc_iss_con_cnt@est[1:6,2], rev(p_m1_e2cc_iss_con_cnt@est[1:6,3])),
col= adjustcolor("firebrick2", .1), border=NA)
# Ideology -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(-1, 1),
xlab = "Ideology",
ylab = "Can Make Causal Claim (in SDs)", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e2cc_ideo_lib_cnt@est[1:7,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e2cc_ideo_con_cnt@est[1:7,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2cc_ideo_lib_cnt@est[1:7,2], rev(p_m1_e2cc_ideo_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2cc_ideo_con_cnt@est[1:7,2], rev(p_m1_e2cc_ideo_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
mtext("Can Make Causal Claim (in SDs)", side = 2, outer = T, padj = -2, cex = 1.7)
# Party ID -------------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(1,7), ylim = c(-1, 1),
xlab = "Party ID",
ylab = "", cex.lab = 2, cex.axis = 1.7)
points(1:7, p_m1_e2cc_pid_lib_cnt@est[1:7,1], pch = 16,
col = "deepskyblue3", lty = 2, type = "l", lwd = 4)
points(1:7, p_m1_e2cc_pid_con_cnt@est[1:7,1], pch = 15,
col = "firebrick2", type = "l", lwd = 4)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2cc_pid_lib_cnt@est[1:7,2], rev(p_m1_e2cc_pid_lib_cnt@est[1:7,3])),
col= adjustcolor("deepskyblue3", .1), border=NA)
polygon(c(seq(1,7,1), rev(seq(1,7,1))),
c(p_m1_e2cc_pid_con_cnt@est[1:7,2], rev(p_m1_e2cc_pid_con_cnt@est[1:7,3])),
col= adjustcolor("firebrick2", .1), border=NA)
dev.off()
#-----------------------------------------------------------------------------------------
# Difference in Differences Plot ---------------------------------------------------------
#-----------------------------------------------------------------------------------------
pdf("lucid_figures/lucid_u_c_asym_4.pdf", height = 6, width = 8)
par(mfrow = c(1,3), oma = c(.1,6,1,0), mar = c(4.1,1,1.1,1), xpd = NA)
x_vals <- c(1,3,5)
# Experiment 1 ---------------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Evidence Interpretation",
ylab = "", cex.lab = 2, cex.axis = 1.7, xaxt = "n")
points(x_vals, dtbl_cnt$mean[1:3], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl_cnt$ci.lo[1:3], y1 = dtbl_cnt$ci.hi[1:3],
lwd = 5, col = makeTransparent("black", 150))
mtext("(Conservative - Liberal)", side = 2, outer = T, padj = -1.8, cex = 1.7)
# Experiment 2 (SS) ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Sample Size",
ylab = "", cex.lab = 2, cex.axis = 1.7, yaxt = "n", xaxt = "n")
points(x_vals, dtbl_cnt$mean[4:6], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl_cnt$ci.lo[4:6], y1 = dtbl_cnt$ci.hi[4:6],
lwd = 5, col = makeTransparent("black", 150))
# Experiment 2 (CC) ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n",
xlim = c(0,7), ylim = c(-1,1),
xlab = "Causality",
ylab = "", cex.lab = 2, cex.axis = 1.7, yaxt = "n", xaxt = "n")
points(x_vals, dtbl_cnt$mean[7:9], pch = c(15, 16, 17),
cex = 4)
segments(x0 = x_vals, x1 = x_vals,
y0 = dtbl_cnt$ci.lo[7:9], y1 = dtbl_cnt$ci.hi[7:9],
lwd = 5, col = makeTransparent("black", 150) )
# cross-plot axis
axis(1, at = -17:6, lwd.tick=0, labels=FALSE)
segments(x0 = -17, x1 = -17,
y0 = -1.08, y1 = -1.12)
segments(x0 = 6, x1 = 6,
y0 = -1.08, y1 = -1.12)
# horizontal line at y = 0
segments(x0 = -17.5, x1 = 6,
y0 = 0, y1 = 0, lty = 2)
legend("topright", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
bty = "n", cex = 3)
dev.off()
```
# Analysis: The Moderating Effect of Epistemic Needs
## Need for Closure
These models use NFC as a measure of openness. In the next section we run identical models using the Trait Index instead.
```{r}
# Experiment 1----------------------------------------------------------------------------
# Issue Position
m2a_e1_iss <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_issue_binary*pol_id.s +
exp1_congenial_issue_binary*nfc_mean.s +
exp1_congenial_issue_binary*numeracy.s +
exp1_congenial_issue_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Ideology
m2a_e1_ideo <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_ideo_binary*pol_id.s +
exp1_congenial_ideo_binary*nfc_mean.s +
exp1_congenial_ideo_binary*numeracy.s +
exp1_congenial_ideo_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Party ID
m2a_e1_pid <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_pid_binary*huddy_id.s +
exp1_congenial_pid_binary*nfc_mean.s +
exp1_congenial_pid_binary*numeracy.s +
exp1_congenial_pid_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Experiment 2 (Sample Size)--------------------------------------------------------------
# Issue Positions
m2a_e2ss_iss <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_issue_binary*pol_id.s +
exp2_congenial_issue_binary*nfc_mean.s +
exp2_congenial_issue_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Ideology
m2a_e2ss_ideo <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_ideo_binary*pol_id.s +
exp2_congenial_ideo_binary*nfc_mean.s +
exp2_congenial_ideo_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Party ID
m2a_e2ss_pid <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_pid_binary*huddy_id.s +
exp2_congenial_pid_binary*nfc_mean.s +
exp2_congenial_pid_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Experiment 2 (Causal Claim)-------------------------------------------------------------
# Issue Positions
m2a_e2cc_iss <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_issue_binary*pol_id.s +
exp2_congenial_issue_binary*nfc_mean.s +
exp2_congenial_issue_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Ideology
m2a_e2cc_ideo <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_ideo_binary*pol_id.s +
exp2_congenial_ideo_binary*nfc_mean.s +
exp2_congenial_ideo_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Party ID
m2a_e2cc_pid <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_pid_binary*huddy_id.s +
exp2_congenial_pid_binary*nfc_mean.s +
exp2_congenial_pid_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
```
## Trait Index
In these models we subsitute the Openness Trait Index for NFC.
```{r}
# Experiment 1----------------------------------------------------------------------------
# Issue Position
m2b_e1_iss <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_issue_binary*pol_id.s +
exp1_congenial_issue_binary*trait_index.s +
exp1_congenial_issue_binary*numeracy.s +
exp1_congenial_issue_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Ideology
m2b_e1_ideo <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_ideo_binary*pol_id.s +
exp1_congenial_ideo_binary*trait_index.s +
exp1_congenial_ideo_binary*numeracy.s +
exp1_congenial_ideo_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Party ID
m2b_e1_pid <- quick_glm(outcome = "exp1_correct",
new = "exp1_congenial_pid_binary*huddy_id.s +
exp1_congenial_pid_binary*trait_index.s +
exp1_congenial_pid_binary*numeracy.s +
exp1_congenial_pid_binary*pk_mean.s",
keepers = m2_e1_controls,
data = data)
# Experiment 2 (Sample Size) -------------------------------------------------------------
# Issue Positions
m2b_e2ss_iss <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_issue_binary*pol_id.s +
exp2_congenial_issue_binary*trait_index.s +
exp2_congenial_issue_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Ideology
m2b_e2ss_ideo <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_ideo_binary*pol_id.s +
exp2_congenial_ideo_binary*trait_index.s +
exp2_congenial_ideo_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Party ID
m2b_e2ss_pid <- quick_lm(outcome = "exp2_goodSample",
new = "exp2_congenial_pid_binary*huddy_id.s +
exp2_congenial_pid_binary*trait_index.s +
exp2_congenial_pid_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Experiment 2 (Causal Claim)-------------------------------------------------------------
# Issue Positions
m2b_e2cc_iss <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_issue_binary*pol_id.s +
exp2_congenial_issue_binary*trait_index.s +
exp2_congenial_issue_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Ideology
m2b_e2cc_ideo <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_ideo_binary*pol_id.s +
exp2_congenial_ideo_binary*trait_index.s +
exp2_congenial_ideo_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
# Party ID
m2b_e2cc_pid <- quick_lm(outcome = "exp2_goodCausal",
new = "exp2_congenial_pid_binary*huddy_id.s +
exp2_congenial_pid_binary*trait_index.s +
exp2_congenial_pid_binary*pk_mean.s",
keepers = m2_e2_controls,
data = data)
```
## Figures
```{r}
rownames <- c("m2a_e1_iss", "m2a_e1_ideo", "m2a_e1_pid",
"m2a_e2ss_iss", "m2a_e2ss_ideo", "m2a_e2ss_pid",
"m2a_e2cc_iss", "m2a_e2cc_ideo", "m2a_e2cc_pid")
nfc_bin <- rbind(
as.data.frame(summary(m2a_e1_iss)$coef)[21,1:2],
as.data.frame(summary(m2a_e1_ideo)$coef)[21,1:2],
as.data.frame(summary(m2a_e1_pid)$coef)[21,1:2],
as.data.frame(summary(m2a_e2ss_iss)$coef)[20,1:2],
as.data.frame(summary(m2a_e2ss_ideo)$coef)[20,1:2],
as.data.frame(summary(m2a_e2ss_pid)$coef)[20,1:2],
as.data.frame(summary(m2a_e2cc_iss)$coef)[20,1:2],
as.data.frame(summary(m2a_e2cc_ideo)$coef)[20,1:2],
as.data.frame(summary(m2a_e2cc_pid)$coef)[20,1:2]
)
ti_bin <- rbind(
as.data.frame(summary(m2b_e1_iss)$coef)[21,1:2],
as.data.frame(summary(m2b_e1_ideo)$coef)[21,1:2],
as.data.frame(summary(m2b_e1_pid)$coef)[21,1:2],
as.data.frame(summary(m2b_e2ss_iss)$coef)[20,1:2],
as.data.frame(summary(m2b_e2ss_ideo)$coef)[20,1:2],
as.data.frame(summary(m2b_e2ss_pid)$coef)[20,1:2],
as.data.frame(summary(m2b_e2cc_iss)$coef)[20,1:2],
as.data.frame(summary(m2b_e2cc_ideo)$coef)[20,1:2],
as.data.frame(summary(m2b_e2cc_pid)$coef)[20,1:2]
)
id_bin <- rbind(
as.data.frame(summary(m2a_e1_iss)$coef)[20,1:2],
as.data.frame(summary(m2a_e1_ideo)$coef)[20,1:2],
as.data.frame(summary(m2a_e1_pid)$coef)[20,1:2],
as.data.frame(summary(m2a_e2ss_iss)$coef)[19,1:2],
as.data.frame(summary(m2a_e2ss_ideo)$coef)[19,1:2],
as.data.frame(summary(m2a_e2ss_pid)$coef)[19,1:2],
as.data.frame(summary(m2a_e2cc_iss)$coef)[19,1:2],
as.data.frame(summary(m2a_e2cc_ideo)$coef)[19,1:2],
as.data.frame(summary(m2a_e2cc_pid)$coef)[19,1:2]
)
pk_bin <- rbind(
as.data.frame(summary(m2a_e1_iss)$coef)[23,1:2],
as.data.frame(summary(m2a_e1_ideo)$coef)[23,1:2],
as.data.frame(summary(m2a_e1_pid)$coef)[23,1:2],
as.data.frame(summary(m2a_e2ss_iss)$coef)[21,1:2],
as.data.frame(summary(m2a_e2ss_ideo)$coef)[21,1:2],
as.data.frame(summary(m2a_e2ss_pid)$coef)[21,1:2],
as.data.frame(summary(m2a_e2cc_iss)$coef)[21,1:2],
as.data.frame(summary(m2a_e2cc_ideo)$coef)[21,1:2],
as.data.frame(summary(m2a_e2cc_pid)$coef)[21,1:2]
)
num_bin <- rbind(
as.data.frame(summary(m2a_e1_iss)$coef)[22,1:2],
as.data.frame(summary(m2a_e1_ideo)$coef)[22,1:2],
as.data.frame(summary(m2a_e1_pid)$coef)[22,1:2]
)
# NFC Plot--------------------------------------------------------------------------------
pdf("lucid_figures/nfc_openness_b_2way.pdf", height = 4, width = 8)
par(mfrow = c(2,3), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = nfc_bin[1:3, 1] + 1.96*nfc_bin[1:3,2],
y1 = nfc_bin[1:3, 1] - 1.96*nfc_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, nfc_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Need for Closure", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Sample Size")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = nfc_bin[4:6, 1] + 1.96*nfc_bin[4:6,2],
y1 = nfc_bin[4:6, 1] - 1.96*nfc_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, nfc_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Causality")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = nfc_bin[7:9, 1] + 1.96*nfc_bin[7:9,2],
y1 = nfc_bin[7:9, 1] - 1.96*nfc_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, nfc_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
# Trait Index Plot-----------------------------------------------------------------------
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = ti_bin[1:3, 1] + 1.96*ti_bin[1:3,2],
y1 = ti_bin[1:3, 1] - 1.96*ti_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, ti_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Openness Index", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = ti_bin[4:6, 1] + 1.96*ti_bin[4:6,2],
y1 = ti_bin[4:6, 1] - 1.96*ti_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, ti_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
legend("bottom", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = ti_bin[7:9, 1] + 1.96*ti_bin[7:9,2],
y1 = ti_bin[7:9, 1] - 1.96*ti_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, ti_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
dev.off()
# Identity Plot---------------------------------------------------------------------------
pdf("lucid_figures/identity_b_2way.pdf", height = 4, width = 8)
par(mfrow = c(1,3), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = id_bin[1:3, 1] + 1.96*id_bin[1:3,2],
y1 = id_bin[1:3, 1] - 1.96*id_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, id_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Identity", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Sample Size")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = id_bin[4:6, 1] + 1.96*id_bin[4:6,2],
y1 = id_bin[4:6, 1] - 1.96*id_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, id_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
legend("bottom", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Causality")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = id_bin[7:9, 1] + 1.96*id_bin[7:9,2],
y1 = id_bin[7:9, 1] - 1.96*id_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, id_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
dev.off()
# Knowledge Plot--------------------------------------------------------------------------
pdf("lucid_figures/pk_b_2way.pdf", height = 4, width = 8)
par(mfrow = c(1,3), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[1:3, 1] + 1.96*pk_bin[1:3,2],
y1 = pk_bin[1:3, 1] - 1.96*pk_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Political Knowledge", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Sample Size")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[4:6, 1] + 1.96*pk_bin[4:6,2],
y1 = pk_bin[4:6, 1] - 1.96*pk_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
legend("bottom", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Causality")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[7:9, 1] + 1.96*pk_bin[7:9,2],
y1 = pk_bin[7:9, 1] - 1.96*pk_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
dev.off()
# Numeracy Plot-----------------------------------------------------------------------
pdf("lucid_figures/numeracy_b_2way.pdf", height = 4, width = 8)
par(mfrow = c(1,1), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = num_bin[1:3, 1] + 1.96*num_bin[1:3,2],
y1 = num_bin[1:3, 1] - 1.96*num_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, num_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Numeracy", side = 2, padj = -5) # common y axis label
legend("bottom", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
dev.off()
# Combined PK and Numeracy Plot----------------------------------------------------------
pdf("lucid_figures/pk_numeracy_b_2way.pdf", height = 4, width = 8)
par(mfrow = c(1,3), pch = 16, mar = c(0,2,1,0), oma = c(2,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.4,.7),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[1:3, 1] + 1.96*pk_bin[1:3,2],
y1 = pk_bin[1:3, 1] - 1.96*pk_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
# add numeracy points and segments
num_adj <- .25
alpha_level <- 150
segments(x0 = 1:3 + num_adj, x1 = 1:3 + num_adj,
y0 = num_bin[1:3, 1] + 1.96*num_bin[1:3,2],
y1 = num_bin[1:3, 1] - 1.96*num_bin[1:3,2],
lwd = 3, col = makeTransparent("gray40", alpha_level))
points(1:3 + num_adj, num_bin[1:3 + num_adj,1], cex = 2, pch = c(15, 16, 17),
col = makeTransparent("black", alpha_level))
axis(2, at = seq(-.4, .7, .20), labels = seq(-.4, .7, .20)) # common y axis
mtext(text = "Expertise", side = 2, padj = -5) # common y axis label
legend(.8, -.25, legend = c("Political Knowledge", "Numeracy"),
pch = c(15), col = c("black", makeTransparent("black",
alpha_level)),
cex = 1.5, ncol = 1, xpd = NA, pt.cex = 2, bty = "n")
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.4,.7),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Sample Size")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[4:6, 1] + 1.96*pk_bin[4:6,2],
y1 = pk_bin[4:6, 1] - 1.96*pk_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
#legend("bottom", legend = c("Political Knowledge", "Numeracy"),
# pch = c(16), col = c("black", makeTransparent("black",
# alpha_level)),
# cex = 1.5, ncol = 2, xpd = NA, pt.cex = 2, lwd = 2)
legend(.5, -.3, legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.4,.7),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Causality")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = pk_bin[7:9, 1] + 1.96*pk_bin[7:9,2],
y1 = pk_bin[7:9, 1] - 1.96*pk_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, pk_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
dev.off()
```
# Ideological Differences in NFC and Openess Trait Index
```{r warning = F, echo = F, message = F, include = T}
data$ideo3 <- ifelse(data$ideo7 < 4, "Liberal",
ifelse(data$ideo7 == 4, "Moderate",
ifelse(data$ideo7 > 3, "Conservative", NA)))
par(mfrow = c(2, 1))
# Ideological Asymmetries in NFC
plot(density(data$nfc_mean.s, na.rm=T), main = "Ideological Differences in NFC",
xlim = c(-4, 4))
points(density(data$nfc_mean.s[data$ideo3 == "Liberal"], na.rm=T), col = "blue")
points(density(data$nfc_mean.s[data$ideo3 == "Conservative"], na.rm=T), col = "red")
abline(v = mean(data$nfc_mean.s[data$ideo3 == "Liberal"], na.rm=T), col = "blue")
abline(v = mean(data$nfc_mean.s[data$ideo3 == "Conservative"], na.rm=T), col = "red")
# Ideological Asymmetries in Openness
plot(density(data$trait_index.s, na.rm=T), main = "Ideological Differences in Trait Index",
xlim = c(-4, 4))
points(density(data$trait_index.s[data$ideo3 == "Liberal"], na.rm=T), col = "blue")
points(density(data$trait_index.s[data$ideo3 == "Conservative"], na.rm=T), col = "red")
abline(v = mean(data$trait_index.s[data$ideo3 == "Liberal"], na.rm=T), col = "blue")
abline(v = mean(data$trait_index.s[data$ideo3 == "Conservative"], na.rm=T), col = "red")
nfc_diff <-
data %>%
dplyr::group_by(ideo7) %>%
dplyr::summarize(mean = mean(nfc_mean.s, na.rm=T),
se = std_error(nfc_mean.s)) %>%
na.omit() %>%
ggplot(aes(x = ideo7, y = mean)) +
coord_cartesian(ylim = c(-1, 1)) +
geom_point() +
geom_segment(aes(x = ideo7, xend = ideo7,
y = mean - 1.96*se, yend = mean + 1.96*se)) +
labs(x = "Ideology (Liberal to Conservative)",
y= "Mean Need for Closure (in SDs)") +
theme_bw()
ggsave("lucid_figures/nfc_diff.pdf", nfc_diff, width = 6, height = 4)
ti_diff <-
data %>%
dplyr::group_by(ideo7) %>%
dplyr::summarize(mean = mean(trait_index.s, na.rm=T),
se = std_error(trait_index.s)) %>%
na.omit() %>%
ggplot(aes(x = ideo7, y = mean)) +
coord_cartesian(ylim = c(-1, 1)) +
geom_point() +
geom_segment(aes(x = ideo7, xend = ideo7,
y = mean - 1.96*se, yend = mean + 1.96*se)) +
labs(x = "Ideology (Liberal to Conservative)",
y = "Openness Trait Index (in SDs)") +
theme_bw()
ggsave("lucid_figures/ti_diff.pdf", ti_diff, width = 6, height = 4)
cor(data$nfc_mean, data$ideo7, use = "complete.obs")
cor(data$trait_index, data$ideo7, use = "complete.obs")
cor(data$nfc_mean, data$pid7, use = "complete.obs")
cor(data$trait_index, data$pid7, use = "complete.obs")
```
# R&R Pooled 3-way Interactions
```{r}
# Pool Data -----------------------------------------------------------------------------
# Rescale Outcomes
data$exp2_goodSample_01 <- rescale_01(data$exp2_goodSample_uns, max = 7)
#table(data$exp2_goodSample, data$exp2_goodSample_01)
data$exp2_goodCausal_01 <- rescale_01(data$exp2_goodCausal_uns, max = 7)
#table(data$exp2_goodCausal, data$exp2_goodCausal_01)
# 1. Create shorter dataframe containing only variables needed for models
# create respondent id var
data$id <- 1:nrow(data)
keep_vars <- c("id", "exp1_correct", "exp2_goodSample_01", "exp2_goodCausal_01",
"exp1_congenial_issue_binary", "exp1_congenial_ideo_binary",
"exp1_congenial_pid_binary", "exp1_congenial_issue_cont.s",
"exp1_congenial_ideo_cont.s", "exp1_congenial_pid_cont.s",
"pol_id.s", "huddy_id.s", "nfc_mean.s", "numeracy.s",
"pk_mean.s", "age.s", "female", "edu_hs", "edu_somecollege",
"edu_college", "edu_grad", "hispanic", "nonhisp_black",
"income.s", "exp1_issue", "exp2_issue")
# 2. create new dataframe
new <- rbind(data, data, data)
new$out_num <- c(rep( "e1", nrow(data)),
rep ("e2ss", nrow(data)),
rep ("e2cc", nrow(data)))
# 3. create new outcome variable
new$outcome <- NA
new$outcome[new$out_num == "e1"] <- new$exp1_correct[new$out_num == "e1"]
new$outcome[new$out_num == "e2ss"] <- new$exp2_goodSample_01[new$out_num == "e2ss"]
new$outcome[new$out_num == "e2cc"] <- new$exp2_goodCausal_01[new$out_num == "e2cc"]
# 4. create new issue varible
new$issue <- NA
new$issue[new$out_num == "e1"] <- new$exp1_issue[new$out_num == "e1"]
new$issue[new$out_num == "e2ss"] <- new$exp2_issue[new$out_num == "e2ss"]
new$issue[new$out_num == "e2cc"] <- new$exp2_issue[new$out_num == "e2cc"]
#5. create new congeniality measure
new$congenial_issue_binary <- ifelse(new$out_num == "e1", new$exp1_congenial_issue_binary,
new$exp2_congenial_issue_binary)
new$congenial_ideo_binary <- ifelse(new$out_num == "e1", new$exp1_congenial_ideo_binary,
new$exp2_congenial_ideo_binary)
new$congenial_pid_binary <- ifelse(new$out_num == "e1", new$exp1_congenial_pid_binary,
new$exp2_congenial_pid_binary)
new$congenial_issue_cont.s <- ifelse(new$out_num == "e1", new$exp1_congenial_issue_cont.s,
new$exp2_congenial_issue_cont.s)
new$congenial_ideo_cont.s <- ifelse(new$out_num == "e1", new$exp1_congenial_ideo_cont.s,
new$exp2_congenial_ideo_cont.s)
new$congenial_pid_cont.s <- ifelse(new$out_num == "e1", new$exp1_congenial_pid_cont.s,
new$exp2_congenial_pid_cont.s)
# 1A: Pool 3 Outcomes, Binary-------------------------------------------------------------
# Issue Position
pooled_a_iss_robust <-
lm_robust(outcome ~ congenial_issue_binary*nfc_mean.s +
congenial_issue_binary*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# Ideology
pooled_a_ideo_robust <-
lm_robust(outcome ~ congenial_ideo_binary*nfc_mean.s +
congenial_ideo_binary*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# Party ID
pooled_a_pid_robust <-
lm_robust(outcome ~ congenial_pid_binary*nfc_mean.s +
congenial_pid_binary*huddy_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# 1B: Pool 3 Outcomes, Continuous---------------------------------------------------------
# Issue Position
pooled_b_iss_robust <-
lm_robust(outcome ~ congenial_issue_cont.s*nfc_mean.s +
congenial_issue_cont.s*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# Ideology
pooled_b_ideo_robust <-
lm_robust(outcome ~ congenial_ideo_cont.s*nfc_mean.s +
congenial_ideo_cont.s*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# Party ID
pooled_b_pid_robust <-
lm_robust(outcome ~ congenial_pid_cont.s*nfc_mean.s +
congenial_pid_cont.s*huddy_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new, clusters = id)
# 1C: Pool 2 Outcomes, Binary------------------------------------------------------------
# Issue Position
pooled_c_iss_robust <-
lm_robust(outcome ~ congenial_issue_binary*nfc_mean.s +
congenial_issue_binary*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
# Ideology
pooled_c_ideo_robust <-
lm_robust(outcome ~ congenial_ideo_binary*nfc_mean.s +
congenial_ideo_binary*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
# Party ID
pooled_c_pid_robust <-
lm_robust(outcome ~ congenial_pid_binary*nfc_mean.s +
congenial_pid_binary*huddy_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
# 1D: Pool 2 Outcomes, Continuous-------------------------------------------------------
# Issue Position
pooled_d_iss_robust <-
lm_robust(outcome ~ congenial_issue_cont.s*nfc_mean.s +
congenial_issue_cont.s*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
# Ideology
pooled_d_ideo_robust <-
lm_robust(outcome ~ congenial_ideo_cont.s*nfc_mean.s +
congenial_ideo_cont.s*pol_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
# Party ID
pooled_d_pid_robust <-
lm_robust(outcome ~ congenial_pid_cont.s*nfc_mean.s +
congenial_pid_cont.s*huddy_id.s*pk_mean.s +
age.s + female + edu_hs + edu_somecollege + edu_college +
edu_grad + hispanic + nonhisp_black + income.s + issue,
data = new[new$out_num != "e1",], clusters = id)
summary(pooled_d_iss_robust)
summary(pooled_d_ideo_robust)
summary(pooled_d_pid_robust)
# To Plot:
tidy(pooled_a_iss_robust)[23, c("term", "estimate", "std.error")]
tidy(pooled_a_ideo_robust)[23, c("term", "estimate", "std.error")]
tidy(pooled_a_pid_robust)[23, c("term", "estimate", "std.error")]
tidy(pooled_b_iss_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_b_ideo_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_b_pid_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_c_iss_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_c_ideo_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_c_pid_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_d_iss_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_d_ideo_robust)[23,c("term", "estimate", "std.error")]
tidy(pooled_d_pid_robust)[23,c("term", "estimate", "std.error")]
r1_pooled_bin <- rbind(
tidy(pooled_a_iss_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_a_ideo_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_a_pid_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_b_iss_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_b_ideo_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_b_pid_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_c_iss_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_c_ideo_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_c_pid_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_d_iss_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_d_ideo_robust)[23,c("term", "estimate", "std.error")],
tidy(pooled_d_pid_robust)[23,c("term", "estimate", "std.error")])
r1_pooled_bin$model <- c(rep("a",3), rep("b",3), rep("c",3), rep("d",3))
r1_pooled_bin$measure <- rep(c("iss", "ideo", "pid"), 4)
# a = 3 pool, binary
# b = 3 pool, continuous
# c = 3 pool, binary
# d = 3 pool, continous
pdf("lucid_figures/rr_3way_pooled.pdf", height = 4, width = 8)
par(mfrow = c(2,1), pch = 16, mar = c(1,2,1,0), oma = c(.5,5,1,0))
# 3 Outcomes Pooled ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.1,.1),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "3 Pooled Outcomes (Experiments 1 & 2)")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
# binary congeniality
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_pooled_bin[r1_pooled_bin$model == "a", 2] +
1.96*r1_pooled_bin[1:3,3],
y1 = r1_pooled_bin[r1_pooled_bin$model == "a", 2] -
1.96*r1_pooled_bin[1:3,3],
lwd = 3, col = "gray40")
points(1:3, r1_pooled_bin[r1_pooled_bin$model == "a", 2], cex = 1, pch = c(15, 16, 17))
# continuous congeniality
segments(x0 = 1.2:3.2, x1 = 1.2:3.2,
y0 = r1_pooled_bin[r1_pooled_bin$model == "b", 2] +
1.96*r1_pooled_bin[1:3,3],
y1 = r1_pooled_bin[r1_pooled_bin$model == "b", 2] -
1.96*r1_pooled_bin[1:3,3],
lwd = 3, col = "gray40")
points(1.2:3.2, r1_pooled_bin[r1_pooled_bin$model == "b", 2],
cex = 1, pch = c(0, 1, 2))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Cong. X PK X ID", side = 2, padj = -5) # common y axis label
# 2 Outcomes Pooled ----------------------------------------------------------------------
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.1,.1),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "2 Pooled Outcomes (Experiment 2 Only)")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
# binary congeniality
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_pooled_bin[r1_pooled_bin$model == "c", 2] +
1.96*r1_pooled_bin[1:3,3],
y1 = r1_pooled_bin[r1_pooled_bin$model == "c", 2] -
1.96*r1_pooled_bin[1:3,3],
lwd = 3, col = "gray40")
points(1:3, r1_pooled_bin[r1_pooled_bin$model == "c", 2], cex = 1, pch = c(15, 16, 17))
# continuous congeniality
segments(x0 = 1.2:3.2, x1 = 1.2:3.2,
y0 = r1_pooled_bin[r1_pooled_bin$model == "d", 2] +
1.96*r1_pooled_bin[1:3,3],
y1 = r1_pooled_bin[r1_pooled_bin$model == "d", 2] -
1.96*r1_pooled_bin[1:3,3],
lwd = 3, col = "gray40")
points(1.2:3.2, r1_pooled_bin[r1_pooled_bin$model == "d", 2],
cex = 1, pch = c(0, 1, 2))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Cong. X PK X ID", side = 2, padj = -5) # common y axis label
legend(x = .6, y = -.09, legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =.7, ncol = 3, xpd = NA)
legend(x = 2.5, y = -.08, legend = c("Binary Congeniality Measure",
"Continuous Congeniality Measure"),
pch = c(16, 1),
cex =.7, ncol = 1, xpd = NA)
dev.off()
```
# R&R NFC and Trait Index Moderation Analysis with No Controls
## Need for Closure
```{r}
# Experiment 1----------------------------------------------------------------------------
# Issue Position
r1_nfc_e1_iss <- glm(exp1_correct ~ exp1_congenial_issue_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e1_iss)
# Ideology
r1_nfc_e1_ideo <- glm(exp1_correct ~ exp1_congenial_ideo_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e1_ideo)
# Party ID
r1_nfc_e1_pid <- glm(exp1_correct ~ exp1_congenial_pid_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e1_pid)
# Experiment 2 (Sample Size)--------------------------------------------------------------
# Issue Position
r1_nfc_e2ss_iss <- glm(exp2_goodSample ~ exp2_congenial_issue_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2ss_iss)
# Ideology
r1_nfc_e2ss_ideo <- glm(exp2_goodSample ~ exp2_congenial_ideo_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2ss_ideo)
# Party ID
r1_nfc_e2ss_pid <- glm(exp2_goodSample ~ exp2_congenial_pid_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2ss_pid)
# Experiment 2 (Causal Claim)-------------------------------------------------------------
# issue Position
r1_nfc_e2cc_iss <- glm(exp2_goodCausal ~ exp2_congenial_issue_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2cc_iss)
# Ideology
r1_nfc_e2cc_ideo <- glm(exp2_goodCausal ~ exp2_congenial_ideo_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2cc_ideo)
# Party ID
r1_nfc_e2cc_pid <- glm(exp2_goodCausal ~ exp2_congenial_pid_binary*nfc_mean.s,
data = data)
summary(r1_nfc_e2cc_pid)
```
## Trait Index
```{r}
# Experiment 1----------------------------------------------------------------------------
# Issue Position
r1_ti_e1_iss <- glm(exp1_correct ~ exp1_congenial_issue_binary*trait_index.s,
data = data)
summary(r1_ti_e1_iss)
# Ideology
r1_ti_e1_ideo <- glm(exp1_correct ~ exp1_congenial_ideo_binary*trait_index.s,
data = data)
summary(r1_ti_e1_ideo)
# Party ID
r1_ti_e1_pid <- glm(exp1_correct ~ exp1_congenial_pid_binary*trait_index.s,
data = data)
summary(r1_ti_e1_pid)
# Experiment 2 (Sample Size)--------------------------------------------------------------
# Issue Position
r1_ti_e2ss_iss <- glm(exp2_goodSample ~ exp2_congenial_issue_binary*trait_index.s,
data = data)
summary(r1_ti_e2ss_iss)
# Ideology
r1_ti_e2ss_ideo <- glm(exp2_goodSample ~ exp2_congenial_ideo_binary*trait_index.s,
data = data)
summary(r1_ti_e2ss_ideo)
# Party ID
r1_ti_e2ss_pid <- glm(exp2_goodSample ~ exp2_congenial_pid_binary*trait_index.s,
data = data)
summary(r1_ti_e2ss_pid)
# Experiment 2 (Causal Claim)-------------------------------------------------------------
# issue Position
r1_ti_e2cc_iss <- glm(exp2_goodCausal ~ exp2_congenial_issue_binary*trait_index.s,
data = data)
summary(r1_ti_e2cc_iss)
# Ideology
r1_ti_e2cc_ideo <- glm(exp2_goodCausal ~ exp2_congenial_ideo_binary*trait_index.s,
data = data)
summary(r1_ti_e2cc_ideo)
# Party ID
r1_ti_e2cc_pid <- glm(exp2_goodCausal ~ exp2_congenial_pid_binary*trait_index.s,
data = data)
summary(r1_ti_e2cc_pid)
```
## Figures
```{r}
rownames <- c("r1_nfc_e1_iss", "r1_nfc_e1_ideo", "r1_nfc_e1_pid",
"r1_nfc_e2ss_iss", "r1_nfc_e2ss_ideo", "r1_nfc_e2ss_pid",
"r1_nfc_e2cc_iss", "r1_nfc_e2cc_ideo", "r1_nfc_e2cc_pid")
r1_nfc_bin <- rbind(
as.data.frame(summary(r1_nfc_e1_iss)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e1_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e1_pid)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2ss_iss)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2ss_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2ss_pid)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2cc_iss)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2cc_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_nfc_e2cc_pid)$coef)[4,1:2]
)
r1_ti_bin <- rbind(
as.data.frame(summary(r1_ti_e1_iss)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e1_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e1_pid)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2ss_iss)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2ss_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2ss_pid)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2cc_iss)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2cc_ideo)$coef)[4,1:2],
as.data.frame(summary(r1_ti_e2cc_pid)$coef)[4,1:2]
)
# NFC Plot--------------------------------------------------------------------------------
pdf("lucid_figures/r1_nfc_b.pdf", height = 4, width = 8)
par(mfrow = c(2,3), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Evidence Interpretation")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_nfc_bin[1:3, 1] + 1.96*r1_nfc_bin[1:3,2],
y1 = r1_nfc_bin[1:3, 1] - 1.96*r1_nfc_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, r1_nfc_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Need for Closure", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Sample Size")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_nfc_bin[4:6, 1] + 1.96*r1_nfc_bin[4:6,2],
y1 = r1_nfc_bin[4:6, 1] - 1.96*r1_nfc_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, r1_nfc_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "Causality")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_nfc_bin[7:9, 1] + 1.96*r1_nfc_bin[7:9,2],
y1 = r1_nfc_bin[7:9, 1] - 1.96*r1_nfc_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, r1_nfc_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
# Trait Index Plot-----------------------------------------------------------------------
#par(mfrow = c(2,3), pch = 16, mar = c(0,2,1,0), oma = c(.5,5,1,0))
# E1
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_ti_bin[1:3, 1] + 1.96*r1_ti_bin[1:3,2],
y1 = r1_ti_bin[1:3, 1] - 1.96*r1_ti_bin[1:3,2],
lwd = 3, col = "gray40")
points(1:3, r1_ti_bin[1:3,1], cex = 2, pch = c(15, 16, 17))
axis(2, at = seq(-.4, .4, .10)) # common y axis
mtext(text = "Openness Index", side = 2, padj = -5) # common y axis label
# E2ss
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_ti_bin[4:6, 1] + 1.96*r1_ti_bin[4:6,2],
y1 = r1_ti_bin[4:6, 1] - 1.96*r1_ti_bin[4:6,2],
lwd = 3, col = "gray40")
points(1:3, r1_ti_bin[4:6,1], cex = 2, pch = c(15, 16, 17))
legend("bottom", legend = c("Issue Position", "Ideology" , "Party ID"),
pch = c(15, 16, 17),
cex =1.5, ncol = 3, xpd = NA)
# E2cc
plot(1,1, col = "white", bty = "n", xlim = c(.5,3.5), ylim = c(-.5,.5),
xaxt = "n", yaxt = "n",
xlab = "", ylab = "",
main = "")
segments(x0 = .5, x1 = 3.5,
y0 = 0, y1 = 0,
col = "gray", lty = 2, lwd = 1)
segments(x0 = 1:3, x1 = 1:3,
y0 = r1_ti_bin[7:9, 1] + 1.96*r1_ti_bin[7:9,2],
y1 = r1_ti_bin[7:9, 1] - 1.96*r1_ti_bin[7:9,2],
lwd = 3, col = "gray40")
points(1:3, r1_ti_bin[7:9,1], cex = 2, pch = c(15, 16, 17))
dev.off()
sink()
```