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 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.
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:
Next…
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?
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 <- ??????
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 = ‘’ )
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")