Welcome toyour second Psychology lab. In the second lab. Ensure you have worked through the pre-class home activity before completing this lab

Your Task

Your task is to analyse the data for your second lab report with an increased level of independence. This sheet will guide you through some reminders of how to analyse your data, though you will need to think independenty and show you understand some basic R skills for this lab.

Preparing to work with R

The first thing we need to do is to download the folder containing the data we’ll be using to practice with in this homework task. Download the folder from Moodle and save this on your computer.

Next, we need to set the working directory in R. This is an instruction to tell R where the folder with the data we want to use is saved on our computers.

To set the working directory follow these steps:

  • Click on ‘Session’ in the R toolbar
  • Go to ‘Set Working Directory’
  • Next, go to ‘Choose directory…’
  • Now find the folder that you downloaded from Moodle with the data

Next…

  1. Add tidyverse to the library HINT library(…….)
  2. Load in your dataset HINT dat <- read_csv(…….)
  3. View your data

Understanding our Data

Have a look at your data. How many participants do we have?

We have two columns of interest called “Absent” and “Present” which refer to trials when depth cues were absent or present. For each individual the number given is the mean difference (in pixels) between the top line minus the bottom line averaged across all the trials of that condition.

Make sure you understand what it means in the number is negative, 0 or positive - in each instance which line was longer, the to of the bottom line?

Caluclating our Descriptive Statistics

Calculate your descriptive statistics (ie. the mean and standard deviation for the absent and present condition).

A hint for calculating the mean of your Absent condition is given below to get you started.

make sure you use the variable names provided beow

Absent_mean  <- mean(dat$Absent)
Present_mean <- ??????

Absent_sd  <- ??????
Present_sd <- ??????

Making a graph of our data

Next we need to make a graph of our means.

We use the concatenate function c() to link together the numbers of interest. Our numbers of interest are stored in the variables Absent_mean and Present_mean so we tell R to link these together c(Absent_mean, Present_mean) and store these in a new variable called graph_means.

graph_means <-c(Absent_mean, Present_mean)

We can then create a barplot() of our means. Complete the title and axis labels, as well as adding in ylim (have a look at the pre-class activity if you are unsure)

barplot(graph_means, main="Type your title in here",     xlab="Type your x axis label here", ylab = "Type your y axis label here", names.arg=c("Absent", "Present"))

BONUS TASK

Have a go at changing the colour of your graph (HINT col = ‘’ )

Inferential statistics

Select the type of t-test you wish to run.

HINT for a paired t-test paired = TRUE, for an independent t-test paired = FALSE

t.test(dat$Absent, dat$Present, paired = NULL, alternative = "two.sided")

CONGRATULATIONS! You’re now ready to write up your lab report!