Introduction

The final exam is worth 30% of your final grade. The exam consists of a progression of tasks with increasing difficulty. Different tasks are worth different points.

  • If you successfully complete a task, you will receive full points for that task and may move onto the next task.

  • If you don’t complete a task, or you have errors in your script or output, or R shows warning messages, you will receive 0 points to the current and all following tasks (unless stated otherwise). Hence, make sure to successfully complete each task before moving to the next one.

For the successful completion of this test, you may use your lecture notes, old R scripts, and, of course, all of your other friends: Google, Stackoverflow, cheat sheets and so forth and so on.

You’re free to use whatever R commands you want for completing the tasks, unless instructed differently. Extra points will be awarded for the use of efficient commands (e.g., piping), elegant solutions, and pretty plots. However, keep in mind that if you script a fancy code or plot and it doesn’t work, the task (and all following tasks) will be awarded 0 points. Bottom line: manage your time wisely.

Disclaimer: This file is property of the University of Windsor. Do not share this file.

Preface

You are a great scientist (congrats!). Sir Richard Branson heard about your great success and wants to pay you a ton of money to run a study to investigate the effect of automation on spacecraft pilots’ performance. In short, Richard is interested in understanding whether or not using automation will improve pilots’ performance.

The data from the experiment that you just finished running is saved in a csv file and is available here.

The dataset is organized as following:

  • Participant: participant # 1 to 12
  • Mode: Each pilot underwent two within-subject conditions: Manual and Automated. In the manual condition, the system was operated manually. In the automated condition, the automated system was engaged.
  • Events: to understand pilots’ reactions to unexpected events, pilots were instructed to press a button every time they were presented with an event (a light in this case). They were presented with 6 events in total: event #1 to 6.
  • RT: Response Times (RT) to the event detection task were recorded in milliseconds.

Points breakdown

Below are the tasks included in the exam, each with the numbers of points assigned to them.

Task Points
Task 1 1
Task 2 2
Task 3 3
Task 4 4
Task 5 3
Task 6 3
Task 7 3
Task 8 2
Task 9 3
Task 10 4
Extra 2

How to submit the final script

At the end of exam, save your final R file as LastName_studentID.R in this folder. Make sure the file has the correct extension.

Task 1

1 point

Read the dataset into R, and assign the name data to it

Note that for this particular task you will need to set a directory which is unique for your machine and local folder. That’s totally fine. When grading, I will change the directory in your script back to a different directory on my machine. However, make sure to assign a name to your dataset and always reference that dataset (or derivate datasets) throughout the script, and never reference the original csv file again in your script.

Task 2

2 points

Assign the variables in your dataset as following:

  • Participant is a factor
  • Mode is a factor
  • RT is numeric
  • NAs are removed

Task 3

3 points

Create a Gender factor and add it to the dataset.

  • Participants 1-6 are males
  • Participants 7-12 are females

Task 4

4 points

Using mutate () or its combinations, create a Response variable from RT and add it to the dataset.

  • If RT < 500, then Response is short
  • If 501 < RT <1000 then Response is medium
  • If RT > 1001 then Response is long

Task 5

3 points

Using the dplyr() function, create a new dataset data_sum that has mean and standard deviation of RT broken down by mode and gender. All nonnumeric values may need to be removed.

Task 6

3 points

Utilize data_sum to create a histogram with:

  • RT on the y axis
  • Mode on the x axis
  • gender as grouping variable
  • Response Times (in ms) for the y axis’ title
  • System Mode for the x axis’ title

Assign the name myPlot to it.

Task 7

3 points

Run an ANOVA with RT as dependent measure and mode as within-subject factor.

A few important things to keep in mind:

  • You may need to omit empty cells or NAs from your dataset first.
  • When running the ANOVA, R may show you the following message.
Warning: Collapsing data to cell means. *IF* the requested effects are a subset of the full design, you must use the "within_full" argument, else results may be inaccurate.

If you see this or a similar message together with the results of the ANOVA, that’s fine and you can move on to the following task. Make sure the results of the ANOVA are shown though.

Task 8

2 points

Let’s include gender as between subject variable and rerun the ANOVA.

You may see a similar error message as in 7). You can move onto the next task and consider Task 8 successfully completed, provided the results of the ANOVA are shown.

Task 9

3 points

Following what you have done for task 8, run an independent t-test to investigate the effect of gender on RT. In addition, calculate Cohen’s d for this comparison.

Task 10

4 points

Edit the data dataset so to have RT for Manual and Automated Modes into 2 separate columns.

Extra

2 points

For task 7, you had the following message shown:

Warning: Collapsing data to cell means. *IF* the requested effects are a subset of the full design, you must use the "within_full" argument, else results may be inaccurate.

Revise the dataset and re-run the function you scripted for task 7 so R won’t show you any error message.