{"id":22966652,"url":"https://github.com/favstats/eqp_paper","last_synced_at":"2026-02-04T00:01:29.075Z","repository":{"id":108349951,"uuid":"137351229","full_name":"favstats/eqp_paper","owner":"favstats","description":"Seminar Paper in Political Framing","archived":false,"fork":false,"pushed_at":"2019-06-22T14:54:31.000Z","size":25541,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T22:05:20.093Z","etag":null,"topics":["ethical","moral","paper","psychology","trolley"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/favstats.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-14T11:48:14.000Z","updated_at":"2019-06-22T14:54:35.000Z","dependencies_parsed_at":"2023-05-21T23:15:19.471Z","dependency_job_id":null,"html_url":"https://github.com/favstats/eqp_paper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/favstats/eqp_paper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Feqp_paper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Feqp_paper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Feqp_paper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Feqp_paper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/favstats","download_url":"https://codeload.github.com/favstats/eqp_paper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/favstats%2Feqp_paper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29062481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T23:14:54.203Z","status":"ssl_error","status_checked_at":"2026-02-03T23:14:50.873Z","response_time":96,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethical","moral","paper","psychology","trolley"],"created_at":"2024-12-14T20:44:56.967Z","updated_at":"2026-02-04T00:01:29.032Z","avatar_url":"https://github.com/favstats.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\nTrolley Experiment\n================\nFabio Votta\nThe Date\n\n## packages\n\n``` r\npacman::p_load(tidyverse, haven, psych, sjPlot, ggpubr, glue)\n```\n\n## data\n\n``` r\ntrolley \u003c- read_spss(\"data/TrolleyExperimentArgumentNew.sav\") %\u003e% \n  janitor::clean_names(.) %\u003e% \n  filter(general_finisher == 1) %\u003e% \n  drop_na(t1_eqp_eqp1, t1_eqp_eqp3, t1_eqp_eqp7, t1_eqp_eqp8, t1_eqp_eqp9,\n         t1_eqp_eqp11, t1_eqp_eqp12 ,t1_eqp_eqp13, t1_eqp_eqp14, t1_eqp_eqp18,\n         t1_eqp_eqp2, t1_eqp_eqp4, t1_eqp_eqp5, t1_eqp_eqp6, t1_eqp_eqp10,\n         t1_eqp_eqp15, t1_eqp_eqp16 ,t1_eqp_eqp17, t1_eqp_eqp19, t1_eqp_eqp20,\n         t1_szenario1q2, t2_szenario1q2, t1_szenario2q2, t2_szenario2q2) %\u003e% \n  filter(t2_gender != 2) %\u003e% \n  mutate(gender = ifelse(t2_gender == 1, \"Men\", \"Women\")) %\u003e% \n  mutate(leftright = t2_pol_alignment) %\u003e% \n  mutate(pol_interest = 5 - t2_pol_interest) %\u003e% \n  mutate(church_attendance = 7 - t2_religion_church) %\u003e% \n  mutate(age = 2018 - as.numeric(t2_year_of_birth)) %\u003e% \n  mutate(university = ifelse(t2_university == 4, 0, 1)) %\u003e% \n  mutate(groups = case_when(\n    general_group_control == 1 ~ \"Control Group\",\n    general_group_discussion == 1 ~ \"Discussion Group\",\n    general_group_information == 1 ~ \"Information Group\",\n  )) \n\n```\n\n## Basic Stats\n\n``` r\ntrolley %\u003e% \n  group_by(university) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| university |   n |\n| ---------: | --: |\n|          0 |  15 |\n|          1 | 275 |\n\n``` r\ntrolley %\u003e% \n  group_by(gender) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| gender |   n |\n| :----- | --: |\n| Men    | 157 |\n| Women  | 133 |\n\n``` r\ntrolley %\u003e% \n  group_by(groups) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| groups            |  n |\n| :---------------- | -: |\n| Control Group     | 92 |\n| Discussion Group  | 99 |\n| Information Group | 99 |\n\n``` r\ntrolley %\u003e% \n  select(leftright, pol_interest, church_attendance, age) %\u003e% \n  describe() %\u003e% knitr::kable()\n```\n\n|                    | vars |   n |      mean |        sd | median |   trimmed |    mad | min | max | range |        skew |    kurtosis |        se |\n| ------------------ | ---: | --: | --------: | --------: | -----: | --------: | -----: | --: | --: | ----: | ----------: | ----------: | --------: |\n| leftright          |    1 | 278 |  4.730216 | 1.8701205 |      5 |  4.709821 | 1.4826 |   1 |  10 |     9 |   0.1718862 | \\-0.3668182 | 0.1121624 |\n| pol\\_interest      |    2 | 288 |  3.232639 | 0.7019465 |      3 |  3.293103 | 1.4826 |   1 |   4 |     3 | \\-0.4148235 | \\-0.7018793 | 0.0413626 |\n| church\\_attendance |    3 | 278 |  1.866907 | 1.0442822 |      2 |  1.700893 | 1.4826 |   1 |   6 |     5 |   1.3843362 |   2.0577066 | 0.0626319 |\n| age                |    4 | 289 | 24.089965 | 3.8584597 |     23 | 23.643777 | 2.9652 |  18 |  53 |    35 |   2.1419261 |  10.5203843 | 0.2269682 |\n\n## Factor Analysis\n\n``` r\neqp \u003c- trolley %\u003e% \n  select(contains(\"eqp\")) %\u003e% \n#  na.omit() %\u003e% \n  select(t1_eqp_eqp1, t1_eqp_eqp3, t1_eqp_eqp7, t1_eqp_eqp8, t1_eqp_eqp9,\n         t1_eqp_eqp11, t1_eqp_eqp12 ,t1_eqp_eqp13, t1_eqp_eqp14, t1_eqp_eqp18,\n         t1_eqp_eqp2, t1_eqp_eqp4, t1_eqp_eqp5, t1_eqp_eqp6, t1_eqp_eqp10,\n         t1_eqp_eqp15, t1_eqp_eqp16 ,t1_eqp_eqp17, t1_eqp_eqp19, t1_eqp_eqp20)\n\ntrolley$mean_eqp \u003c- rowMeans(eqp)\n\ntrolley \u003c- eqp %\u003e% \n  psych::pca(2, rotate = \"varimax\") %\u003e% \n  predict.psych(data = eqp) %\u003e% \n  cbind(trolley, .)\n  \ntrolley \u003c- trolley %\u003e% \n  rename(idealism_pca = RC1) %\u003e% \n  rename(relativism_pca = RC2)   \n```\n\n## Randomisierung/Descriptives\n\n### Age\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nage_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, age)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Age\") +\n  ggtitle(\"Age Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nage_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-5-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(age_compare, width = 10, height = 6)\n```\n\n### Gender\n\n``` r\ngender_compare \u003c- sjp.xtab(trolley$groups, trolley$gender, \n         margin = \"row\", bar.pos = \"stack\",\n         show.summary = TRUE, coord.flip = TRUE, \n         prnt.plot = F)$plot +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_gdocs(\"Gender\") +\n  xlab(\"\") +\n  ggtitle(\"Gender Comparison between Experimental Groups\") +\n  scale_alpha(range = c(0.4, 0.8))\n\ngender_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-6-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_compare, width = 10, height = 6)\n```\n\n#### Together\n\n``` r\ndem_compare \u003c- cowplot::plot_grid(age_compare, gender_compare)\n\ndem_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-7-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(dem_compare, width = 14, height = 6)\n```\n\n### Idealism\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nidealism_pca_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, idealism_pca)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Idealism\") +\n  ggtitle(\"Idealism Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nidealism_pca_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-8-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(idealism_pca_compare, width = 10, height = 6)\n```\n\n### Relativism\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nrelativism_pca_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, relativism_pca)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Relativism\") +\n  ggtitle(\"Relativism Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nrelativism_pca_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-9-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(relativism_pca_compare, width = 10, height = 6)\n```\n\n#### Together\n\n``` r\nuv_compare \u003c- cowplot::plot_grid(relativism_pca_compare, idealism_pca_compare)\n\nuv_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-10-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(uv_compare, width = 12, height = 6)\n```\n\n### AVs\n\n#### Switch Track\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nt1_szenario1q2_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, t1_szenario1q2)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"'Switch Track' Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-11-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_compare, width = 10, height = 6)\n```\n\n#### Push Person\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nt1_szenario2q2_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, t1_szenario2q2)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"'Push Person' Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-12-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_compare, width = 10, height = 6)\n```\n\n##### Together\n\n``` r\nav_compare \u003c- cowplot::plot_grid(t1_szenario1q2_compare, t1_szenario2q2_compare)\n\nav_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-13-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(av_compare, width = 12, height = 6)\n```\n\n### Demographics\n\n``` r\nt1_szenario1q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(gender, t1_szenario1q2)) +\n  geom_violin(aes(fill = gender), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Gender\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"Morally Justifiable to Switch Track by Gender\") +\n  ggpubr::stat_compare_means(label.x.npc = .4) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_gender, width = 10, height = 6)\n\nt1_szenario2q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(gender, t1_szenario2q2)) +\n  geom_violin(aes(fill = gender), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Gender\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"Morally Justifiable to Push Person by Gender\") +\n  ggpubr::stat_compare_means(label.x.npc = .5) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-2.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_gender, width = 10, height = 6)\n\ngender_av_compare1 \u003c- cowplot::plot_grid(t1_szenario1q2_gender, t1_szenario2q2_gender)\n\ngender_av_compare1\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-3.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_av_compare1, width = 12, height = 6)\n```\n\n#### Scatters\n\n``` r\nt1_szenario1q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(age, t1_szenario1q2)) +\n  geom_jitter(aes(color = gender), alpha = 0.6) +\n  geom_smooth(aes(color = gender),method = \"lm\") +\n  xlab(\"Age\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"Morally Justifiable to Switch Track by Gender and Age\") +\n  ggpubr::stat_compare_means(label.x.npc = .4) +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_gender, width = 10, height = 6)\n\nt1_szenario2q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(age, t1_szenario2q2)) +\n  geom_jitter(aes(color = gender), alpha = 0.6) +\n  geom_smooth(aes(color = gender),method = \"lm\") +\n  xlab(\"Age\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"Morally Justifiable to Push Person by Gender and Age\") +\n  ggpubr::stat_compare_means(label.x.npc = .5) +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-2.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_gender, width = 10, height = 6)\n\ngender_av_compare2 \u003c- cowplot::plot_grid(t1_szenario1q2_gender, t1_szenario2q2_gender)\n\ngender_av_compare2\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-3.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_av_compare2, width = 12, height = 6)\n```\n\n## Factor Analysis Table\n\n``` r\n# eqp %\u003e% psych::alpha()\n#   psych::pca(2, rotate = \"varimax\") %\u003e% \n#   .$loadings %\u003e% unclass() %\u003e% as.data.frame() %\u003e% \n#   rownames_to_column(\"eqp_variable\")\n\nstrip_away_stuff \u003c- function(x) {\nx \u003c- str_remove(x, \"t1_eqp_\")\nx \u003c- parse_number(x) %\u003e% \n  ifelse(. %in% 1:9, paste0(\"eqp0\", .), .) %\u003e% \n  ifelse(. %in% 10:20, paste0(\"eqp\", .), .) \n}\n\neqp \u003c- eqp %\u003e% \n  set_names(eqp %\u003e% names %\u003e% strip_away_stuff) \n\nfactor_names \u003c- c(`1` = \"Idealism\",\n                  `2` = \"Relativism\")\n\n\nfactor_analysis \u003c- sjp.pca(eqp, rotation = \"varimax\", \n        nmbr.fctr = 2, prnt.plot = F, show.cronb = T, \n        show.values = T)$plot  +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  ggtitle(\"Ethical Positions Questionnaire - PCA\") +\n  facet_grid(~xpos, labeller = as_labeller(factor_names)) +\n  labs(captions = \"Cronbach's Alpha = 0.80\")\n\nfactor_analysis\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-16-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(factor_analysis, width = 10, height = 6)\n```\n\n## Summary Statistics\n\n``` r\nsave(trolley, file = \"text/data/trolley.Rdata\")\n\ntrolley %\u003e% \n  select(t1_szenario1q2, t2_szenario1q2, t1_szenario2q2, t2_szenario2q2, idealism_pca, relativism_pca, gender, age, church_attendance, general_group_control, general_group_discussion, general_group_information) %\u003e% \n  describe() %\u003e% \n  select(-vars, -trimmed, -mad, -se) %\u003e% \n  knitr::kable()\n```\n\n|                             |   n |       mean |        sd |     median |        min |       max |     range |        skew |    kurtosis |\n| --------------------------- | --: | ---------: | --------: | ---------: | ---------: | --------: | --------: | ----------: | ----------: |\n| t1\\_szenario1q2             | 290 |  5.7551724 | 2.9113887 |  6.0000000 |   1.000000 | 11.000000 | 10.000000 | \\-0.0312365 | \\-0.9024947 |\n| t2\\_szenario1q2             | 290 |  5.5586207 | 2.9136972 |  6.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.0144578 | \\-0.9380239 |\n| t1\\_szenario2q2             | 290 |  4.2931034 | 2.8321475 |  4.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.5494000 | \\-0.7245725 |\n| t2\\_szenario2q2             | 290 |  4.1827586 | 2.8644787 |  4.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.5966912 | \\-0.6429501 |\n| idealism\\_pca               | 290 |  0.0000000 | 1.0000000 |  0.1817619 | \\-3.400484 |  1.733352 |  5.133836 | \\-0.8568363 |   0.3662967 |\n| relativism\\_pca             | 290 |  0.0000000 | 1.0000000 |  0.1126772 | \\-3.209701 |  2.336790 |  5.546491 | \\-0.3456592 |   0.0152953 |\n| gender\\*                    | 290 |        NaN |        NA |         NA |        Inf |     \\-Inf |     \\-Inf |          NA |          NA |\n| age                         | 289 | 24.0899654 | 3.8584597 | 23.0000000 |  18.000000 | 53.000000 | 35.000000 |   2.1419261 |  10.5203843 |\n| church\\_attendance          | 278 |  1.8669065 | 1.0442822 |  2.0000000 |   1.000000 |  6.000000 |  5.000000 |   1.3843362 |   2.0577066 |\n| general\\_group\\_control     | 290 |  0.3172414 | 0.4662068 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.7813203 | \\-1.3943109 |\n| general\\_group\\_discussion  | 290 |  0.3413793 | 0.4749921 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.6655847 | \\-1.5623488 |\n| general\\_group\\_information | 290 |  0.3413793 | 0.4749921 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.6655847 | \\-1.5623488 |\n\n## Models\n\n``` r\ntrolley %\u003c\u003e% \n  mutate(groups = factor(groups)) %\u003e% \n  mutate(gender = factor(gender)) \n```\n\n1.  t1 als AV\n2.  t1 als AV und gender interaction (Idealism)\n3.  t1 als AV und gender interaction (Relativism)\n4.  t2 mit Controls für t1 und für treatments\n5.  Modelle aus 4. mit Treatment-Interaktion (Idealism)\n6.  Modelle aus 4. mit Treatment-Interaktion (Relativism)\n\n\u003c!-- end list --\u003e\n\n1.  Szenario 1 (a = Switch Track)\n2.  Szenario 2b (b = Push\nPerson)\n\n### Model 1a - Switch Track\n\n### Model 1b - Push Person\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg1_s1, reg1_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-21-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg1_combined.png\", width = 8, height = 9)\n```\n\n### Model 2a - Switch Track - Idealism X Gender\n\n### Model 2b - Push Person - Idealism X Gender\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg2_s1_int_idealism, reg2_s2_int_idealism, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-24-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg2_c1_idealism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit2_s1_int_idealism, type = \"pred\",\n               terms = c(\"idealism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 2a - Switch Track\"),  \n  get_model_data(fit2_s2_int_idealism, type = \"pred\",\n               terms = c(\"idealism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 2b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 2 - Idealism X Gender\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Gender\") +\n  ggthemes::scale_color_fivethirtyeight(\"Gender\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Idealism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-25-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg2_c2_idealism.png\", width = 8, height = 5)\n```\n\n### Model 3a - Switch Track - Relativism X Gender\n\n### Model 3b - Push Person- Relativism X Gender\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg3_s1_int_relativism, reg3_s2_int_relativism, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-28-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg3_c1_relativism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit3_s1_int_relativism, type = \"pred\",\n               terms = c(\"relativism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 3a - Switch Track\"),  \n  get_model_data(fit3_s2_int_relativism, type = \"pred\",\n               terms = c(\"relativism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 3b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 3 - Relativism X Gender\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Gender\") +\n  ggthemes::scale_color_fivethirtyeight(\"Gender\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Relativism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-29-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg3_c2_relativism.png\", width = 8, height = 5)\n```\n\n### Model 4a - Switch Track\n\n### Model 4b - Push Person\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg4_s1, reg4_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-32-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg4_combined.png\", width = 8, height = 9)\n```\n\n### Model 5a - Switch Track - Idealism\n\n### Model 5b - Push Person - Idealism\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg5_s1, reg5_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-35-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg5_c1_idealism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit5_s1, type = \"pred\",\n               terms = c(\"idealism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 5a - Switch Track\"),  \n  get_model_data(fit5_s2, type = \"pred\",\n               terms = c(\"idealism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 5b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 5 - Idealism X Experimental Groups\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Experimental Groups\") +\n  ggthemes::scale_color_fivethirtyeight(\"Experimental Groups\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Idealism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-36-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg5_c2_idealism.png\", width = 8, height = 5)\n```\n\n### Model 6a - Switch Track - Relativism\n\n### Model 6b - Push Person - Relativism\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg6_s1, reg6_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-39-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg6_c1_relativism.png\", width = 7, height = 8)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit6_s1, type = \"pred\",\n               terms = c(\"relativism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 6a - Switch Track\"),  \n  get_model_data(fit6_s2, type = \"pred\",\n               terms = c(\"relativism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 6b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 6 - Relativism X Experimental Groups\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Experimental Groups\") +\n  ggthemes::scale_color_fivethirtyeight(\"Experimental Groups\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Relativism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-40-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg6_c2_relativism.png\", width = 8, height = 5)\n```\n=======\nTrolley Experiment\n================\nFabio Votta\nThe Date\n\n## packages\n\n``` r\npacman::p_load(tidyverse, haven, psych, sjPlot, ggpubr, glue)\n```\n\n## data\n\n``` r\ntrolley \u003c- read_spss(\"data/TrolleyExperimentArgumentNew.sav\") %\u003e% \n  janitor::clean_names(.) %\u003e% \n  filter(general_finisher == 1) %\u003e% \n  drop_na(t1_eqp_eqp1, t1_eqp_eqp3, t1_eqp_eqp7, t1_eqp_eqp8, t1_eqp_eqp9,\n         t1_eqp_eqp11, t1_eqp_eqp12 ,t1_eqp_eqp13, t1_eqp_eqp14, t1_eqp_eqp18,\n         t1_eqp_eqp2, t1_eqp_eqp4, t1_eqp_eqp5, t1_eqp_eqp6, t1_eqp_eqp10,\n         t1_eqp_eqp15, t1_eqp_eqp16 ,t1_eqp_eqp17, t1_eqp_eqp19, t1_eqp_eqp20,\n         t1_szenario1q2, t2_szenario1q2, t1_szenario2q2, t2_szenario2q2) %\u003e% \n  filter(t2_gender != 2) %\u003e% \n  mutate(gender = ifelse(t2_gender == 1, \"Men\", \"Women\")) %\u003e% \n  mutate(leftright = t2_pol_alignment) %\u003e% \n  mutate(pol_interest = 5 - t2_pol_interest) %\u003e% \n  mutate(church_attendance = 7 - t2_religion_church) %\u003e% \n  mutate(age = 2018 - as.numeric(t2_year_of_birth)) %\u003e% \n  mutate(university = ifelse(t2_university == 4, 0, 1)) %\u003e% \n  mutate(groups = case_when(\n    general_group_control == 1 ~ \"Control Group\",\n    general_group_discussion == 1 ~ \"Discussion Group\",\n    general_group_information == 1 ~ \"Information Group\",\n  )) \n\n```\n\n## Basic Stats\n\n``` r\ntrolley %\u003e% \n  group_by(university) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| university |   n |\n| ---------: | --: |\n|          0 |  15 |\n|          1 | 275 |\n\n``` r\ntrolley %\u003e% \n  group_by(gender) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| gender |   n |\n| :----- | --: |\n| Men    | 157 |\n| Women  | 133 |\n\n``` r\ntrolley %\u003e% \n  group_by(groups) %\u003e% \n  tally() %\u003e% knitr::kable()\n```\n\n| groups            |  n |\n| :---------------- | -: |\n| Control Group     | 92 |\n| Discussion Group  | 99 |\n| Information Group | 99 |\n\n``` r\ntrolley %\u003e% \n  select(leftright, pol_interest, church_attendance, age) %\u003e% \n  describe() %\u003e% knitr::kable()\n```\n\n|                    | vars |   n |      mean |        sd | median |   trimmed |    mad | min | max | range |        skew |    kurtosis |        se |\n| ------------------ | ---: | --: | --------: | --------: | -----: | --------: | -----: | --: | --: | ----: | ----------: | ----------: | --------: |\n| leftright          |    1 | 278 |  4.730216 | 1.8701205 |      5 |  4.709821 | 1.4826 |   1 |  10 |     9 |   0.1718862 | \\-0.3668182 | 0.1121624 |\n| pol\\_interest      |    2 | 288 |  3.232639 | 0.7019465 |      3 |  3.293103 | 1.4826 |   1 |   4 |     3 | \\-0.4148235 | \\-0.7018793 | 0.0413626 |\n| church\\_attendance |    3 | 278 |  1.866907 | 1.0442822 |      2 |  1.700893 | 1.4826 |   1 |   6 |     5 |   1.3843362 |   2.0577066 | 0.0626319 |\n| age                |    4 | 289 | 24.089965 | 3.8584597 |     23 | 23.643777 | 2.9652 |  18 |  53 |    35 |   2.1419261 |  10.5203843 | 0.2269682 |\n\n## Factor Analysis\n\n``` r\neqp \u003c- trolley %\u003e% \n  select(contains(\"eqp\")) %\u003e% \n#  na.omit() %\u003e% \n  select(t1_eqp_eqp1, t1_eqp_eqp3, t1_eqp_eqp7, t1_eqp_eqp8, t1_eqp_eqp9,\n         t1_eqp_eqp11, t1_eqp_eqp12 ,t1_eqp_eqp13, t1_eqp_eqp14, t1_eqp_eqp18,\n         t1_eqp_eqp2, t1_eqp_eqp4, t1_eqp_eqp5, t1_eqp_eqp6, t1_eqp_eqp10,\n         t1_eqp_eqp15, t1_eqp_eqp16 ,t1_eqp_eqp17, t1_eqp_eqp19, t1_eqp_eqp20)\n\ntrolley$mean_eqp \u003c- rowMeans(eqp)\n\ntrolley \u003c- eqp %\u003e% \n  psych::pca(2, rotate = \"varimax\") %\u003e% \n  predict.psych(data = eqp) %\u003e% \n  cbind(trolley, .)\n  \ntrolley \u003c- trolley %\u003e% \n  rename(idealism_pca = RC1) %\u003e% \n  rename(relativism_pca = RC2)   \n```\n\n## Randomisierung/Descriptives\n\n### Age\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nage_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, age)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Age\") +\n  ggtitle(\"Age Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nage_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-5-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(age_compare, width = 10, height = 6)\n```\n\n### Gender\n\n``` r\ngender_compare \u003c- sjp.xtab(trolley$groups, trolley$gender, \n         margin = \"row\", bar.pos = \"stack\",\n         show.summary = TRUE, coord.flip = TRUE, \n         prnt.plot = F)$plot +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_gdocs(\"Gender\") +\n  xlab(\"\") +\n  ggtitle(\"Gender Comparison between Experimental Groups\") +\n  scale_alpha(range = c(0.4, 0.8))\n\ngender_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-6-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_compare, width = 10, height = 6)\n```\n\n#### Together\n\n``` r\ndem_compare \u003c- cowplot::plot_grid(age_compare, gender_compare)\n\ndem_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-7-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(dem_compare, width = 14, height = 6)\n```\n\n### Idealism\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nidealism_pca_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, idealism_pca)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Idealism\") +\n  ggtitle(\"Idealism Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nidealism_pca_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-8-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(idealism_pca_compare, width = 10, height = 6)\n```\n\n### Relativism\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nrelativism_pca_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, relativism_pca)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Relativism\") +\n  ggtitle(\"Relativism Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nrelativism_pca_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-9-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(relativism_pca_compare, width = 10, height = 6)\n```\n\n#### Together\n\n``` r\nuv_compare \u003c- cowplot::plot_grid(relativism_pca_compare, idealism_pca_compare)\n\nuv_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-10-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(uv_compare, width = 12, height = 6)\n```\n\n### AVs\n\n#### Switch Track\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nt1_szenario1q2_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, t1_szenario1q2)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"'Switch Track' Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-11-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_compare, width = 10, height = 6)\n```\n\n#### Push Person\n\n``` r\nmy_comparisons \u003c- list( c(\"Control Group\", \"Discussion Group\"), \n                        c(\"Discussion Group\", \"Information Group\"), \n                        c(\"Control Group\", \"Information Group\") )\n\nt1_szenario2q2_compare \u003c- trolley %\u003e% \n  ggplot(aes(groups, t1_szenario2q2)) +\n  geom_violin(aes(fill = groups), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Experimental Groups\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"'Push Person' Comparison between Experimental Groups\") +\n  ggpubr::stat_compare_means(comparisons = my_comparisons) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-12-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_compare, width = 10, height = 6)\n```\n\n##### Together\n\n``` r\nav_compare \u003c- cowplot::plot_grid(t1_szenario1q2_compare, t1_szenario2q2_compare)\n\nav_compare\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-13-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(av_compare, width = 12, height = 6)\n```\n\n### Demographics\n\n``` r\nt1_szenario1q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(gender, t1_szenario1q2)) +\n  geom_violin(aes(fill = gender), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Gender\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"Morally Justifiable to Switch Track by Gender\") +\n  ggpubr::stat_compare_means(label.x.npc = .4) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_gender, width = 10, height = 6)\n\nt1_szenario2q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(gender, t1_szenario2q2)) +\n  geom_violin(aes(fill = gender), alpha = 0.6) +\n  geom_boxplot(width = 0.2) +\n  xlab(\"Gender\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"Morally Justifiable to Push Person by Gender\") +\n  ggpubr::stat_compare_means(label.x.npc = .5) +\n  ggthemes::scale_fill_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-2.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_gender, width = 10, height = 6)\n\ngender_av_compare1 \u003c- cowplot::plot_grid(t1_szenario1q2_gender, t1_szenario2q2_gender)\n\ngender_av_compare1\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-14-3.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_av_compare1, width = 12, height = 6)\n```\n\n#### Scatters\n\n``` r\nt1_szenario1q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(age, t1_szenario1q2)) +\n  geom_jitter(aes(color = gender), alpha = 0.6) +\n  geom_smooth(aes(color = gender),method = \"lm\") +\n  xlab(\"Age\") + ylab(\"Morally justifiable: Switch Track\") +\n  ggtitle(\"Morally Justifiable to Switch Track by Gender and Age\") +\n  ggpubr::stat_compare_means(label.x.npc = .4) +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario1q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario1q2_gender, width = 10, height = 6)\n\nt1_szenario2q2_gender \u003c- trolley %\u003e% \n  ggplot(aes(age, t1_szenario2q2)) +\n  geom_jitter(aes(color = gender), alpha = 0.6) +\n  geom_smooth(aes(color = gender),method = \"lm\") +\n  xlab(\"Age\") + ylab(\"Morally justifiable: Push Person\") +\n  ggtitle(\"Morally Justifiable to Push Person by Gender and Age\") +\n  ggpubr::stat_compare_means(label.x.npc = .5) +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  guides(fill = F)\n\nt1_szenario2q2_gender\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-2.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(t1_szenario2q2_gender, width = 10, height = 6)\n\ngender_av_compare2 \u003c- cowplot::plot_grid(t1_szenario1q2_gender, t1_szenario2q2_gender)\n\ngender_av_compare2\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-15-3.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(gender_av_compare2, width = 12, height = 6)\n```\n\n## Factor Analysis Table\n\n``` r\n# eqp %\u003e% psych::alpha()\n#   psych::pca(2, rotate = \"varimax\") %\u003e% \n#   .$loadings %\u003e% unclass() %\u003e% as.data.frame() %\u003e% \n#   rownames_to_column(\"eqp_variable\")\n\nstrip_away_stuff \u003c- function(x) {\nx \u003c- str_remove(x, \"t1_eqp_\")\nx \u003c- parse_number(x) %\u003e% \n  ifelse(. %in% 1:9, paste0(\"eqp0\", .), .) %\u003e% \n  ifelse(. %in% 10:20, paste0(\"eqp\", .), .) \n}\n\neqp \u003c- eqp %\u003e% \n  set_names(eqp %\u003e% names %\u003e% strip_away_stuff) \n\nfactor_names \u003c- c(`1` = \"Idealism\",\n                  `2` = \"Relativism\")\n\n\nfactor_analysis \u003c- sjp.pca(eqp, rotation = \"varimax\", \n        nmbr.fctr = 2, prnt.plot = F, show.cronb = T, \n        show.values = T)$plot  +\n  ggthemes::scale_color_gdocs(\"\") +\n  ggthemes::theme_hc() +\n  ggtitle(\"Ethical Positions Questionnaire - PCA\") +\n  facet_grid(~xpos, labeller = as_labeller(factor_names)) +\n  labs(captions = \"Cronbach's Alpha = 0.80\")\n\nfactor_analysis\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-16-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\ntidytemplate::ggsave_it(factor_analysis, width = 10, height = 6)\n```\n\n## Summary Statistics\n\n``` r\nsave(trolley, file = \"text/data/trolley.Rdata\")\n\ntrolley %\u003e% \n  select(t1_szenario1q2, t2_szenario1q2, t1_szenario2q2, t2_szenario2q2, idealism_pca, relativism_pca, gender, age, church_attendance, general_group_control, general_group_discussion, general_group_information) %\u003e% \n  describe() %\u003e% \n  select(-vars, -trimmed, -mad, -se) %\u003e% \n  knitr::kable()\n```\n\n|                             |   n |       mean |        sd |     median |        min |       max |     range |        skew |    kurtosis |\n| --------------------------- | --: | ---------: | --------: | ---------: | ---------: | --------: | --------: | ----------: | ----------: |\n| t1\\_szenario1q2             | 290 |  5.7551724 | 2.9113887 |  6.0000000 |   1.000000 | 11.000000 | 10.000000 | \\-0.0312365 | \\-0.9024947 |\n| t2\\_szenario1q2             | 290 |  5.5586207 | 2.9136972 |  6.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.0144578 | \\-0.9380239 |\n| t1\\_szenario2q2             | 290 |  4.2931034 | 2.8321475 |  4.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.5494000 | \\-0.7245725 |\n| t2\\_szenario2q2             | 290 |  4.1827586 | 2.8644787 |  4.0000000 |   1.000000 | 11.000000 | 10.000000 |   0.5966912 | \\-0.6429501 |\n| idealism\\_pca               | 290 |  0.0000000 | 1.0000000 |  0.1817619 | \\-3.400484 |  1.733352 |  5.133836 | \\-0.8568363 |   0.3662967 |\n| relativism\\_pca             | 290 |  0.0000000 | 1.0000000 |  0.1126772 | \\-3.209701 |  2.336790 |  5.546491 | \\-0.3456592 |   0.0152953 |\n| gender\\*                    | 290 |        NaN |        NA |         NA |        Inf |     \\-Inf |     \\-Inf |          NA |          NA |\n| age                         | 289 | 24.0899654 | 3.8584597 | 23.0000000 |  18.000000 | 53.000000 | 35.000000 |   2.1419261 |  10.5203843 |\n| church\\_attendance          | 278 |  1.8669065 | 1.0442822 |  2.0000000 |   1.000000 |  6.000000 |  5.000000 |   1.3843362 |   2.0577066 |\n| general\\_group\\_control     | 290 |  0.3172414 | 0.4662068 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.7813203 | \\-1.3943109 |\n| general\\_group\\_discussion  | 290 |  0.3413793 | 0.4749921 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.6655847 | \\-1.5623488 |\n| general\\_group\\_information | 290 |  0.3413793 | 0.4749921 |  0.0000000 |   0.000000 |  1.000000 |  1.000000 |   0.6655847 | \\-1.5623488 |\n\n## Models\n\n``` r\ntrolley %\u003c\u003e% \n  mutate(groups = factor(groups)) %\u003e% \n  mutate(gender = factor(gender)) \n```\n\n1.  t1 als AV\n2.  t1 als AV und gender interaction (Idealism)\n3.  t1 als AV und gender interaction (Relativism)\n4.  t2 mit Controls für t1 und für treatments\n5.  Modelle aus 4. mit Treatment-Interaktion (Idealism)\n6.  Modelle aus 4. mit Treatment-Interaktion (Relativism)\n\n\u003c!-- end list --\u003e\n\n1.  Szenario 1 (a = Switch Track)\n2.  Szenario 2b (b = Push\nPerson)\n\n### Model 1a - Switch Track\n\n### Model 1b - Push Person\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg1_s1, reg1_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-21-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg1_combined.png\", width = 8, height = 9)\n```\n\n### Model 2a - Switch Track - Idealism X Gender\n\n### Model 2b - Push Person - Idealism X Gender\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg2_s1_int_idealism, reg2_s2_int_idealism, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-24-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg2_c1_idealism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit2_s1_int_idealism, type = \"pred\",\n               terms = c(\"idealism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 2a - Switch Track\"),  \n  get_model_data(fit2_s2_int_idealism, type = \"pred\",\n               terms = c(\"idealism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 2b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 2 - Idealism X Gender\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Gender\") +\n  ggthemes::scale_color_fivethirtyeight(\"Gender\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Idealism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-25-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg2_c2_idealism.png\", width = 8, height = 5)\n```\n\n### Model 3a - Switch Track - Relativism X Gender\n\n### Model 3b - Push Person- Relativism X Gender\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg3_s1_int_relativism, reg3_s2_int_relativism, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-28-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg3_c1_relativism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit3_s1_int_relativism, type = \"pred\",\n               terms = c(\"relativism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 3a - Switch Track\"),  \n  get_model_data(fit3_s2_int_relativism, type = \"pred\",\n               terms = c(\"relativism_pca\", \"gender\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 3b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 3 - Relativism X Gender\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Gender\") +\n  ggthemes::scale_color_fivethirtyeight(\"Gender\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Relativism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-29-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg3_c2_relativism.png\", width = 8, height = 5)\n```\n\n### Model 4a - Switch Track\n\n### Model 4b - Push Person\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg4_s1, reg4_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-32-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg4_combined.png\", width = 8, height = 9)\n```\n\n### Model 5a - Switch Track - Idealism\n\n### Model 5b - Push Person - Idealism\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg5_s1, reg5_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-35-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg5_c1_idealism.png\", width = 8, height = 9)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit5_s1, type = \"pred\",\n               terms = c(\"idealism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 5a - Switch Track\"),  \n  get_model_data(fit5_s2, type = \"pred\",\n               terms = c(\"idealism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 5b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 5 - Idealism X Experimental Groups\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Experimental Groups\") +\n  ggthemes::scale_color_fivethirtyeight(\"Experimental Groups\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Idealism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-36-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg5_c2_idealism.png\", width = 8, height = 5)\n```\n\n### Model 6a - Switch Track - Relativism\n\n### Model 6b - Push Person - Relativism\n\n#### Both Models\n\n``` r\ncowplot::plot_grid(reg6_s1, reg6_s2, ncol = 1)\n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-39-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg6_c1_relativism.png\", width = 7, height = 8)\n```\n\n#### Both Interactions\n\n``` r\nbind_rows(\n  get_model_data(fit6_s1, type = \"pred\",\n               terms = c(\"relativism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 6a - Switch Track\"),  \n  get_model_data(fit6_s2, type = \"pred\",\n               terms = c(\"relativism_pca\", \"groups\"), ci.lvl = .9) %\u003e% \n            mutate(type = \"Model 6b - Push Person\")\n  ) %\u003e% \n  ggplot(aes(x, predicted)) +\n  geom_ribbon(aes(ymin = conf.low, \n                  ymax = conf.high, \n                  fill = group), alpha = 0.11) +\n  geom_line(aes(color = group), size = 1.2) +\n  ggtitle(\"Model 6 - Relativism X Experimental Groups\") +\n  ggthemes::theme_hc() +\n  ggthemes::scale_fill_fivethirtyeight(\"Experimental Groups\") +\n  ggthemes::scale_color_fivethirtyeight(\"Experimental Groups\") +\n  facet_wrap(~type) +\n  ylab(\"Morally justifiable 1 - 11\") +\n  xlab(\"Relativism\")  \n```\n\n\u003cimg src=\"analysis_files/figure-gfm/unnamed-chunk-40-1.png\" style=\"display: block; margin: auto;\" /\u003e\n\n``` r\nggsave(filename = \"text/images/reg6_c2_relativism.png\", width = 8, height = 5)\n```\n\u003e\u003e\u003e\u003e\u003e\u003e\u003e be74a443fc2c19d263592bbe77254754f8227b89\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffavstats%2Feqp_paper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffavstats%2Feqp_paper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffavstats%2Feqp_paper/lists"}