Preliminaries for analysis.
library(tidyverse)
## ── Attaching packages ──────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 3.1.0 ✔ purrr 0.2.5
## ✔ tibble 1.4.2 ✔ dplyr 0.7.8
## ✔ tidyr 0.8.1 ✔ stringr 1.3.1
## ✔ readr 1.1.1 ✔ forcats 0.3.0
## ── Conflicts ─────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(here)
## here() starts at /Users/mcfrank/Projects/multirmts
library(langcog)
##
## Attaching package: 'langcog'
## The following object is masked from 'package:base':
##
## scale
Now load data.
d_raw <- read_csv(here("data/RMTS.csv"))
## Parsed with column specification:
## cols(
## subject = col_character(),
## same_1 = col_integer(),
## same_2 = col_integer(),
## same_3 = col_integer(),
## diff_1 = col_integer(),
## diff_2 = col_integer(),
## diff_3 = col_integer(),
## `Hesitation (trial numbers)` = col_character(),
## `Left/Right Bias` = col_character(),
## guessing = col_character(),
## FirstBlock = col_character(),
## RulePreseveration = col_integer(),
## SameAvg = col_double(),
## DiffAvg = col_double(),
## `explanation?` = col_character(),
## `general notes` = col_character()
## )
Reformat to long format.
d <- d_raw %>%
filter(!is.na(subject)) %>%
select(-`Hesitation (trial numbers)`, -`Left/Right Bias`, -guessing,
-SameAvg, -DiffAvg, -`general notes`,
-RulePreseveration, -`explanation?`) %>%
gather(trial_type, correct, same_1:diff_3) %>%
separate(trial_type, c("trial_type", "trial_num"))
By trial type.
ms <- d %>%
group_by(trial_type) %>%
multi_boot_standard(col = "correct", na.rm = TRUE)
ggplot(ms,
aes(x = trial_type, y = mean, col = trial_type)) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper)) +
ylim(0,1) +
ylab("Proportion correct") +
xlab("Trial type") +
geom_hline(yintercept = .5, lty = 2) +
theme_classic() +
ggthemes::scale_color_solarized() +
theme(legend.position = "bottom")
By trial type and trial number.
ms <- d %>%
group_by(trial_type, trial_num) %>%
multi_boot_standard(col = "correct", na.rm = TRUE)
ggplot(ms,
aes(x = trial_num, y = mean, col = trial_type)) +
geom_pointrange(aes(ymin = ci_lower, ymax = ci_upper),
position = position_dodge(width = .1)) +
geom_line(aes(group = trial_type)) +
ylim(0,1) +
ylab("Proportion correct") +
xlab("Trial type") +
geom_hline(yintercept = .5, lty = 2) +
theme_classic() +
ggthemes::scale_color_solarized() +
theme(legend.position = "bottom")