Skip to content

Commit

Permalink
latest analysis code
Browse files Browse the repository at this point in the history
  • Loading branch information
Carolina Nobre authored and Carolina Nobre committed Jul 29, 2023
1 parent 2a4e987 commit 659336e
Show file tree
Hide file tree
Showing 10 changed files with 4,170 additions and 248 deletions.
Binary file modified study_data/.DS_Store
Binary file not shown.
Binary file not shown.
Binary file modified study_data/full_Study/complexity_dataType_interaction.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
97 changes: 83 additions & 14 deletions study_data/full_Study/trustFullAnalysis_6.12.2023.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ library(patchwork)
library(rstatix)
library(effectsize)
library(GPArotation)
library(MASS)
# environment to include the ss_psych450_rws3 platform
load("ss_psych450_rws3")
```
Expand Down Expand Up @@ -93,11 +94,63 @@ results %>%
ggsave(paste("complexity_dataType_interaction.pdf", sep=""))
#ggsave(paste("complexity_dataType_interaction.pdf", sep=""))
```


```{r}
MinMeanSEMMax <- function(x) {
v <- c(min(x), mean(x) - sd(x)/sqrt(length(x)), mean(x), mean(x) + sd(x)/sqrt(length(x)), max(x))
names(v) <- c("ymin", "lower", "middle", "upper", "ymax")
v
}
results %>%
# group_by(complexity, isCovidData) %>%
ggplot(aes( x = vis.trust_6, y = 0, cex=1.5, colour = chartType)) +
scale_color_manual(values = c("purple", "orange")) +
ylim(-0.5, 0.5) +
geom_jitter(data = results, width = 0.3, height = 0.2, color = "light gray", alpha = 0.5) +
#stat_summary(fun.data=MinMeanSEMMax, geom="boxplot", colour="red") +
geom_boxplot(lwd = 1, fatten = NULL, width = 0.25, alpha = 0.5) +
geom_segment(data = results %>%
group_by(complexity, chartType) %>%
summarize(n = n(),
mean = mean(vis.trust_6),
se = sd(vis.trust_6)/sqrt(n)),
aes(x = mean, xend = mean, y = -.25, yend = .25, colour = chartType), size = 1) +
# stat_summary(fun.data = "mean_cl_boot", colour = "red", size = 0.5, position = position_nudge(x=0.25, y=0), alpha=0.5) +
geom_text( data = results %>%
group_by(complexity, chartType) %>%
summarize(n = n(),
mean = round(mean(vis.trust_6),digits=2),
se = round(sd(data.trust_6)/sqrt(n),digits=2),
vis.trust_6 = mean(vis.trust_6)),
# aes(label = paste(mean, "[",mean-se,",",mean+se,"]"), x = 6.2, y = 0.43, fontface = 3), size=3, colour = "black")+
aes(label = paste(mean), x = mean, y = .35, fontface = 3), size=4, colour = "black")+
facet_grid(complexity ~ chartType) +
xlab("Trust in Visualization") +
theme_minimal() +
theme(panel.spacing = unit(2, "lines"),
legend.position = "none",
axis.text.y = element_blank(),
axis.title.y = element_blank(),
axis.ticks.y = element_blank())
ggsave(paste("complexity_chartType_interaction.pdf", sep=""))
```



```{r}
results %>%
group_by(complexity, isCovidData) %>%
Expand Down Expand Up @@ -148,7 +201,7 @@ results %>%
axis.title.y = element_blank(),
axis.ticks.y = element_blank())
ggsave(paste("complexity_interaction.pdf", sep=""))
#ggsave(paste("complexity_interaction.pdf", sep=""))
```

Expand All @@ -164,9 +217,8 @@ results %>%
```

```{r}
model <- lm(formula = vis.trust_6 ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results%>%filter(isCovidData == 1)
filter(isCovidData ==1 ))
model <- lm(formula = vis.trust_6 ~ complexity * as.factor(isCovidData) * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
anova(model)
```
```{r}
Expand Down Expand Up @@ -196,15 +248,32 @@ anova(model)
```
```{r}
# can change the predictor to bar.vis
model<- manova(cbind(vis.trust_6,
vis.trust_5,
vis.trust_4,
vis.trust_3,
vis.trust_2,
vis.trust_1) ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results %>%filter(isCovidData == 1))
model<- manova( cbind(vis.trust_6,vis.trust_1,vis.trust_2,vis.trust_3,vis.trust_4,vis.trust_5,affect.science_1,affect.clarity_1,affect.aesthetic_1) ~ complexity * as.factor(isCovidData) * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
summary(model)
eta_squared(model)
summary.aov(model)
```


```{r}
model<- manova( cbind(data.trust_6,data.trust_1,data.trust_2,data.trust_3,data.trust_4,data.trust_5) ~ complexity * as.factor(isCovidData) * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
anova(model)
eta_squared(model)
summary.aov(model)
```

```{r}
Expand Down Expand Up @@ -479,7 +548,7 @@ results %>%
How does performance on VLAT questions predict trust?

```{r}
model <- lm(formula = vis.trust_6 ~ assigned_vlat *
model <- lm(formula = vis.trust_6 ~ assigned_vlat +
Age + Gender + State_1 + Education + Parents_education + Language +
Ethnicity + Income + Religion + trust.in.science_7 +
need_for_cognition + interpersonal.trust_1,
Expand Down
3,690 changes: 3,690 additions & 0 deletions study_data/full_Study/trustFullAnalysis_6.12.2023.nb.html

Large diffs are not rendered by default.

33 changes: 31 additions & 2 deletions study_data/replicationStudy/trustFullAnalysis_7.24.2023.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,33 @@ results %>%
```

```{r}
model <- lm(formula = vis.trust_6 ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
model <- lm(formula = vis.trust_5 ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
anova(model)
```
```{r}
model <- lm(formula = vis.trust_6 ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results%>% filter(complexity !='moderatex'))
data = results)
anova(model)
```


```{r}
model<- manova( cbind(vis.trust_6,vis.trust_1,vis.trust_2,vis.trust_3,vis.trust_4,vis.trust_5,affect.science_1,affect.clarity_1,affect.aesthetic_1) ~ complexity * chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
anova(model)
eta_squared(model)
summary.aov(model)
```

```{r}
model <- lm(formula = vis.trust_6 ~ complexity + chartType + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
Expand All @@ -186,6 +200,21 @@ anova(model)


Linear Regression Model for trust in vis as a function of

```{r}
# can change the predictor to bar.vis
model<- manova(cbind(vis.trust_6,
affect.science_1,
affect.clarity_1,
affect.aesthetic_1,
vis.trust_3,
vis.trust_2,
vis.trust_1) ~ complexity* chartType + Age + Gender + State_1 + Education + Parents_education + Language + Ethnicity + Income + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
summary(model)
```


```{r}
model <- lm(formula = vis.trust_6 ~ complexity *chartType + Age + Gender + State_1 + Income + Education + Parents_education + Language + Ethnicity + Religion + trust.in.science_7 + need_for_cognition + interpersonal.trust_1 ,
data = results)
Expand Down
Loading

0 comments on commit 659336e

Please sign in to comment.