diff --git a/code/R/experiments/Experiment.Rmd b/code/R/experiments/Experiment.Rmd index c44c61b..cf87a26 100644 --- a/code/R/experiments/Experiment.Rmd +++ b/code/R/experiments/Experiment.Rmd @@ -50,21 +50,21 @@ df.data1 = merge(df.responses, df.participants, by="workerid") ```{r} df.exp1 = df.data1 %>% - gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% + gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% mutate(CausalStructure = case_when( - str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive", - str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive", - str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive", - str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% + str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive", + str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive", + str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive", + str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% mutate(Order = case_when( - str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first", - str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% + str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first", + str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% mutate(ResponseType = case_when( - str_detect(index, "explanation") ~ "explanation", - str_detect(index, "intervention") ~ "intervention"))%>% + str_detect(index, "explanation") ~ "explanation", + str_detect(index, "intervention") ~ "intervention"))%>% select(-index) %>% spread(ResponseType, response) %>% mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>% @@ -72,38 +72,34 @@ df.exp1 = df.data1 %>% "orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "positive") - - - - + intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "positive") ``` ## Prepate Dataset @@ -124,7 +120,6 @@ df.exp1_summary = df.exp1 %>% mutate(Experiment = "hardint") write_csv(df.exp1_summary, "../../../data/aggregate/hardint_pos.csv") - ``` # Condition 2: Hard Intervention: Negative Outcome @@ -147,21 +142,21 @@ df.data2 = merge(df.responses, df.participants, by="workerid") ```{r} df.exp2 = df.data2 %>% - gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% + gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% mutate(CausalStructure = case_when( - str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive", - str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive", - str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive", - str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% + str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive", + str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive", + str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive", + str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% mutate(Order = case_when( - str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first", - str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% + str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first", + str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% mutate(ResponseType = case_when( - str_detect(index, "explanation") ~ "explanation", - str_detect(index, "intervention") ~ "intervention"))%>% + str_detect(index, "explanation") ~ "explanation", + str_detect(index, "intervention") ~ "intervention"))%>% select(-index) %>% spread(ResponseType, response) %>% mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>% @@ -169,34 +164,34 @@ df.exp2 = df.data2 %>% "orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "negative") + intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "negative") ``` @@ -241,21 +236,21 @@ df.data3 = merge(df.responses, df.participants, by="workerid") ```{r} df.exp3 = df.data3 %>% - gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% + gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% mutate(CausalStructure = case_when( - str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive", - str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% + str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive", + str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% mutate(Order = case_when( - str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first", - str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% + str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first", + str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% mutate(ResponseType = case_when( - str_detect(index, "explanation") ~ "explanation", - str_detect(index, "intervention") ~ "intervention"))%>% + str_detect(index, "explanation") ~ "explanation", + str_detect(index, "intervention") ~ "intervention"))%>% select(-index) %>% spread(ResponseType, response) %>% mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>% @@ -263,35 +258,35 @@ df.exp3 = df.data3 %>% "orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other"))%>% - mutate(intervention = "soft") %>% - mutate(outcome = "positive") - + intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other"))%>% + mutate(intervention = "soft") %>% + mutate(outcome = "positive") + ``` @@ -336,21 +331,21 @@ df.data4 = merge(df.responses, df.participants, by="workerid") %>% ```{r} df.exp4 = df.data4 %>% - gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% + gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% mutate(CausalStructure = case_when( - str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive", - str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% + str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive", + str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% mutate(Order = case_when( - str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first", - str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% + str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first", + str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% mutate(ResponseType = case_when( - str_detect(index, "explanation") ~ "explanation", - str_detect(index, "intervention") ~ "intervention"))%>% + str_detect(index, "explanation") ~ "explanation", + str_detect(index, "intervention") ~ "intervention"))%>% select(-index) %>% spread(ResponseType, response) %>% mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>% @@ -358,35 +353,35 @@ df.exp4 = df.data4 %>% "orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "soft") %>% - mutate(outcome = "negative") - + intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "soft") %>% + mutate(outcome = "negative") + ``` @@ -431,21 +426,21 @@ df.data5 = merge(df.responses, df.participants, by="workerid") ```{r} df.exp5 = df.data5 %>% - gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% + gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% mutate(CausalStructure = case_when( - str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive", - str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive", - str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% + str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive", + str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive", + str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% mutate(Order = case_when( - str_detect(proliferate.condition, "Condition1") ~ "conjunctive first", - str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% + str_detect(proliferate.condition, "Condition1") ~ "conjunctive first", + str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% mutate(ResponseType = case_when( - str_detect(index, "explanation") ~ "explanation", - str_detect(index, "intervention") ~ "intervention"))%>% + str_detect(index, "explanation") ~ "explanation", + str_detect(index, "intervention") ~ "intervention"))%>% select(-index) %>% spread(ResponseType, response) %>% mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>% @@ -453,34 +448,34 @@ df.exp5 = df.data5 %>% "orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "fixed") %>% - mutate(outcome = "positive") + intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "fixed") %>% + mutate(outcome = "positive") ``` diff --git a/code/R/experiments/Experiment.html b/code/R/experiments/Experiment.html index 1e061bb..1f371f6 100644 --- a/code/R/experiments/Experiment.html +++ b/code/R/experiments/Experiment.html @@ -1594,21 +1594,21 @@

2.1 Read in Data

2.2 Wrangle Data

df.exp1 = df.data1 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1616,34 +1616,34 @@ 

2.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "positive")

2.3 Prepate Dataset

@@ -1681,21 +1681,21 @@

3.1 Read in Data

3.2 Wrangle Data

df.exp2 = df.data2 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1703,34 +1703,34 @@ 

3.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "negative")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "negative")

3.3 Prepare Dataset

@@ -1768,21 +1768,21 @@

4.1 Read in Data

4.2 Wrangle Data

df.exp3 = df.data3 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1790,34 +1790,34 @@ 

4.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other"))%>% - mutate(intervention = "soft") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other"))%>% + mutate(intervention = "soft") %>% + mutate(outcome = "positive")

4.3 Prepare Dataset

@@ -1856,21 +1856,21 @@

5.1 Read in Data

5.2 Wrangle Data

df.exp4 = df.data4 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1878,34 +1878,34 @@ 

5.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "soft") %>% - mutate(outcome = "negative")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "soft") %>% + mutate(outcome = "negative")

5.3 Prepare Dataset

@@ -1943,21 +1943,21 @@

6.1 Read in Data

6.2 Wrangle Data

df.exp5 = df.data5 %>% 
-   gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition1") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition1") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1965,34 +1965,34 @@ 

6.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "fixed") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "fixed") %>% + mutate(outcome = "positive")

6.3 Prepare Dataset

@@ -2007,7 +2007,7 @@

6.3 Prepare Dataset

normal_intervention_percentage = mean(normal_intervention == "normal") * 100, nopreference_intervention_percentage = mean(nopreference_intervention == "no preference") * 100 ) %>% - mutate(Outcome = "negative") %>% + mutate(Outcome = "positive") %>% mutate(Experiment = "fixedint") write_csv(df.exp5_summary, "../../../data/aggregate/fixedint_pos.csv")
diff --git a/code/R/optimal_intervention_model/optimal_intervention_model.Rmd b/code/R/optimal_intervention_model/optimal_intervention_model.Rmd index 4f5f7f6..f87c806 100644 --- a/code/R/optimal_intervention_model/optimal_intervention_model.Rmd +++ b/code/R/optimal_intervention_model/optimal_intervention_model.Rmd @@ -374,7 +374,6 @@ write.csv(df.prediction_explanation_truth_only, file = "../../../data/model/expl ``` - # Session info ```{r, echo=F} diff --git a/code/R/optimal_intervention_model/optimal_intervention_model.html b/code/R/optimal_intervention_model/optimal_intervention_model.html index 4e0acc8..b7d280f 100644 --- a/code/R/optimal_intervention_model/optimal_intervention_model.html +++ b/code/R/optimal_intervention_model/optimal_intervention_model.html @@ -1591,12 +1591,12 @@

3 Functions

4 DATA

df.data = bind_rows(
-  read_csv(file = "../../../data/hardint_pos.csv"),
-  read_csv(file = "../../../data/hardint_neg.csv"),
-  read_csv(file = "../../../data/softint_pos.csv"),
-  read_csv(file = "../../../data/softint_neg.csv"),
-  read_csv(file = "../../../data/fixedint_pos.csv"),
-  read_csv(file = "../../../data/fixedint_neg.csv")) %>% 
+  read_csv(file = "../../../data/aggregate/hardint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/hardint_neg.csv"),
+  read_csv(file = "../../../data/aggregate/softint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/softint_neg.csv"),
+  read_csv(file = "../../../data/aggregate/fixedint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/fixedint_neg.csv")) %>% 
   clean_names() %>% 
   mutate(causal_structure = str_to_lower(causal_structure),
          experiment = str_remove(experiment, "int")) %>% 
@@ -1728,10 +1728,10 @@ 

5.1.3 Fit softmax parameter

pull(loss) } -fit.temperature = optim(par = 10, +fit.temperature = optim(par = 10, fn = fun.fit_temperature, method = "L-BFGS-B", - lower = 0, + lower = 0, upper = 100, df_data = df.intervention, df_prediction = df.choice) @@ -1874,8 +1874,8 @@

5.2.4.1 Combined model

mutate(prediction = fun.softmax(fit.params$par[1] * value + (1 - fit.params$par[1]) * truth, temp = fit.params$par[2])) %>% ungroup() -# write.csv(df.prediction_explanation, file = "explanation_predictions.csv", row.names = FALSE) -# write.csv(df.prediction_intervention, file = "intervention_predictions.csv", row.names = FALSE)
+write.csv(df.prediction_explanation, file = "../../../data/model/explanation_predictions.csv", row.names = FALSE) +write.csv(df.prediction_intervention, file = "../../../data/model/intervention_predictions.csv", row.names = FALSE)

5.2.4.2 Intervention only model

@@ -1884,7 +1884,7 @@

5.2.4.2 Intervention only model mutate(prediction = fun.softmax(value, temp = fit.params_intervention_only$par[1])) %>% ungroup() -# write.csv(df.prediction_explanation_intervention_only, file = "explanation_predictions_intervention_only.csv", row.names = FALSE)

+write.csv(df.prediction_explanation_intervention_only, file = "../../../data/model/explanation_predictions_intervention_only.csv", row.names = FALSE)

5.2.4.3 Truth only model

@@ -1893,7 +1893,7 @@

5.2.4.3 Truth only model

mutate(prediction = fun.softmax(truth, temp = fit.params_truth_only$par[1])) %>% ungroup() -# write.csv(df.prediction_explanation_truth_only, file = "explanation_predictions_truth_only.csv", row.names = FALSE)
+write.csv(df.prediction_explanation_truth_only, file = "../../../data/model/explanation_predictions_truth_only.csv", row.names = FALSE) diff --git a/docs/analyses/experiments/index.html b/docs/analyses/experiments/index.html index 1e061bb..1f371f6 100644 --- a/docs/analyses/experiments/index.html +++ b/docs/analyses/experiments/index.html @@ -1594,21 +1594,21 @@

2.1 Read in Data

2.2 Wrangle Data

df.exp1 = df.data1 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Conpos_") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Dispos_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Conpos_") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Dispos_") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1616,34 +1616,34 @@ 

2.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "positive")

2.3 Prepate Dataset

@@ -1681,21 +1681,21 @@

3.1 Read in Data

3.2 Wrangle Data

df.exp2 = df.data2 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Conneg_") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Disneg_") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Conneg_") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Disneg_") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1703,34 +1703,34 @@ 

3.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "hard") %>% - mutate(outcome = "negative")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "hard") %>% + mutate(outcome = "negative")

3.3 Prepare Dataset

@@ -1768,21 +1768,21 @@

4.1 Read in Data

4.2 Wrangle Data

df.exp3 = df.data3 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition_1") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition_1") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition_2") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1790,34 +1790,34 @@ 

4.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other"))%>% - mutate(intervention = "soft") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other"))%>% + mutate(intervention = "soft") %>% + mutate(outcome = "positive")

4.3 Prepare Dataset

@@ -1856,21 +1856,21 @@

5.1 Read in Data

5.2 Wrangle Data

df.exp4 = df.data4 %>% 
-    gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition_3") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition_4") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition_3") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition_4") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1878,34 +1878,34 @@ 

5.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "soft") %>% - mutate(outcome = "negative")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "soft") %>% + mutate(outcome = "negative")

5.3 Prepare Dataset

@@ -1943,21 +1943,21 @@

6.1 Read in Data

6.2 Wrangle Data

df.exp5 = df.data5 %>% 
-   gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
+  gather("index", "response", -c(workerid, proliferate.condition, age, ethnicity, gender, feedback, race))%>% 
   mutate(CausalStructure  =
            case_when(
-       str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive",
-       str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive",
-       str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
+             str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_1") ~ "Conjunctive",
+             str_detect(proliferate.condition, "Condition1") & str_detect(index, "response_2") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_1") ~ "Disjunctive",
+             str_detect(proliferate.condition, "Condition2") & str_detect(index, "response_2") ~ "Conjunctive"))%>% 
   mutate(Order =
            case_when(
-       str_detect(proliferate.condition, "Condition1") ~ "conjunctive first",
-       str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% 
+             str_detect(proliferate.condition, "Condition1") ~ "conjunctive first",
+             str_detect(proliferate.condition, "Condition2") ~ "disjunctive first"))%>% 
   mutate(ResponseType =
            case_when(
-       str_detect(index, "explanation") ~ "explanation",
-       str_detect(index, "intervention")  ~ "intervention"))%>% 
+             str_detect(index, "explanation") ~ "explanation",
+             str_detect(index, "intervention")  ~ "intervention"))%>% 
   select(-index) %>% 
   spread(ResponseType, response) %>% 
   mutate(CausalStructure= factor(CausalStructure, levels=c("Conjunctive", "Disjunctive"))) %>%
@@ -1965,34 +1965,34 @@ 

6.2 Wrangle Data

"orange" = "abnormal", "blue" = "normal" )) %>% mutate(intervention = recode (intervention, - "orange" = "abnormal", - "blue" = "normal" )) %>% + "orange" = "abnormal", + "blue" = "normal" )) %>% mutate(abnormal_explanation = case_when( - explanation == "abnormal" ~ "abnormal", - explanation != "abnormal"~ "other")) %>% + explanation == "abnormal" ~ "abnormal", + explanation != "abnormal"~ "other")) %>% mutate(normal_explanation = case_when( - explanation == "normal" ~ "normal", - explanation != "normal"~ "other")) %>% + explanation == "normal" ~ "normal", + explanation != "normal"~ "other")) %>% mutate(nopreference_explanation = case_when( - explanation == "no preference" ~ "no preference", - explanation != "no preference"~ "other")) %>% + explanation == "no preference" ~ "no preference", + explanation != "no preference"~ "other")) %>% mutate(abnormal_intervention = case_when( - intervention== "abnormal" ~ "abnormal", - intervention!= "abnormal"~ "other")) %>% + intervention== "abnormal" ~ "abnormal", + intervention!= "abnormal"~ "other")) %>% mutate(normal_intervention = case_when( - intervention == "normal" ~ "normal", - intervention != "normal"~ "other")) %>% + intervention == "normal" ~ "normal", + intervention != "normal"~ "other")) %>% mutate(nopreference_intervention = case_when( - intervention== "no preference" ~ "no preference", - intervention!= "no preference"~ "other")) %>% - mutate(intervention = "fixed") %>% - mutate(outcome = "positive")
+ intervention== "no preference" ~ "no preference", + intervention!= "no preference"~ "other")) %>% + mutate(intervention = "fixed") %>% + mutate(outcome = "positive")

6.3 Prepare Dataset

@@ -2007,7 +2007,7 @@

6.3 Prepare Dataset

normal_intervention_percentage = mean(normal_intervention == "normal") * 100, nopreference_intervention_percentage = mean(nopreference_intervention == "no preference") * 100 ) %>% - mutate(Outcome = "negative") %>% + mutate(Outcome = "positive") %>% mutate(Experiment = "fixedint") write_csv(df.exp5_summary, "../../../data/aggregate/fixedint_pos.csv")
diff --git a/docs/analyses/model/index.html b/docs/analyses/model/index.html index 4e0acc8..b7d280f 100644 --- a/docs/analyses/model/index.html +++ b/docs/analyses/model/index.html @@ -1591,12 +1591,12 @@

3 Functions

4 DATA

df.data = bind_rows(
-  read_csv(file = "../../../data/hardint_pos.csv"),
-  read_csv(file = "../../../data/hardint_neg.csv"),
-  read_csv(file = "../../../data/softint_pos.csv"),
-  read_csv(file = "../../../data/softint_neg.csv"),
-  read_csv(file = "../../../data/fixedint_pos.csv"),
-  read_csv(file = "../../../data/fixedint_neg.csv")) %>% 
+  read_csv(file = "../../../data/aggregate/hardint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/hardint_neg.csv"),
+  read_csv(file = "../../../data/aggregate/softint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/softint_neg.csv"),
+  read_csv(file = "../../../data/aggregate/fixedint_pos.csv"),
+  read_csv(file = "../../../data/aggregate/fixedint_neg.csv")) %>% 
   clean_names() %>% 
   mutate(causal_structure = str_to_lower(causal_structure),
          experiment = str_remove(experiment, "int")) %>% 
@@ -1728,10 +1728,10 @@ 

5.1.3 Fit softmax parameter

pull(loss) } -fit.temperature = optim(par = 10, +fit.temperature = optim(par = 10, fn = fun.fit_temperature, method = "L-BFGS-B", - lower = 0, + lower = 0, upper = 100, df_data = df.intervention, df_prediction = df.choice) @@ -1874,8 +1874,8 @@

5.2.4.1 Combined model

mutate(prediction = fun.softmax(fit.params$par[1] * value + (1 - fit.params$par[1]) * truth, temp = fit.params$par[2])) %>% ungroup() -# write.csv(df.prediction_explanation, file = "explanation_predictions.csv", row.names = FALSE) -# write.csv(df.prediction_intervention, file = "intervention_predictions.csv", row.names = FALSE)
+write.csv(df.prediction_explanation, file = "../../../data/model/explanation_predictions.csv", row.names = FALSE) +write.csv(df.prediction_intervention, file = "../../../data/model/intervention_predictions.csv", row.names = FALSE)

5.2.4.2 Intervention only model

@@ -1884,7 +1884,7 @@

5.2.4.2 Intervention only model mutate(prediction = fun.softmax(value, temp = fit.params_intervention_only$par[1])) %>% ungroup() -# write.csv(df.prediction_explanation_intervention_only, file = "explanation_predictions_intervention_only.csv", row.names = FALSE)

+write.csv(df.prediction_explanation_intervention_only, file = "../../../data/model/explanation_predictions_intervention_only.csv", row.names = FALSE)

5.2.4.3 Truth only model

@@ -1893,7 +1893,7 @@

5.2.4.3 Truth only model

mutate(prediction = fun.softmax(truth, temp = fit.params_truth_only$par[1])) %>% ungroup() -# write.csv(df.prediction_explanation_truth_only, file = "explanation_predictions_truth_only.csv", row.names = FALSE)
+write.csv(df.prediction_explanation_truth_only, file = "../../../data/model/explanation_predictions_truth_only.csv", row.names = FALSE) diff --git a/figures/plots/bars.pdf b/figures/plots/bars.pdf index c0c248a..2531972 100644 Binary files a/figures/plots/bars.pdf and b/figures/plots/bars.pdf differ diff --git a/figures/plots/scatter.pdf b/figures/plots/scatter.pdf index 7abca1c..7c0c1d2 100644 Binary files a/figures/plots/scatter.pdf and b/figures/plots/scatter.pdf differ