diff --git a/code/R/teleological_properties.Rmd b/code/R/teleological_properties.Rmd index 63d0a0a..95b536b 100644 --- a/code/R/teleological_properties.Rmd +++ b/code/R/teleological_properties.Rmd @@ -326,7 +326,7 @@ ggplot(data = df.exp2.long, scale_y_continuous(breaks = 1:7) + scale_shape_manual(values = c(21, 23)) + ggtitle("What is this creature?") + - xlab("Property type of creature \n\ that differed") + + xlab("Property type that \n\ differed") + theme(plot.title = element_text(size=24, hjust = .5), legend.title = element_blank(), legend.position = "bottom", @@ -605,11 +605,6 @@ ggplot(data = df.llm, jitter.width = 0.1, jitter.height = 0.0), alpha = 0.2) + - stat_summary(fun.data = "mean_cl_boot", - position = position_dodge(width = 0.5), - shape = 21, - color = "black", - size = .5) + scale_fill_brewer(palette = "Set1") + scale_color_brewer(palette = "Set1") + # scale_y_continuous(breaks = 1:7) + @@ -621,7 +616,7 @@ ggplot(data = df.llm, text = element_text(size = 18)) + facet_wrap(~ model) -ggsave(width = 8, height = 3, "../../figures/experiment2/bert_overall_property_means.pdf") +ggsave(width = 8, height = 3, "../../figures/experiment2/bert_overall_probabilities.pdf") ``` @@ -714,7 +709,7 @@ ggplot(data = df.exp3.long, scale_y_continuous(breaks = 1:7) + scale_shape_manual(values = c(21, 23)) + ggtitle("What is this creature?") + - xlab("Property type of creature \n\ that differed") + + xlab("Property type that \n\ differed") + theme(plot.title = element_text(size=24, hjust = .5), legend.title = element_blank(), legend.position = "bottom", @@ -913,7 +908,7 @@ ggplot(data = df.exp4.long, scale_y_continuous(breaks = 1:7) + scale_shape_manual(values = c(21, 23)) + ggtitle("What is this creature?") + - xlab("Property type of creature \n\ that differed") + + xlab("Property type that \n\ differed") + theme(plot.title = element_text(size=24, hjust = .5), legend.title = element_blank(), legend.position = "bottom", diff --git a/code/R/teleological_properties.html b/code/R/teleological_properties.html index 89e6ae3..9e95d71 100644 --- a/code/R/teleological_properties.html +++ b/code/R/teleological_properties.html @@ -11,7 +11,7 @@ - + Teleological Properties @@ -428,7 +428,7 @@

Teleological Properties

David Rose, Siying Zhang, Qi Han & Tobias Gerstenberg

-

May 06, 2024

+

July 20, 2024

@@ -509,12 +509,16 @@

May 06, 2024

1 Load packages

library("xtable")         # for saving tables
-library("emmeans")        # for comparing models
-library("knitr")          # for knitting  
-library("RSQLite")        # for reading in participants.db file 
-library("tidyjson")       # for reading in json data 
-library("brms")           # for Bayesian data analysis
-library("tidyverse")      # for everything else 
+library("png") # for reading in png files +library("grid") # for arranging plots +remotes::install_github("wilkelab/ggtext") +library("ggtext") # for formatting ggplot2 text +library("emmeans") # for comparing models +library("knitr") # for knitting +library("RSQLite") # for reading in participants.db file +library("tidyjson") # for reading in json data +library("brms") # for Bayesian data analysis +library("tidyverse") # for everything else

2 Global options

@@ -810,36 +814,64 @@

4.3 Demographics

4.4 Plots

4.4.1 Property Means by Condition

-
ggplot(data = df.exp2.long,
-       mapping = aes(x = property,
-                     y = response,
-                     group = condition,
-                     color = property,
-                     fill = property,
-                     shape = condition)) + 
-  geom_point(position = position_jitterdodge(dodge.width = 0.5,
-                                             jitter.width = 0.1,
-                                             jitter.height = 0.0),
-             alpha = 0.05) + 
-  theme(legend.position = "none") +
-  stat_summary(fun.data = "mean_cl_boot",
-               position = position_dodge(width = 0.5),
-               color = "black",
-               size = .5) + 
-  scale_fill_brewer(palette = "Set1") + 
-  scale_color_brewer(palette = "Set1") + 
-  scale_y_continuous(breaks = 1:7) +
-  scale_shape_manual(values = c(21, 23)) + 
-  theme(plot.title = element_text(size=16, hjust = .5),
-        legend.title = element_blank(),
-        legend.position = "bottom",
-        axis.title.x = element_blank()) + 
-  guides(fill = "none",
-         color = "none",
-         shape = guide_legend(override.aes = list(fill = "gray50")))
-  
-ggsave(width = 5, height = 3, "../../figures/experiment2/exp2_property_by_condition_means.pdf")
-

+
# Read the image file
+midpoint_creature = readPNG("../../figures/plot_additions/midpoint_creature.png")
+
+
+# Create a raster object from the image
+raster_midpoint_creature = rasterGrob(midpoint_creature, interpolate=TRUE)
+
+ggplot(data = df.exp2.long,
+       mapping = aes(x = property,
+                     y = response,
+                     group = condition,
+                     color = property,
+                     fill = property,
+                     shape = condition)) + 
+  geom_hline(yintercept = 4, linetype = "dashed") +
+  geom_point(position = position_jitterdodge(dodge.width = 0.5,
+                                             jitter.width = 0.15,
+                                             jitter.height = 0.1),
+             alpha = 0.2) + 
+  theme(legend.position = "none") +
+  stat_summary(fun.data = "mean_cl_boot",
+               position = position_dodge(width = 0.55),
+               color = "black",
+               size = .9) + 
+  scale_fill_brewer(palette = "Set1") + 
+  scale_color_brewer(palette = "Set1") + 
+  scale_y_continuous(breaks = 1:7) +
+  scale_shape_manual(values = c(21, 23)) + 
+  ggtitle("What is this creature?") +
+  xlab("Property type that \n\ differed") +
+  theme(plot.title = element_text(size=24, hjust = .5),  
+        legend.title = element_blank(),
+        legend.position = "bottom",
+        axis.title.x = element_blank(),
+        axis.text.x = element_text(size=16), 
+        axis.title.y = element_text(size=18),  
+        axis.text.y = element_text(size=14),  
+        legend.text = element_text(size=16)) + 
+  guides(fill = "none",
+         color = "none",
+         shape = guide_legend(override.aes = list(fill = "gray50"))) + 
+  coord_flip() +
+  annotation_custom(raster_midpoint_creature, xmin=4.35, xmax=5.3, ymin=-Inf, ymax=Inf) +
+  expand_limits(x = c(-Inf, 5.3)) +
+scale_y_continuous(breaks = 1:7,
+                   labels = c(
+    "1" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/left_creature.png' width='35' height='30'>",
+    "2" = "2",
+    "3" = "3",
+    "4" = "unsure",
+    "5" = "5",
+    "6" = "6",
+    "7" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/right_creature.png' width='35' height='30'>"
+  )) +
+  theme(axis.text.x = element_markdown())
+ 
+ggsave(width = 8, height = 5, "../../figures/experiment2/exp2_property_by_condition_means.pdf")
+

4.4.2 Plot of Actual Property Ratings vs Expected Property Ratings

@@ -1009,7 +1041,7 @@

4.4.3 Expected Property Selection scales = "free") ggsave(width = 10, height = 6, "../../figures/experiment2/exp2_expected_property_selections_for_property_type_ratings.pdf")

-

+

## Stats

@@ -1163,24 +1195,19 @@

4.5.3.1 Overall Property Means by jitter.width = 0.1, jitter.height = 0.0), alpha = 0.2) + - stat_summary(fun.data = "mean_cl_boot", - position = position_dodge(width = 0.5), - shape = 21, - color = "black", - size = .5) + - scale_fill_brewer(palette = "Set1") + - scale_color_brewer(palette = "Set1") + - # scale_y_continuous(breaks = 1:7) + - theme(plot.title = element_text(size=16, hjust = .5), - axis.text.x = element_blank(), - legend.title = element_blank(), - legend.position="bottom", - axis.title.x = element_blank(), - text = element_text(size = 18)) + - facet_wrap(~ model) - -ggsave(width = 8, height = 3, "../../figures/experiment2/bert_overall_property_means.pdf")

-

+ scale_fill_brewer(palette = "Set1") + + scale_color_brewer(palette = "Set1") + + # scale_y_continuous(breaks = 1:7) + + theme(plot.title = element_text(size=16, hjust = .5), + axis.text.x = element_blank(), + legend.title = element_blank(), + legend.position="bottom", + axis.title.x = element_blank(), + text = element_text(size = 18)) + + facet_wrap(~ model) + +ggsave(width = 8, height = 3, "../../figures/experiment2/bert_overall_probabilities.pdf") +

@@ -1272,29 +1299,50 @@

5.4.1 Property Means by Condition color = property, fill = property, shape = condition)) + - geom_point(position = position_jitterdodge(dodge.width = 0.5, - jitter.width = 0.1, - jitter.height = 0.0), - alpha = 0.05) + - theme(legend.position = "none") + - stat_summary(fun.data = "mean_cl_boot", - position = position_dodge(width = 0.5), - color = "black", - size = .5) + - scale_fill_brewer(palette = "Set1") + - scale_color_brewer(palette = "Set1") + - scale_y_continuous(breaks = 1:7) + - scale_shape_manual(values = c(21, 23)) + - theme(plot.title = element_text(size=16, hjust = .5), - legend.title = element_blank(), - legend.position = "bottom", - axis.title.x = element_blank()) + - guides(fill = "none", - color = "none", - shape = guide_legend(override.aes = list(fill = "gray50"))) - -ggsave(width = 5, height = 3, "../../figures/experiment3/exp3_property_by_condition_means.pdf") -

+ geom_hline(yintercept = 4, linetype = "dashed") + + geom_point(position = position_jitterdodge(dodge.width = 0.5, + jitter.width = 0.15, + jitter.height = 0.1), + alpha = 0.2) + + theme(legend.position = "none") + + stat_summary(fun.data = "mean_cl_boot", + position = position_dodge(width = 0.55), + color = "black", + size = .9) + + scale_fill_brewer(palette = "Set1") + + scale_color_brewer(palette = "Set1") + + scale_y_continuous(breaks = 1:7) + + scale_shape_manual(values = c(21, 23)) + + ggtitle("What is this creature?") + + xlab("Property type that \n\ differed") + + theme(plot.title = element_text(size=24, hjust = .5), + legend.title = element_blank(), + legend.position = "bottom", + axis.title.x = element_blank(), + axis.text.x = element_text(size=16), + axis.title.y = element_text(size=18), + axis.text.y = element_text(size=14), + legend.text = element_text(size=16)) + + guides(fill = "none", + color = "none", + shape = guide_legend(override.aes = list(fill = "gray50"))) + + coord_flip() + + annotation_custom(raster_midpoint_creature, xmin=4.35, xmax=5.3, ymin=-Inf, ymax=Inf) + + expand_limits(x = c(-Inf, 5.3)) + +scale_y_continuous(breaks = 1:7, + labels = c( + "1" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/left_creature.png' width='35' height='30'>", + "2" = "2", + "3" = "3", + "4" = "unsure", + "5" = "5", + "6" = "6", + "7" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/right_creature.png' width='35' height='30'>" + )) + + theme(axis.text.x = element_markdown()) + +ggsave(width = 8, height = 5, "../../figures/experiment3/exp3_property_by_condition_means.pdf") +

5.4.2 Plot of Actual Property Ratings vs Expected Property Ratings

@@ -1532,29 +1580,50 @@

6.4.1 Property Means by Condition color = property, fill = property, shape = condition)) + - geom_point(position = position_jitterdodge(dodge.width = 0.5, - jitter.width = 0.1, - jitter.height = 0.0), - alpha = 0.05) + - theme(legend.position = "none") + - stat_summary(fun.data = "mean_cl_boot", - position = position_dodge(width = 0.5), - color = "black", - size = .5) + - scale_fill_brewer(palette = "Set1") + - scale_color_brewer(palette = "Set1") + - scale_y_continuous(breaks = 1:7) + - scale_shape_manual(values = c(21, 23)) + - theme(plot.title = element_text(size=16, hjust = .5), - legend.title = element_blank(), - legend.position = "bottom", - axis.title.x = element_blank()) + - guides(fill = "none", - color = "none", - shape = guide_legend(override.aes = list(fill = "gray50"))) - -ggsave(width = 5, height = 3, "../../figures/experiment4/exp4_property_by_condition_means.pdf")

-

+ geom_hline(yintercept = 4, linetype = "dashed") + + geom_point(position = position_jitterdodge(dodge.width = 0.5, + jitter.width = 0.15, + jitter.height = 0.1), + alpha = 0.2) + + theme(legend.position = "none") + + stat_summary(fun.data = "mean_cl_boot", + position = position_dodge(width = 0.55), + color = "black", + size = .9) + + scale_fill_brewer(palette = "Set1") + + scale_color_brewer(palette = "Set1") + + scale_y_continuous(breaks = 1:7) + + scale_shape_manual(values = c(21, 23)) + + ggtitle("What is this creature?") + + xlab("Property type that \n\ differed") + + theme(plot.title = element_text(size=24, hjust = .5), + legend.title = element_blank(), + legend.position = "bottom", + axis.title.x = element_blank(), + axis.text.x = element_text(size=16), + axis.title.y = element_text(size=18), + axis.text.y = element_text(size=14), + legend.text = element_text(size=16)) + + guides(fill = "none", + color = "none", + shape = guide_legend(override.aes = list(fill = "gray50"))) + + coord_flip() + + annotation_custom(raster_midpoint_creature, xmin=4.35, xmax=5.3, ymin=-Inf, ymax=Inf) + + expand_limits(x = c(-Inf, 5.3)) + +scale_y_continuous(breaks = 1:7, + labels = c( + "1" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/left_creature.png' width='35' height='30'>", + "2" = "2", + "3" = "3", + "4" = "unsure", + "5" = "5", + "6" = "6", + "7" = "definitely<br><img src='https://raw.githubusercontent.com/cicl-stanford/teleological_properties/master/figures/plot_additions/right_creature.png' width='35' height='30'>" + )) + + theme(axis.text.x = element_markdown()) + +ggsave(width = 8, height = 5, "../../figures/experiment4/exp4_property_by_condition_means.pdf") +

6.4.2 Plot of Actual Property Ratings vs Expected Property Ratings

@@ -1770,48 +1839,50 @@

7 Session info

#> tzcode source: internal #> #> attached base packages: -#> [1] stats graphics grDevices utils datasets methods base +#> [1] grid stats graphics grDevices utils datasets methods +#> [8] base #> #> other attached packages: #> [1] lubridate_1.9.3 forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4 #> [5] purrr_1.0.2 readr_2.1.5 tidyr_1.3.1 tibble_3.2.1 -#> [9] ggplot2_3.5.0 tidyverse_2.0.0 brms_2.21.0 Rcpp_1.0.12 +#> [9] ggplot2_3.5.1 tidyverse_2.0.0 brms_2.21.0 Rcpp_1.0.12 #> [13] tidyjson_0.3.2 RSQLite_2.3.6 knitr_1.45 emmeans_1.10.1 -#> [17] xtable_1.8-4 +#> [17] ggtext_0.1.2 png_0.1-8 xtable_1.8-4 #> #> loaded via a namespace (and not attached): -#> [1] DBI_1.2.2 gridExtra_2.3 inline_0.3.19 -#> [4] rlang_1.1.3 magrittr_2.0.3 matrixStats_1.2.0 -#> [7] compiler_4.3.3 loo_2.7.0 systemfonts_1.0.6 -#> [10] vctrs_0.6.5 reshape2_1.4.4 pkgconfig_2.0.3 -#> [13] crayon_1.5.2 fastmap_1.1.1 backports_1.4.1 -#> [16] labeling_0.4.3 utf8_1.2.4 rmarkdown_2.26 -#> [19] tzdb_0.4.0 ragg_1.3.0 bit_4.0.5 -#> [22] xfun_0.43 cachem_1.0.8 jsonlite_1.8.8 -#> [25] blob_1.2.4 highr_0.10 parallel_4.3.3 -#> [28] cluster_2.1.6 R6_2.5.1 bslib_0.7.0 -#> [31] stringi_1.8.3 RColorBrewer_1.1-3 StanHeaders_2.32.6 -#> [34] rpart_4.1.23 jquerylib_0.1.4 estimability_1.5 -#> [37] bookdown_0.38 assertthat_0.2.1 rstan_2.32.6 -#> [40] base64enc_0.1-3 bayesplot_1.11.1 Matrix_1.6-5 -#> [43] nnet_7.3-19 timechange_0.3.0 tidyselect_1.2.1 -#> [46] rstudioapi_0.16.0 abind_1.4-5 yaml_2.3.8 -#> [49] codetools_0.2-19 pkgbuild_1.4.4 lattice_0.22-5 -#> [52] plyr_1.8.9 withr_3.0.0 bridgesampling_1.1-2 -#> [55] posterior_1.5.0 coda_0.19-4.1 evaluate_0.23 -#> [58] foreign_0.8-86 RcppParallel_5.1.7 pillar_1.9.0 -#> [61] tensorA_0.36.2.1 checkmate_2.3.1 stats4_4.3.3 -#> [64] distributional_0.4.0 generics_0.1.3 vroom_1.6.5 -#> [67] hms_1.1.3 rstantools_2.4.0 munsell_0.5.1 -#> [70] scales_1.3.0 glue_1.7.0 Hmisc_5.1-2 -#> [73] tools_4.3.3 data.table_1.15.4 mvtnorm_1.2-4 -#> [76] grid_4.3.3 QuickJSR_1.1.3 colorspace_2.1-0 -#> [79] nlme_3.1-164 htmlTable_2.4.2 Formula_1.2-5 -#> [82] cli_3.6.2 textshaping_0.3.7 fansi_1.0.6 -#> [85] Brobdingnag_1.2-9 gtable_0.3.4 sass_0.4.9 -#> [88] digest_0.6.35 htmlwidgets_1.6.4 farver_2.1.1 -#> [91] memoise_2.0.1 htmltools_0.5.8.1 lifecycle_1.0.4 -#> [94] bit64_4.0.5 +#> [1] DBI_1.2.2 gridExtra_2.3 remotes_2.5.0 +#> [4] inline_0.3.19 rlang_1.1.3 magrittr_2.0.3 +#> [7] matrixStats_1.2.0 compiler_4.3.3 loo_2.7.0 +#> [10] reshape2_1.4.4 systemfonts_1.0.6 vctrs_0.6.5 +#> [13] pkgconfig_2.0.3 crayon_1.5.2 fastmap_1.1.1 +#> [16] backports_1.4.1 labeling_0.4.3 utf8_1.2.4 +#> [19] rmarkdown_2.26 markdown_1.12 tzdb_0.4.0 +#> [22] ragg_1.3.0 bit_4.0.5 xfun_0.43 +#> [25] cachem_1.0.8 jsonlite_1.8.8 blob_1.2.4 +#> [28] highr_0.10 cluster_2.1.6 parallel_4.3.3 +#> [31] R6_2.5.1 bslib_0.7.0 stringi_1.8.4 +#> [34] RColorBrewer_1.1-3 StanHeaders_2.32.6 rpart_4.1.23 +#> [37] jquerylib_0.1.4 estimability_1.5 bookdown_0.38 +#> [40] assertthat_0.2.1 rstan_2.32.6 base64enc_0.1-3 +#> [43] bayesplot_1.11.1 nnet_7.3-19 Matrix_1.6-5 +#> [46] timechange_0.3.0 tidyselect_1.2.1 rstudioapi_0.16.0 +#> [49] abind_1.4-5 yaml_2.3.8 codetools_0.2-19 +#> [52] curl_5.2.1 pkgbuild_1.4.4 plyr_1.8.9 +#> [55] lattice_0.22-5 withr_3.0.0 bridgesampling_1.1-2 +#> [58] posterior_1.5.0 coda_0.19-4.1 evaluate_0.23 +#> [61] foreign_0.8-86 RcppParallel_5.1.7 xml2_1.3.6 +#> [64] pillar_1.9.0 tensorA_0.36.2.1 checkmate_2.3.1 +#> [67] stats4_4.3.3 distributional_0.4.0 generics_0.1.3 +#> [70] vroom_1.6.5 hms_1.1.3 commonmark_1.9.1 +#> [73] rstantools_2.4.0 munsell_0.5.1 scales_1.3.0 +#> [76] glue_1.7.0 Hmisc_5.1-2 tools_4.3.3 +#> [79] data.table_1.15.4 mvtnorm_1.2-4 QuickJSR_1.1.3 +#> [82] colorspace_2.1-0 nlme_3.1-164 htmlTable_2.4.2 +#> [85] Formula_1.2-5 cli_3.6.2 textshaping_0.3.7 +#> [88] fansi_1.0.6 Brobdingnag_1.2-9 gtable_0.3.5 +#> [91] sass_0.4.9 digest_0.6.35 htmlwidgets_1.6.4 +#> [94] farver_2.1.2 memoise_2.0.1 htmltools_0.5.8.1 +#> [97] lifecycle_1.0.4 gridtext_0.1.5 bit64_4.0.5
diff --git a/figures/experiment1/exp1_top_stacked.pdf b/figures/experiment1/exp1_top_stacked.pdf index d6e2a4f..37c74e4 100644 Binary files a/figures/experiment1/exp1_top_stacked.pdf and b/figures/experiment1/exp1_top_stacked.pdf differ diff --git a/figures/experiment2/bert_overall_probabilities.pdf b/figures/experiment2/bert_overall_probabilities.pdf new file mode 100644 index 0000000..740cbe3 Binary files /dev/null and b/figures/experiment2/bert_overall_probabilities.pdf differ diff --git a/figures/experiment2/bert_overall_property_means.pdf b/figures/experiment2/bert_overall_property_means.pdf deleted file mode 100644 index ba7be6e..0000000 Binary files a/figures/experiment2/bert_overall_property_means.pdf and /dev/null differ diff --git a/figures/experiment2/exp2_expected_property_selections_for_property_type_ratings.pdf b/figures/experiment2/exp2_expected_property_selections_for_property_type_ratings.pdf index 27d4973..b26d970 100644 Binary files a/figures/experiment2/exp2_expected_property_selections_for_property_type_ratings.pdf and b/figures/experiment2/exp2_expected_property_selections_for_property_type_ratings.pdf differ diff --git a/figures/experiment2/exp2_heat_map.pdf b/figures/experiment2/exp2_heat_map.pdf index 7a89d9a..f2f545c 100644 Binary files a/figures/experiment2/exp2_heat_map.pdf and b/figures/experiment2/exp2_heat_map.pdf differ diff --git a/figures/experiment2/exp2_property_by_condition_means.pdf b/figures/experiment2/exp2_property_by_condition_means.pdf index 5f85b3b..c26386b 100644 Binary files a/figures/experiment2/exp2_property_by_condition_means.pdf and b/figures/experiment2/exp2_property_by_condition_means.pdf differ diff --git a/figures/experiment3/exp3_heat_map.pdf b/figures/experiment3/exp3_heat_map.pdf index 2bffc62..bd03e86 100644 Binary files a/figures/experiment3/exp3_heat_map.pdf and b/figures/experiment3/exp3_heat_map.pdf differ diff --git a/figures/experiment3/exp3_property_by_condition_means.pdf b/figures/experiment3/exp3_property_by_condition_means.pdf index 5091e0a..a9dba53 100644 Binary files a/figures/experiment3/exp3_property_by_condition_means.pdf and b/figures/experiment3/exp3_property_by_condition_means.pdf differ diff --git a/figures/experiment4/exp4_heat_map.pdf b/figures/experiment4/exp4_heat_map.pdf index 51e7801..eaa741b 100644 Binary files a/figures/experiment4/exp4_heat_map.pdf and b/figures/experiment4/exp4_heat_map.pdf differ diff --git a/figures/experiment4/exp4_property_by_condition_means.pdf b/figures/experiment4/exp4_property_by_condition_means.pdf index a05ee5b..78216c6 100644 Binary files a/figures/experiment4/exp4_property_by_condition_means.pdf and b/figures/experiment4/exp4_property_by_condition_means.pdf differ