owned this note
owned this note
Published
Linked with GitHub
# Assignment 1 Plan
#### Sasha Kew, Thenuka Kanagasabesan, Fun Hui, Hannah Machet
## Criteria for group assignment
1) My teammate pulled their weight e.g. attending Q&A, contribute during group meetings, help to troubleshoot/ Google/ support others in their learning.
2) My teammate interacted with the group in a way that created a respectful and friendly environment.
3) My teammate provided honest and constructive feedback to further strengthen the quality of our final output.
4) My teammate efficiently responded to messages and also attended scheduled meetings outside of workshop.
5) My teammate kept an open mind and actively listened to all ideas.
# Plan
The paper we are planning to reproduce is:
[Preregistered Replication of “Feeling Superior Is a Bipartisan Issue: Extremity (Not Direction) of Political Views Predicts Perceived Belief Superiority](https://journals.sagepub.com/doi/pdf/10.1177/0956797620968792)
The data can be downloaded [here](https://osf.io/x79pm/)
-------
There were 2 studies reported in this paper; the pilot study and main study.
For the pilot study, no demographics were included but the findings on the mean score on the controversiality of the scales was reported. Hence, we aim to reproduce this mean.
For the main study, the demographics and descriptive statistics on dogmatism and belief superiority were reported. Hence, we aim to reproduce these statistics.
1. Demographic descriptives (reported in materials and participants)
2. Descriptive statistics (reported under materials in the method section and participants under the main study section)
3. Figures/ Plots (three scatterplots in the results section, reporting on dogmatism/belief superiority as function of attitude or political orientation)
## Demographics and Descriptives (Main study)
1. Number of participants
2. % of each gender
3. Mean age and SD
4. % for each political affiliation

## Study 1 (Pilot study)
- Mean score of controversiality for all 20 scales

## Study 2 (Main study)
- Means and SDs for the dogmatism scale, the measure of belief superiority and issue-relevant attitudes


## Figures
The goal is to reproduce this scatterplot.
**Figure 1.**

The goal is to reproduce this scatterplot.
**Figure 2.**

The goal is to reproduce this scatterplot.
**Figure 3.**

## First Steps
To get started we need to:
1. Download the csv file of the article's data and read the file in R Studio.
2. Locate the codebook to use for reference and to determine the data's variables.
3. Work together to figure out how to reproduce the mean, SD and demographical information from the studies.
4. Use the above information to create scatterplots in ggplot.
data_attn$immigration_a_c=data_attn$immigration_a-mean(data_attn$immigration_a,na.rm=TRUE)
data_attn$abortion_a_c=data_attn$abortion_a-mean(data_attn$abortion_a,na.rm=TRUE)
data_attn$vote_a_c=data_attn$vote_a-mean(data_attn$vote_a,na.rm=TRUE)
data_attn$tax_a_c=data_attn$tax_a-mean(data_attn$tax_a,na.rm=TRUE)
data_attn$torture_a_c=data_attn$torture_a-mean(data_attn$torture_a,na.rm=TRUE)
data_attn$affirmaction_a_c=data_attn$affirmaction_a-mean(data_attn$affirmaction_a,na.rm=TRUE)
data_attn$military_a_c=data_attn$military_a-mean(data_attn$military_a,na.rm=TRUE)
data_attn$covidgov_a_c=data_attn$covidgov_a-mean(data_attn$covidgov_a,na.rm=TRUE)
data_attn$subject=c(1:nrow(data_attn))
data_attnlong <- bind_cols(data_attn %>% dplyr::select(. , ends_with("_a_c"), subject,38:67,76) %>%gather(. , topic, attitude_c, ends_with("_a_c")),data_attn %>% dplyr::select(. ,ends_with("_b"), subject) %>% gather(. , topic, beliefsup, ends_with("_b")), data_attn %>% dplyr::select(. ,ends_with("_a"), subject) %>% gather(. , topic, attitude, ends_with("_a")))
data_attnlong$attitude=as.factor(data_attnlong$attitude)
forplot= data_attnlong[which(!is.na(data_attnlong$attitude)),]
ggplot(forplot, aes(x=attitude, y=beliefsup, color=attitude)) +
geom_violin(position = position_nudge(x = .2, y = 0), alpha = .8) + geom_point(aes(y = beliefsup, color = attitude), position = position_jitter(width = .15),
size = 1.5, alpha = 0.2) +
stat_summary(fun.y=mean, size=2, color="black",geom="line", aes(group = 1)) +
stat_summary(fun.y=mean, size=2, color="black",geom="point", aes(group = 1)) +
stat_summary(fun.data = mean_cl_boot,geom='errorbar', fun.args=list(conf.int=.95),
size=1.5, aes(width=.3), color="black")+
labs(x='Attitude', y='Belief Superiority') +
theme_minimal() +
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
scale_x_discrete(labels = c("1","2","2.3","3","3.7","4","5"))+ easy_remove_legend() + theme(axis.line= element_line(color="black")) +
theme(axis.ticks.y = element_line(color="black")) + scale_colour_manual(values = c("#000066", "#0000FF", "#3399FF", "#000000", "#331900", "#660000", "#CC0000"))
install.packages("PupillometryR")
geom_errorbar()
"#CC0000", "#660000","#331900", "#000000", "#3399FF", "#0000FF", "#000066"
```{r}
data_attn$PO_c= data_attn$Q12-mean(data_attn$Q12,na.rm=TRUE)
ggplot(data_attn, aes(x=PO_c, y=meanDog,color=PO_c)) +
geom_point(aes(y = meanDog), position = position_jitter(width = .15), size = 2.5, alpha = 0.6) +
stat_summary(fun.y=mean, geom='point', size=2, color="black") +
stat_summary(fun.data = mean_cl_boot,geom='errorbar', fun.args=list(conf.int=.95),
size=1.5, aes(width=.3), color="black")+
labs(x='Political Orientation', y='Dogmatism') +
stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 2) +
theme_minimal() +
theme(axis.line= element_line(color="black")) + theme(axis.ticks.y = element_line(color="black")) + easy_remove_legend() + scale_x_continuous(breaks = c(-3,-2,-1,0,1,2,3)) +
scale_y_continuous(breaks = c(0,1,2,3,4,5,6,7,8,9),lim=c(1,9)) + easy_all_text_size(size = 16) + scale_colour_gradient2(low = "blue", mid = "black", high = "red")
```
pilot study code:
```{r}
Pilotdata <-read_csv("pilotdata_all.csv")
```
```{r}
Ds=Pilotdata[which(Pilotdata$PA==1),]
Rs=Pilotdata[which(Pilotdata$PA==2),]
Is=Pilotdata[which(Pilotdata$PA==3),]
overallmeans=c()
Dmeans=c()
Rmeans=c()
Imeans=c()
for (x in 9:30){
Mean= colMeans(Pilotdata[x],na.rm = TRUE)
overallmeans=c(overallmeans,Mean)
Mean= colMeans(Ds[x],na.rm = TRUE)
Dmeans=c(Dmeans,Mean)
Mean= colMeans(Rs[x],na.rm = TRUE)
Rmeans=c(Rmeans,Mean)
Mean= colMeans(Is[x],na.rm = TRUE)
Imeans=c(Imeans,Mean)
}
Dmeans
Rmeans
Imeans
overallmeans
```
for thenuka!
data_attn$PO_c= data_attn$Q12-mean(data_attn$Q12,na.rm=TRUE)
ggplot(data_attn, aes(x=PO_c, y=meanD,color=PO_c)) +
geom_point(aes(y = meanD), position = position_jitter(width = .15),
size = 2.5, alpha = 0.6) +
stat_summary(fun.y=mean, geom='point', size=2, color="black") +
stat_summary(fun.data = mean_cl_boot,geom='errorbar',
fun.args=list(conf.int=.95),
size=1.5, aes(width=.3), color="black")+
labs(x='Political Orientation', y='Dogmatism') +
stat_smooth(method = "lm", formula = y ~ x + I(x^2), size = 2) +
theme_minimal() +
theme(axis.line= element_line(color="black")) +
theme(axis.ticks.y = element_line(color="black")) + easy_remove_legend() +
scale_x_continuous(breaks = c(-3,-2,-1,0,1,2,3))+
scale_y_continuous(breaks = c(0,1,2,3,4,5,6,7,8,9),lim=c(1,9)) +
easy_all_text_size(size = 16) +
scale_colour_gradient2(low = "red", mid = "black", high = "blue")