Analyzing data

This page is under construction

Getting started

All analyses in the lab should start with a header text with at least the title and authors of the study. It's good to also include a short paragraph for future reference.

Basics

Importing data

You'll have one .csv file of your data that you export from the lab's database. You can import it by uploading the file in google colab and using the read_csv command:

data <- read_csv('data-exp1.csv')

Filtering data

Sometimes you want to create different data frames for different phases of your experiment. You can do this with filter.

production <- data %>% filter(exp_phase == 'production')
raing <- data %>% filter(exp_phase == 'rating')

Get summary data

Demographics

Usually you'll need to report (at least) how many participants were in your study, their gender, and their age. You can do this with group_by and summarise. In this example, we first group together by participant (because each participant has many trials), then we group together by condition and age_group.

data %>% group_by(condition, age_group, random_id, age, female) %>%
  summarise(n = n_distinct(random_id)) %>%
  group_by(condition, age_group) %>%
  summarise(n = n(), n_female = sum(female), mean_age = mean(age))

Production test

In many of our studies, we want to know how often (proportion) a participant used a particular marker in the test out of correct nouns. First we can get the number of trials with correct nouns and merge it back with the filtered correct noun production data.

production %>% filter(corr_noun == TRUE) %>% group_by(random_id) %>%
    summarise(n_trials = n()) %>% 
    left_join(filter(production, corr_noun == TRUE), by = "random_id")

Then we can get

Rating test

Last updated