Welcome to your first psychology in-class analysis session. Please follow through these instructions to help you complete the analysis for your results section.

Getting started : The results section of a lab report

In the Results section of a lab report, you describe to the reader what you found. You need to both summarise your findings as well as describe any patterns in your data for the reader. Be careful to leave detailed discussions of the implications to the Discussion section.

In a research report, you summarise your data with descriptive statistics. Today we’ll be describing our data by calculating the mean and standard deviation, and making a bar graph.

You will find a csv file in the Lab1_Results folder on Moodle. Download and unzip this folder now.

Preparing to work with R

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

Loading in tidyverse

We load a package using the R command library() with the name of the package between the parentheses ().

So, in this case (where our package is called “tidyverse”) we give R the command library(tidyverse)

library(tidyverse)

Loading in our data

Now R knows where to find our data (in our working directory) and has loaded in a package (tidyverse) with all the functions we need. Next, we need to load in our data set. To do this we type in the command dat <- read_csv('Access_practice_data.csv')

dat <- read_csv('Experiment1_data.csv')

The command read_csv is telling R we want to read in a ‘csv’ file (like saying .doc or .docx). We have to make sure the file name is typed in exactly the same in R as it is saved on our computer. The arrow <- assigns the data we are reading in our new dame for our data called dat.

Understanding our Data

We collected data from the Day and Evening class Access Psychology students. For each student we recorded their age, which memory technique group they were part of and the number of word pairs they correctly recalled.

Lets start by looking at our data by typing View(dat)

View(dat)

A new screen will appear showing us our data set.

TASK 1: Familiarise yourself with the data. Do you understand what each column is showing here? Identify what information is given in each column.

Caluclating our Descriptive Statistics

Descriptive statistics are numbers that help to describe our data (for example, the avergae memory score for a paticular group). In this exercise, we want to calculate the average number of word pairs correctly recalled in each group of participants, depending on whether they were in the ‘Repetition’ or ‘Visualisation’ condition.

The average can also be referred to as the mean. The mean score is calculated by adding all the score of one group together, and then dividing the total by the number of participants. Want to learn more about calculating means? have a look at this website

To calculating the mean number of word pairs correctly recalled in each group of participants seperately, we need to first tell R we want to create 2 groups of participants. We do this by using the command group_by() and telling R how we want to group our data.

dat_grouped <- group_by(dat, GROUP)

The argument ``group_by(dat, GROUP)``` can be read as “group our data (called dat) by GROUP”. We now have made 2 groups - one for the ‘Repetition’ condition and one for the ‘Visualisation’ condition.

Now we can calculate the mean (i.e. average) exam score for each group by using the summarise() command.

dat_mean <- summarise(dat_grouped, mean=mean(SCORE))

The argument ``summarise(dat_grouped, mean=mean(SCORE))``` can be read as “summarise our data (called dat_grouped) by calculating the mean SCORE”. Because we have previously grouped our data, R knows to calculate the mean exam grade for each group

We can check our data by typing View(dat_mean)

View(dat_mean)

TASK 2: Look at the mean for the two groups. Do you see any differences? Write a few sentences now describing the trends you see and include this in the results section of your lab report

NOTE:: When we write up our lab reort we’ll want to show this information in a table, like the 1 created by R here. When we report our values in our lab report, we always use 2 decimal places ie. 2 nunbers after the point such as 10.23, 11.64 or 23.44.

Next we want to calculate the standard deviation.

The standard deviation measures the amount of spread in our data (i.e. how similar participants are to the mean). The standard deviation is a more difficult concept than the mean, so have a look at this website (https://www.mathsisfun.com/data/standard-deviation.html) for more information about how the standard devition is calculated.

It is important you understand why the standard deviation is important. Have a look at this website (https://www.dummies.com/education/math/statistics/why-standard-deviation-is-an-important-statistic/) for more information.

We calculate the staandard deviation by using the argument sd()

dat_sd <- summarise(dat_grouped, sd=sd(SCORE))

We can check our data by typing View(dat_sd)

View(dat_sd)

TASK 3: Look at the standard deviatin for the two groups. Do you see any differences? What can this tell you about the variance in scores between the two groups? Include this in the results section of your lab report

Bringing it together

  1. In your Results section of your lab report you would report your descriptive statistics. It should be clear what the mean of each group was. When you report the mean you would include the standard deviation. In both cases we round up numbers to 2 decimal places.

Here is an example of how you would report your results in the results section of a lab report:

The mean reaction time for younger adults was 345.34ms (SD = 25.34) and for older adults was 834.25ms (SD = 98.23).

TASK 4: Write out you results if your mean and standard deviation now. Include this paragraph in your Results section of your lab report

Visualising your data

Next we need to set up our data ready to make a bar graph to include in our lab report.

There are 2 stages to making our bar graph. First, we need to tell R what values we want to graph (our groups means).

Our group means are stored in dat_mean. We are only interested in the column that includes our group means, which is in the column called ‘mean’. To tell R we want to look at a particular collumn within a table we use the dollar $ sign. So dat_mean$mean tells R we want to make a bar chart using only the ‘mean’ column from the dataset ‘dat_mean’.

Next, we need to give our barplot() a title using the argument main="title"`` , as well as an x-axis label (vertical along the bottom of the graph) usingxlab=“x-label”and a y-axis label (horizontal along the edge of the graph) usingyab = “y- label”``` .

The last argument name.arg=c() allows us to name our two columns. Try running the code below and check your graph looks the same.

Task 5: Complete the code below giving your graph appropriate titles and labels

barplot(dat_mean$mean, main="Insert your title here",     xlab="Insert x label here", ylab = "insert y label here", names.arg=c("insert Group 1 name here", "insert group 2 name here"))

Our y-axis (along the side of the graph) is too small. So lets add 1 extra argument ylim=c(ymin, ymax) to tell R how big to make the y-axis, as in the code below:

Task 6: Complete the code below to make sure your graph is of an appropriate size for our data

barplot(dat_mean$mean, main="Average grade in Day and Evening class Students",     xlab="Class", ylab = "Grade", names.arg=c("Day", "Evening"), ylim=c(insert minimum value, insert maximum value))

Task 7: In a few sentences describe what you can see on the bar graph - which group remembered more? Include your graph and a description of your graph in your lab report

Task 8: Finally summarise your results section by telling the reader whether you found evidence to support your hypothesis or whether you did not find evidence to support your hypothesis.

HINT we cannot accept/reject our hypothesis or say we have a ‘significant’ difference between groups until we have inferential statistics (we will look at these for the second lab report). We also cannot say that we have ‘proved’ our hypothesis - there is always a chance that our results were found due to chance, and not due to a real difference between the groups/conditions.

CONGRATULATIONS! You’re now ready to write the Results section of your lab report